|
|
712866 |
From 968eb46fce41fc1819afd1f0683a61704e35fe54 Mon Sep 17 00:00:00 2001
|
|
|
712866 |
From: Harald Hoyer <harald@redhat.com>
|
|
|
712866 |
Date: Fri, 11 Nov 2016 14:08:14 +0100
|
|
|
712866 |
Subject: [PATCH] TEST-99-RPM: speedup test
|
|
|
712866 |
|
|
|
712866 |
---
|
|
|
712866 |
Makefile | 2 +-
|
|
|
712866 |
test/TEST-99-RPM/test.sh | 38 +++++++++++++++++++++++---------------
|
|
|
712866 |
2 files changed, 24 insertions(+), 16 deletions(-)
|
|
|
712866 |
|
|
|
712866 |
diff --git a/Makefile b/Makefile
|
|
|
5c6c2a |
index 18f5a88c..97987377 100644
|
|
|
712866 |
--- a/Makefile
|
|
|
712866 |
+++ b/Makefile
|
|
|
712866 |
@@ -189,7 +189,7 @@ rpm: dracut-$(VERSION).tar.bz2 syncheck
|
|
|
712866 |
(cd "$$rpmbuild"; rpmbuild --define "_topdir $$PWD" --define "_sourcedir $$PWD" \
|
|
|
712866 |
--define "_specdir $$PWD" --define "_srcrpmdir $$PWD" \
|
|
|
712866 |
--define "_rpmdir $$PWD" -ba dracut.spec; ) && \
|
|
|
712866 |
- ( mv "$$rpmbuild"/$$(arch)/*.rpm .; mv "$$rpmbuild"/*.src.rpm .;rm -fr -- "$$rpmbuild"; ls *.rpm )
|
|
|
712866 |
+ ( mv "$$rpmbuild"/$$(arch)/*.rpm $(DESTDIR).; mv "$$rpmbuild"/*.src.rpm $(DESTDIR).;rm -fr -- "$$rpmbuild"; ls $(DESTDIR)*.rpm )
|
|
|
712866 |
|
|
|
712866 |
syncheck:
|
|
|
712866 |
@ret=0;for i in dracut-initramfs-restore.sh modules.d/*/*.sh; do \
|
|
|
712866 |
diff --git a/test/TEST-99-RPM/test.sh b/test/TEST-99-RPM/test.sh
|
|
|
5c6c2a |
index fc682734..17c0bf8d 100755
|
|
|
712866 |
--- a/test/TEST-99-RPM/test.sh
|
|
|
712866 |
+++ b/test/TEST-99-RPM/test.sh
|
|
|
712866 |
@@ -1,11 +1,14 @@
|
|
|
712866 |
#!/bin/bash
|
|
|
712866 |
-# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
|
|
|
712866 |
-# ex: ts=8 sw=4 sts=4 et filetype=sh
|
|
|
712866 |
+
|
|
|
712866 |
TEST_DESCRIPTION="rpm integrity after dracut and kernel install"
|
|
|
712866 |
-$TESTDIR
|
|
|
712866 |
+
|
|
|
712866 |
+test_check() {
|
|
|
712866 |
+ command -v rpm &>/dev/null && ( command -v yum || command -v dnf ) &>/dev/null
|
|
|
712866 |
+}
|
|
|
712866 |
|
|
|
712866 |
test_run() {
|
|
|
712866 |
set -x
|
|
|
712866 |
+ set -e
|
|
|
712866 |
export rootdir=$TESTDIR/root
|
|
|
712866 |
|
|
|
712866 |
mkdir -p $rootdir
|
|
|
712866 |
@@ -14,33 +17,34 @@ test_run() {
|
|
|
712866 |
mkdir -p "$rootdir/sys"
|
|
|
712866 |
mkdir -p "$rootdir/dev"
|
|
|
712866 |
|
|
|
712866 |
-trap 'ret=$?; [[ -d $rootdir ]] && { umount "$rootdir/proc"; umount "$rootdir/sys"; umount "$rootdir/dev"; rm -rf -- "$rootdir"; }; exit $ret;' EXIT
|
|
|
712866 |
-trap '[[ -d $rootdir ]] && { umount "$rootdir/proc"; umount "$rootdir/sys"; umount "$rootdir/dev"; rm -rf -- "$rootdir"; }; exit 1;' SIGINT
|
|
|
712866 |
+trap 'ret=$?; [[ -d $rootdir ]] && { umount "$rootdir/proc"; umount "$rootdir/sys"; umount "$rootdir/dev"; rm -rf -- "$rootdir"; } || :; exit $ret;' EXIT
|
|
|
712866 |
+trap '[[ -d $rootdir ]] && { umount "$rootdir/proc"; umount "$rootdir/sys"; umount "$rootdir/dev"; rm -rf -- "$rootdir"; } || :; exit 1;' SIGINT
|
|
|
712866 |
|
|
|
712866 |
mount --bind /proc "$rootdir/proc"
|
|
|
712866 |
mount --bind /sys "$rootdir/sys"
|
|
|
712866 |
mount -t devtmpfs devtmpfs "$rootdir/dev"
|
|
|
712866 |
|
|
|
712866 |
- yum --nogpgcheck --releasever=/ --installroot "$rootdir"/ install -y \
|
|
|
712866 |
- yum \
|
|
|
712866 |
+ dnf_or_yum=yum
|
|
|
712866 |
+ command -v dnf >/dev/null && dnf_or_yum="dnf --allowerasing"
|
|
|
712866 |
+ $dnf_or_yum --releasever=7 --nogpgcheck --installroot "$rootdir"/ install -y \
|
|
|
712866 |
+ $dnf_or_yum \
|
|
|
712866 |
passwd \
|
|
|
712866 |
rootfiles \
|
|
|
712866 |
systemd \
|
|
|
712866 |
kernel \
|
|
|
712866 |
- fedora-release \
|
|
|
712866 |
device-mapper-multipath \
|
|
|
712866 |
lvm2 \
|
|
|
712866 |
mdadm \
|
|
|
712866 |
bash \
|
|
|
712866 |
iscsi-initiator-utils \
|
|
|
712866 |
- $basedir/dracut-[0-9]*.$(arch).rpm \
|
|
|
712866 |
- $basedir/dracut-network-[0-9]*.$(arch).rpm
|
|
|
712866 |
+ "$TESTDIR"/dracut-[0-9]*.$(arch).rpm \
|
|
|
712866 |
+ "$TESTDIR"/dracut-network-[0-9]*.$(arch).rpm
|
|
|
712866 |
|
|
|
712866 |
cat >"$rootdir"/test.sh <
|
|
|
712866 |
#!/bin/bash
|
|
|
712866 |
set -x
|
|
|
712866 |
export LC_MESSAGES=C
|
|
|
712866 |
-rpm -Va &> /test.output
|
|
|
712866 |
+rpm -Va |& grep -F -v '85-display-manager.preset' &> /test.output
|
|
|
712866 |
find / -xdev -type f -not -path '/var/*' \
|
|
|
712866 |
-not -path '/usr/lib/modules/*/modules.*' \
|
|
|
712866 |
-not -path '/etc/*-' \
|
|
|
712866 |
@@ -51,18 +55,20 @@ find / -xdev -type f -not -path '/var/*' \
|
|
|
712866 |
-not -path '/etc/nsswitch.conf.bak' \
|
|
|
712866 |
-not -path '/etc/iscsi/initiatorname.iscsi' \
|
|
|
712866 |
-not -path '/boot/*0-rescue*' \
|
|
|
712866 |
+ -not -path '/usr/share/mime/*' \
|
|
|
712866 |
+ -not -path '/etc/crypto-policies/*' \
|
|
|
712866 |
-not -path '/dev/null' \
|
|
|
712866 |
-not -path "/boot/loader/entries/\$(cat /etc/machine-id)-*" \
|
|
|
712866 |
-not -path "/boot/\$(cat /etc/machine-id)/*" \
|
|
|
712866 |
-not -path '/etc/openldap/certs/*' \
|
|
|
712866 |
- -exec rpm -qf '{}' ';' | \
|
|
|
712866 |
- grep -F 'not owned' &> /test.output
|
|
|
712866 |
-exit
|
|
|
712866 |
+ -print0 | xargs -0 rpm -qf | \
|
|
|
712866 |
+ grep -F 'not owned' &>> /test.output
|
|
|
712866 |
+exit 0
|
|
|
712866 |
EOF
|
|
|
712866 |
|
|
|
712866 |
chmod 0755 "$rootdir/test.sh"
|
|
|
712866 |
|
|
|
712866 |
- chroot "$rootdir" /test.sh
|
|
|
712866 |
+ chroot "$rootdir" /test.sh || :
|
|
|
712866 |
|
|
|
712866 |
if [[ -s "$rootdir"/test.output ]]; then
|
|
|
712866 |
failed=1
|
|
|
712866 |
@@ -80,10 +86,12 @@ EOF
|
|
|
712866 |
}
|
|
|
712866 |
|
|
|
712866 |
test_setup() {
|
|
|
712866 |
+ make -C "$basedir" DESTDIR="$TESTDIR/" rpm
|
|
|
712866 |
return 0
|
|
|
712866 |
}
|
|
|
712866 |
|
|
|
712866 |
test_cleanup() {
|
|
|
712866 |
+ rm -fr -- "$TESTDIR"/*.rpm
|
|
|
712866 |
return 0
|
|
|
712866 |
}
|
|
|
712866 |
|