|
Harald Hoyer |
89b080 |
From 4eafdbdbe8ee3486ae96bdc6b5fa34112064a3ea Mon Sep 17 00:00:00 2001
|
|
Harald Hoyer |
89b080 |
From: Harald Hoyer <harald@redhat.com>
|
|
Harald Hoyer |
89b080 |
Date: Mon, 9 Jul 2012 16:28:47 +0200
|
|
Harald Hoyer |
89b080 |
Subject: [PATCH] test: new test TEST-99-RPM
|
|
Harald Hoyer |
89b080 |
|
|
Harald Hoyer |
89b080 |
This test installs the dracut rpm together with the kernel in an
|
|
Harald Hoyer |
89b080 |
installroot. rpm -Va and rpm -qf are used, to ensure nothing modified
|
|
Harald Hoyer |
89b080 |
files in the real root.
|
|
Harald Hoyer |
89b080 |
---
|
|
Harald Hoyer |
89b080 |
test/TEST-99-RPM/Makefile | 10 ++++++
|
|
Harald Hoyer |
89b080 |
test/TEST-99-RPM/test.sh | 83 +++++++++++++++++++++++++++++++++++++++++++++
|
|
Harald Hoyer |
89b080 |
2 files changed, 93 insertions(+)
|
|
Harald Hoyer |
89b080 |
create mode 100644 test/TEST-99-RPM/Makefile
|
|
Harald Hoyer |
89b080 |
create mode 100755 test/TEST-99-RPM/test.sh
|
|
Harald Hoyer |
89b080 |
|
|
Harald Hoyer |
89b080 |
diff --git a/test/TEST-99-RPM/Makefile b/test/TEST-99-RPM/Makefile
|
|
Harald Hoyer |
89b080 |
new file mode 100644
|
|
Harald Hoyer |
89b080 |
index 0000000..5513c52
|
|
Harald Hoyer |
89b080 |
--- /dev/null
|
|
Harald Hoyer |
89b080 |
+++ b/test/TEST-99-RPM/Makefile
|
|
Harald Hoyer |
89b080 |
@@ -0,0 +1,10 @@
|
|
Harald Hoyer |
89b080 |
+all:
|
|
Harald Hoyer |
89b080 |
+ @make -s --no-print-directory -C ../.. clean all rpm
|
|
Harald Hoyer |
89b080 |
+ @basedir=../.. testdir=../ ./test.sh --all
|
|
Harald Hoyer |
89b080 |
+setup:
|
|
Harald Hoyer |
89b080 |
+ @make --no-print-directory -C ../.. clean rpm
|
|
Harald Hoyer |
89b080 |
+ @basedir=../.. testdir=../ ./test.sh --setup
|
|
Harald Hoyer |
89b080 |
+clean:
|
|
Harald Hoyer |
89b080 |
+ @basedir=../.. testdir=../ ./test.sh --clean
|
|
Harald Hoyer |
89b080 |
+run:
|
|
Harald Hoyer |
89b080 |
+ @basedir=../.. testdir=../ ./test.sh --run
|
|
Harald Hoyer |
89b080 |
diff --git a/test/TEST-99-RPM/test.sh b/test/TEST-99-RPM/test.sh
|
|
Harald Hoyer |
89b080 |
new file mode 100755
|
|
Harald Hoyer |
89b080 |
index 0000000..25c1895
|
|
Harald Hoyer |
89b080 |
--- /dev/null
|
|
Harald Hoyer |
89b080 |
+++ b/test/TEST-99-RPM/test.sh
|
|
Harald Hoyer |
89b080 |
@@ -0,0 +1,83 @@
|
|
Harald Hoyer |
89b080 |
+#!/bin/bash
|
|
Harald Hoyer |
89b080 |
+# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
|
|
Harald Hoyer |
89b080 |
+# ex: ts=8 sw=4 sts=4 et filetype=sh
|
|
Harald Hoyer |
89b080 |
+TEST_DESCRIPTION="rpm integrity after dracut and kernel install"
|
|
Harald Hoyer |
89b080 |
+$TESTDIR
|
|
Harald Hoyer |
89b080 |
+
|
|
Harald Hoyer |
89b080 |
+test_run() {
|
|
Harald Hoyer |
89b080 |
+ set -x
|
|
Harald Hoyer |
89b080 |
+ export rootdir=$TESTDIR/root
|
|
Harald Hoyer |
89b080 |
+
|
|
Harald Hoyer |
89b080 |
+ mkdir -p $rootdir
|
|
Harald Hoyer |
89b080 |
+
|
|
Harald Hoyer |
89b080 |
+ mkdir -p "$rootdir/proc"
|
|
Harald Hoyer |
89b080 |
+ mkdir -p "$rootdir/sys"
|
|
Harald Hoyer |
89b080 |
+ mkdir -p "$rootdir/dev"
|
|
Harald Hoyer |
89b080 |
+
|
|
Harald Hoyer |
89b080 |
+ mount --bind /proc "$rootdir/proc"
|
|
Harald Hoyer |
89b080 |
+ mount --bind /sys "$rootdir/sys"
|
|
Harald Hoyer |
89b080 |
+ mount -t devtmpfs devtmpfs "$rootdir/dev"
|
|
Harald Hoyer |
89b080 |
+
|
|
Harald Hoyer |
89b080 |
+ yum --nogpgcheck --releasever=/ --installroot "$rootdir"/ install -y \
|
|
Harald Hoyer |
89b080 |
+ yum \
|
|
Harald Hoyer |
89b080 |
+ passwd \
|
|
Harald Hoyer |
89b080 |
+ rootfiles \
|
|
Harald Hoyer |
89b080 |
+ systemd \
|
|
Harald Hoyer |
89b080 |
+ kernel \
|
|
Harald Hoyer |
89b080 |
+ fedora-release \
|
|
Harald Hoyer |
89b080 |
+ device-mapper-multipath \
|
|
Harald Hoyer |
89b080 |
+ lvm2 \
|
|
Harald Hoyer |
89b080 |
+ mdadm \
|
|
Harald Hoyer |
89b080 |
+ bash \
|
|
Harald Hoyer |
89b080 |
+ iscsi-initiator-utils \
|
|
Harald Hoyer |
89b080 |
+ $basedir/dracut-[0-9]*.$(arch).rpm \
|
|
Harald Hoyer |
89b080 |
+ $basedir/dracut-network-[0-9]*.$(arch).rpm
|
|
Harald Hoyer |
89b080 |
+
|
|
Harald Hoyer |
89b080 |
+ cat >"$rootdir"/test.sh <
|
|
Harald Hoyer |
89b080 |
+#!/bin/bash
|
|
Harald Hoyer |
89b080 |
+set -x
|
|
Harald Hoyer |
89b080 |
+export LC_MESSAGES=C
|
|
Harald Hoyer |
89b080 |
+rpm -Va &> /test.output
|
|
Harald Hoyer |
89b080 |
+find / -xdev -type f -not -path '/var/*' \
|
|
Harald Hoyer |
89b080 |
+ -not -path '/usr/lib/modules/*/modules.*' \
|
|
Harald Hoyer |
89b080 |
+ -not -path '/etc/*-' \
|
|
Harald Hoyer |
89b080 |
+ -not -path '/etc/.pwd.lock' \
|
|
Harald Hoyer |
89b080 |
+ -not -path '/run/mount/utab' \
|
|
Harald Hoyer |
89b080 |
+ -not -path '/test.sh' \
|
|
Harald Hoyer |
89b080 |
+ -not -path '/test.output' \
|
|
Harald Hoyer |
89b080 |
+ -not -path '/etc/nsswitch.conf.bak' \
|
|
Harald Hoyer |
89b080 |
+ -not -path '/etc/iscsi/initiatorname.iscsi' \
|
|
Harald Hoyer |
89b080 |
+ -not -path '/dev/null' \
|
|
Harald Hoyer |
89b080 |
+ -exec rpm -qf '{}' ';' | \
|
|
Harald Hoyer |
89b080 |
+ fgrep 'not owned' &> /test.output
|
|
Harald Hoyer |
89b080 |
+exit
|
|
Harald Hoyer |
89b080 |
+EOF
|
|
Harald Hoyer |
89b080 |
+
|
|
Harald Hoyer |
89b080 |
+ chmod 0755 "$rootdir/test.sh"
|
|
Harald Hoyer |
89b080 |
+
|
|
Harald Hoyer |
89b080 |
+ chroot "$rootdir" /test.sh
|
|
Harald Hoyer |
89b080 |
+
|
|
Harald Hoyer |
89b080 |
+ if [[ -s "$rootdir"/test.output ]]; then
|
|
Harald Hoyer |
89b080 |
+ failed=1
|
|
Harald Hoyer |
89b080 |
+ echo TEST Failed >&2
|
|
Harald Hoyer |
89b080 |
+ cat "$rootdir"/test.output >&2
|
|
Harald Hoyer |
89b080 |
+ fi
|
|
Harald Hoyer |
89b080 |
+
|
|
Harald Hoyer |
89b080 |
+ umount "$rootdir/proc"
|
|
Harald Hoyer |
89b080 |
+ umount "$rootdir/sys"
|
|
Harald Hoyer |
89b080 |
+ umount "$rootdir/dev"
|
|
Harald Hoyer |
89b080 |
+
|
|
Harald Hoyer |
89b080 |
+ [[ $failed ]] && return 1
|
|
Harald Hoyer |
89b080 |
+ return 0
|
|
Harald Hoyer |
89b080 |
+
|
|
Harald Hoyer |
89b080 |
+}
|
|
Harald Hoyer |
89b080 |
+
|
|
Harald Hoyer |
89b080 |
+test_setup() {
|
|
Harald Hoyer |
89b080 |
+ return 0
|
|
Harald Hoyer |
89b080 |
+}
|
|
Harald Hoyer |
89b080 |
+
|
|
Harald Hoyer |
89b080 |
+test_cleanup() {
|
|
Harald Hoyer |
89b080 |
+ return 0
|
|
Harald Hoyer |
89b080 |
+}
|
|
Harald Hoyer |
89b080 |
+
|
|
Harald Hoyer |
89b080 |
+. $testdir/test-functions
|