summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPanu Matilainen <pmatilai@redhat.com>2023-01-13 10:44:28 +0200
committerMichal Domonkos <mdomonko@redhat.com>2023-03-13 15:32:25 +0100
commitf72c7800ae1e02ed6dfe3a240c4dc756883cc2ac (patch)
tree1a58ff1165e7003626dd780a787ee437ef40907c
parent1c169a4089c3d08069651a33a20be67f26cfbfc4 (diff)
downloadrpm-f72c7800ae1e02ed6dfe3a240c4dc756883cc2ac.tar.gz
Add a test for special device node installation
This is a bit theoretical as it does not work for regular users or in containers which are the typical scenarios for running the test-suite. (backported from commit 5dcc399cd21f607f13eb092a3abfc8b8daa59d4c)
-rw-r--r--tests/Makefile.am1
-rw-r--r--tests/atlocal.in6
-rw-r--r--tests/data/SPECS/dev.spec14
-rw-r--r--tests/rpmi.at17
4 files changed, 38 insertions, 0 deletions
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 71f73aba7..733eaca90 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -126,6 +126,7 @@ EXTRA_DIST += data/SPECS/verifyfiles.spec
EXTRA_DIST += data/SPECS/source_space.spec
EXTRA_DIST += data/SOURCES/source_space.tar.gz
EXTRA_DIST += data/SPECS/fifo.spec
+EXTRA_DIST += data/SPECS/dev.spec
EXTRA_DIST += data/keys/rpm.org-rsa-2048-test.pgp
EXTRA_DIST += data/keys/rpm.org-rsa-2048-test.pub
EXTRA_DIST += data/keys/rpm.org-rsa-2048-test.pgp
diff --git a/tests/atlocal.in b/tests/atlocal.in
index c2c897803..5873b10af 100644
--- a/tests/atlocal.in
+++ b/tests/atlocal.in
@@ -64,6 +64,12 @@ if grep -q '#define WITH_CAP 1' "${abs_top_builddir}/config.h"; then
else
CAP_DISABLED=true;
fi
+if mknod foodev c 123 123; then
+ MKNOD_DISABLED=false
+ rm -f foodev
+else
+ MKNOD_DISABLED=true
+fi
MALLOC_DEBUG=libc_malloc_debug.so.0
if ! LD_PRELOAD=${MALLOC_DEBUG} /bin/true 2>&1 | grep -q ERROR; then
diff --git a/tests/data/SPECS/dev.spec b/tests/data/SPECS/dev.spec
new file mode 100644
index 000000000..d784fe114
--- /dev/null
+++ b/tests/data/SPECS/dev.spec
@@ -0,0 +1,14 @@
+Name: dev
+Version: 1.0
+Release: 1
+Group: Testing
+License: GPL
+Summary: Testing dev behavior
+BuildArch: noarch
+
+%description
+%{summary}
+
+%files
+%dev(c 11 22) /test-char
+%dev(b 33 44) /test-block
diff --git a/tests/rpmi.at b/tests/rpmi.at
index 0ca84914c..7c8f25eff 100644
--- a/tests/rpmi.at
+++ b/tests/rpmi.at
@@ -1270,6 +1270,23 @@ runroot rpm -Vv --nouser --nogroup fifo
[])
AT_CLEANUP
+AT_SETUP([rpm -U dev])
+AT_KEYWORDS([install])
+AT_SKIP_IF([$MKNOD_DISABLED])
+AT_CHECK([
+RPMDB_INIT
+
+runroot rpmbuild -bb --quiet /data/SPECS/dev.spec
+runroot rpm -U --ignoreos /build/RPMS/noarch/dev-1.0-1.noarch.rpm
+runroot rpm -Vv --nouser --nogroup dev
+],
+[0],
+[......... /test-block
+......... /test-char
+],
+[])
+AT_CLEANUP
+
AT_SETUP([rpm -U with Obsoletes])
AT_KEYWORDS([install])
AT_CHECK([