michal-grzedzicki / rpms / rpm

Forked from rpms/rpm 4 months ago
Clone
629b27
From e86207d3395e0963f19363b047551100569900df Mon Sep 17 00:00:00 2001
629b27
From: chantra <chantr4@gmail.com>
629b27
Date: Tue, 8 Feb 2022 17:12:55 -0800
629b27
Subject: [PATCH 17/30] [test] Add test installing an RPM with reflink plugin
629b27
629b27
The test only runs for reflinkable FS, like XFS and BTRFS.
629b27
dbus_announce is being disabled as it generates warning to stderr when
629b27
running within the fakeroot.
629b27
---
629b27
 tests/atlocal.in     | 13 +++++++++++++
629b27
 tests/rpm2extents.at | 15 +++++++++++++++
629b27
 2 files changed, 28 insertions(+)
629b27
629b27
diff --git a/tests/atlocal.in b/tests/atlocal.in
629b27
index c18637362..a110564e2 100644
629b27
--- a/tests/atlocal.in
629b27
+++ b/tests/atlocal.in
629b27
@@ -50,6 +50,19 @@ else
629b27
 
629b27
 RPM_XFAIL=${RPM_XFAIL-1}
629b27
 
629b27
+FSTYPE=$(stat -f -c %T /)
629b27
+REFLINKABLE_FS=("xfs" "brtfs")
629b27
+
629b27
+REFLINK_DISABLED=true;
629b27
+for item in "${REFLINKABLE_FS[@]}"
629b27
+do
629b27
+    if test "${FSTYPE}" = "${item}"
629b27
+    then
629b27
+	REFLINK_DISABLED=false;
629b27
+	break
629b27
+    fi
629b27
+done
629b27
+
629b27
 function run()
629b27
 {
629b27
     "$@" --define "_tmppath ${RPMTEST}/tmp" --define "_topdir ${TOPDIR}" --dbpath="${RPMTEST}/var/lib/rpm/"
629b27
diff --git a/tests/rpm2extents.at b/tests/rpm2extents.at
629b27
index 18accfc75..44e46a68e 100644
629b27
--- a/tests/rpm2extents.at
629b27
+++ b/tests/rpm2extents.at
629b27
@@ -94,3 +94,18 @@ runroot rpmkeys -Kv /tmp/hello-2.0-1.x86_64-signed.rpm; echo $?
629b27
 ],
629b27
 [])
629b27
 AT_CLEANUP
629b27
+
629b27
+AT_SETUP([rpm2extents install package])
629b27
+AT_KEYWORDS([rpm2extents install package])
629b27
+AT_SKIP_IF([$REFLINK_DISABLED])
629b27
+AT_CHECK([
629b27
+RPMDB_INIT
629b27
+
629b27
+runroot_other cat /data/RPMS/hello-2.0-1.x86_64.rpm | runroot_other rpm2extents SHA256 > ${RPMTEST}/tmp/hello-2.0-1.x86_64.rpm 2> /dev/null
629b27
+runroot_plugins rpm -i --nodigest --nodeps --undefine=%__transaction_dbus_announce /tmp/hello-2.0-1.x86_64.rpm
629b27
+test -f ${RPMTEST}/usr/bin/hello
629b27
+],
629b27
+[0],
629b27
+[],
629b27
+[])
629b27
+AT_CLEANUP
629b27
-- 
629b27
2.35.1
629b27