dracut-systemd/dracut-initqueue: only start service if really needed
[dracut.git] / test / TEST-99-RPM / test.sh
blobd0c89e5f0273e5aeb0a979d27d7c8a38f351479d
1 #!/bin/bash
3 TEST_DESCRIPTION="rpm integrity after dracut and kernel install"
4 $TESTDIR
6 test_run() {
7 set -x
8 export rootdir=$TESTDIR/root
10 mkdir -p $rootdir
12 mkdir -p "$rootdir/proc"
13 mkdir -p "$rootdir/sys"
14 mkdir -p "$rootdir/dev"
16 trap 'ret=$?; [[ -d $rootdir ]] && { umount "$rootdir/proc"; umount "$rootdir/sys"; umount "$rootdir/dev"; rm -rf -- "$rootdir"; }; exit $ret;' EXIT
17 trap '[[ -d $rootdir ]] && { umount "$rootdir/proc"; umount "$rootdir/sys"; umount "$rootdir/dev"; rm -rf -- "$rootdir"; }; exit 1;' SIGINT
19 mount --bind /proc "$rootdir/proc"
20 mount --bind /sys "$rootdir/sys"
21 mount -t devtmpfs devtmpfs "$rootdir/dev"
23 yum --nogpgcheck --releasever=/ --installroot "$rootdir"/ install -y \
24 yum \
25 passwd \
26 rootfiles \
27 systemd \
28 kernel \
29 fedora-release \
30 device-mapper-multipath \
31 lvm2 \
32 mdadm \
33 bash \
34 iscsi-initiator-utils \
35 $basedir/dracut-[0-9]*.$(arch).rpm \
36 $basedir/dracut-network-[0-9]*.$(arch).rpm
38 cat >"$rootdir"/test.sh <<EOF
39 #!/bin/bash
40 set -x
41 export LC_MESSAGES=C
42 rpm -Va &> /test.output
43 find / -xdev -type f -not -path '/var/*' \
44 -not -path '/usr/lib/modules/*/modules.*' \
45 -not -path '/etc/*-' \
46 -not -path '/etc/.pwd.lock' \
47 -not -path '/run/mount/utab' \
48 -not -path '/test.sh' \
49 -not -path '/test.output' \
50 -not -path '/etc/nsswitch.conf.bak' \
51 -not -path '/etc/iscsi/initiatorname.iscsi' \
52 -not -path '/boot/*0-rescue*' \
53 -not -patch '/usr/share/mime/*' \
54 -not -patch '/etc/crypto-policies/*' \
55 -not -path '/dev/null' \
56 -not -path "/boot/loader/entries/\$(cat /etc/machine-id)-*" \
57 -not -path "/boot/\$(cat /etc/machine-id)/*" \
58 -exec rpm -qf '{}' ';' | \
59 grep -F 'not owned' &> /test.output
60 exit
61 EOF
63 chmod 0755 "$rootdir/test.sh"
65 chroot "$rootdir" /test.sh
67 if [[ -s "$rootdir"/test.output ]]; then
68 failed=1
69 echo TEST Failed >&2
70 cat "$rootdir"/test.output >&2
73 umount "$rootdir/proc"
74 umount "$rootdir/sys"
75 umount "$rootdir/dev"
77 [[ $failed ]] && return 1
78 return 0
82 test_setup() {
83 return 0
86 test_cleanup() {
87 return 0
90 . $testdir/test-functions