tests: Fix tests which could use conflicting filenames

Commit 6d32773e81 ("tests: Run the tests in parallel.") makes all of
the tests run in the same directory.  Previously tests expected to be
run in their own subdirectories and so were freer about using generic
filenames.  When run in parallel these filenames now clash.  Fix
another case.

Fixes: commit 6d32773e81
This commit is contained in:
Richard W.M. Jones
2022-03-08 11:56:21 +00:00
parent 1b365bc605
commit 1fb3aff908
2 changed files with 27 additions and 23 deletions

View File

@@ -25,41 +25,44 @@ skip_unless_feature_available btrfs
canonical="sed s,/dev/vd,/dev/sd,g" canonical="sed s,/dev/vd,/dev/sd,g"
rm -f root.tmp test.qcow2 test.output root=mountable-inspect.tmp
output=mountable-inspect.output
overlay=mountable-inspect.qcow2
rm -f $root $overlay $output
# Start with the regular (good) fedora image, modify /etc/fstab # Start with the regular (good) fedora image, modify /etc/fstab
# and then inspect it. # and then inspect it.
guestfish -- \ guestfish -- \
disk-create test.qcow2 qcow2 -1 \ disk-create $overlay qcow2 -1 \
backingfile:../test-data/phony-guests/fedora-btrfs.img backingformat:raw backingfile:../test-data/phony-guests/fedora-btrfs.img backingformat:raw
# Test that basic inspection works and the expected filesystems are # Test that basic inspection works and the expected filesystems are
# found # found
guestfish --format=qcow2 -a test.qcow2 -i <<'EOF' | sort | $canonical > test.output guestfish --format=qcow2 -a $overlay -i <<EOF | sort | $canonical > $output
inspect-get-roots | head -1 > root.tmp inspect-get-roots | head -1 > $root
<! echo inspect-get-mountpoints "`cat root.tmp`" <! echo inspect-get-mountpoints \"\`cat $root\`\"
EOF EOF
if [ "$(cat test.output)" != "/: btrfsvol:/dev/sda2/root if [ "$(cat $output)" != "/: btrfsvol:/dev/sda2/root
/boot: /dev/sda1 /boot: /dev/sda1
/home: btrfsvol:/dev/sda2/home" ]; then /home: btrfsvol:/dev/sda2/home" ]; then
echo "$0: error #1: unexpected output from inspect-get-mountpoints" echo "$0: error #1: unexpected output from inspect-get-mountpoints"
cat test.output cat $output
exit 1 exit 1
fi fi
# Additional sanity check: did we get the release name right? # Additional sanity check: did we get the release name right?
guestfish --format=qcow2 -a test.qcow2 -i <<'EOF' > test.output guestfish --format=qcow2 -a $overlay -i <<EOF > $output
inspect-get-roots | head -1 > root.tmp inspect-get-roots | head -1 > $root
<! echo inspect-get-product-name "`cat root.tmp`" <! echo inspect-get-product-name \"\`cat $root\`\"
EOF EOF
if [ "$(cat test.output)" != "Fedora release 14 (Phony)" ]; then if [ "$(cat $output)" != "Fedora release 14 (Phony)" ]; then
echo "$0: error #2: unexpected output from inspect-get-product-name" echo "$0: error #2: unexpected output from inspect-get-product-name"
cat test.output cat $output
exit 1 exit 1
fi fi
rm root.tmp rm $root
rm test.qcow2 rm $overlay
rm test.output rm $output

View File

@@ -24,9 +24,10 @@ set -e
$TEST_FUNCTIONS $TEST_FUNCTIONS
skip_if_skipped skip_if_skipped
rm -f test.output output=rhbz602997.output
rm -f $output
guestfish > test.output <<EOF guestfish > $output <<EOF
scratch 100M scratch 100M
run run
part-init /dev/sda mbr part-init /dev/sda mbr
@@ -40,15 +41,15 @@ part-get-bootable /dev/sda 1
part-get-bootable /dev/sda 2 part-get-bootable /dev/sda 2
EOF EOF
if [ "$(cat test.output)" != "true if [ "$(cat $output)" != "true
false" ]; then false" ]; then
echo "rhbz602997.sh: Unexpected output from test:" echo "rhbz602997.sh: Unexpected output from test:"
cat test.output cat $output
echo "[end of output]" echo "[end of output]"
exit 1 exit 1
fi fi
guestfish > test.output <<EOF guestfish > $output <<EOF
scratch 100M scratch 100M
run run
part-init /dev/sda mbr part-init /dev/sda mbr
@@ -61,11 +62,11 @@ part-get-bootable /dev/sda 3
ping-daemon ping-daemon
EOF EOF
if [ "$(cat test.output)" != "false" ]; then if [ "$(cat $output)" != "false" ]; then
echo "rhbz602997.sh: Unexpected output from test:" echo "rhbz602997.sh: Unexpected output from test:"
cat test.output cat $output
echo "[end of output]" echo "[end of output]"
exit 1 exit 1
fi fi
rm test.output rm $output