teknoraver / rpms / rpm

Forked from rpms/rpm 3 months ago
Clone
Blob Blame History Raw
From e86207d3395e0963f19363b047551100569900df Mon Sep 17 00:00:00 2001
From: chantra <chantr4@gmail.com>
Date: Tue, 8 Feb 2022 17:12:55 -0800
Subject: [PATCH 17/30] [test] Add test installing an RPM with reflink plugin

The test only runs for reflinkable FS, like XFS and BTRFS.
dbus_announce is being disabled as it generates warning to stderr when
running within the fakeroot.
---
 tests/atlocal.in     | 13 +++++++++++++
 tests/rpm2extents.at | 15 +++++++++++++++
 2 files changed, 28 insertions(+)

diff --git a/tests/atlocal.in b/tests/atlocal.in
index c18637362..a110564e2 100644
--- a/tests/atlocal.in
+++ b/tests/atlocal.in
@@ -50,6 +50,19 @@ else
 
 RPM_XFAIL=${RPM_XFAIL-1}
 
+FSTYPE=$(stat -f -c %T /)
+REFLINKABLE_FS=("xfs" "brtfs")
+
+REFLINK_DISABLED=true;
+for item in "${REFLINKABLE_FS[@]}"
+do
+    if test "${FSTYPE}" = "${item}"
+    then
+	REFLINK_DISABLED=false;
+	break
+    fi
+done
+
 function run()
 {
     "$@" --define "_tmppath ${RPMTEST}/tmp" --define "_topdir ${TOPDIR}" --dbpath="${RPMTEST}/var/lib/rpm/"
diff --git a/tests/rpm2extents.at b/tests/rpm2extents.at
index 18accfc75..44e46a68e 100644
--- a/tests/rpm2extents.at
+++ b/tests/rpm2extents.at
@@ -94,3 +94,18 @@ runroot rpmkeys -Kv /tmp/hello-2.0-1.x86_64-signed.rpm; echo $?
 ],
 [])
 AT_CLEANUP
+
+AT_SETUP([rpm2extents install package])
+AT_KEYWORDS([rpm2extents install package])
+AT_SKIP_IF([$REFLINK_DISABLED])
+AT_CHECK([
+RPMDB_INIT
+
+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
+runroot_plugins rpm -i --nodigest --nodeps --undefine=%__transaction_dbus_announce /tmp/hello-2.0-1.x86_64.rpm
+test -f ${RPMTEST}/usr/bin/hello
+],
+[0],
+[],
+[])
+AT_CLEANUP
-- 
2.35.1