richardphibel / rpms / rpm

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