Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
tests: Change more conflicting temporary output file names.
Various tests cannot be run in parallel just because they happen to
use conflicting names for temporary output files (eg. "test.out").

Change these tests to use unique temporary names, so the tests could
be run in parallel.
  • Loading branch information
rwmjones committed Nov 5, 2015
1 parent 8a72616 commit b20d36a
Show file tree
Hide file tree
Showing 13 changed files with 45 additions and 47 deletions.
2 changes: 0 additions & 2 deletions .gitignore
Expand Up @@ -462,8 +462,6 @@ Makefile.in
/sysprep/sysprep-operations.pod
/sysprep/virt-sysprep
/sysprep/virt-sysprep.1
/test.err
/test.out
/tests/c-api/test-add-drive-opts
/tests/c-api/test-add-libvirt-dom
/tests/c-api/test-backend-settings
Expand Down
8 changes: 4 additions & 4 deletions builder/test-virt-builder.sh
Expand Up @@ -74,7 +74,7 @@ $VG virt-builder phony-fedora \
--firstboot-install "minicom,inkscape"

# Check that some modifications were made.
$VG guestfish --ro -i -a $output > test.out <<EOF
$VG guestfish --ro -i -a $output > test-virt-builder.out <<EOF
# Uploaded files
is-file /etc/foo/bar/baz/Makefile
cat /etc/foo/bar/baz/foo
Expand All @@ -99,7 +99,7 @@ is-file /etc/shadow
cat /etc/shadow | sed -r '/^root:/!d;s,^(root:\\\$6\\\$).*,\\1,g'
EOF

if [ "$(cat test.out)" != "true
if [ "$(cat test-virt-builder.out)" != "true
Hello World
true
true
Expand All @@ -115,9 +115,9 @@ true
true
root:\$6\$" ]; then
echo "$0: unexpected output:"
cat test.out
cat test-virt-builder.out
exit 1
fi

rm $output
rm test.out
rm test-virt-builder.out
10 changes: 5 additions & 5 deletions fish/test-events.sh
Expand Up @@ -20,9 +20,9 @@

set -e

rm -f test.out
rm -f test-events.out

$VG guestfish -a /dev/null <<'EOF' | grep -v get_verbose | grep -v get_trace | grep -v 'library .*0x' | grep -v 'library command' | grep -v 'get_path' > test.out
$VG guestfish -a /dev/null <<'EOF' | grep -v get_verbose | grep -v get_trace | grep -v 'library .*0x' | grep -v 'library command' | grep -v 'get_path' > test-events.out
trace true
event ev1 * "echo $EVENT $@"
Expand All @@ -49,7 +49,7 @@ list-events
EOF

if [ "$(cat test.out)" != '"ev1" (0): *: echo $EVENT $@
if [ "$(cat test-events.out)" != '"ev1" (0): *: echo $EVENT $@
"ev1" (1): *: echo $EVENT $@
"ev2" (2): *: echo $EVENT $@
"ev2" (2): *: echo $EVENT $@
Expand All @@ -75,8 +75,8 @@ close
"ev2" (1): close,subprocess_quit: echo $EVENT $@
close' ]; then
echo "$0: unexpected output from guestfish events"
cat test.out
cat test-events.out
exit 1
fi

rm test.out
rm test-events.out
10 changes: 5 additions & 5 deletions fish/test-file-attrs.sh
Expand Up @@ -21,9 +21,9 @@
set -e
export LANG=C

rm -f test.out
rm -f test-file-attrs.out

$VG guestfish > test.out <<EOF
$VG guestfish > test-file-attrs.out <<EOF
scratch 50MB
run
part-disk /dev/sda mbr
Expand Down Expand Up @@ -72,7 +72,7 @@ copy-attributes /foo /new mode:true
stat /new | grep mode:
EOF

if [ "$(cat test.out)" != "mode: 33226
if [ "$(cat test-file-attrs.out)" != "mode: 33226
mode: 33226
-----
uid: 0
Expand Down Expand Up @@ -150,8 +150,8 @@ gid: 11
}
mode: 33226" ]; then
echo "$0: unexpected output:"
cat test.out
cat test-file-attrs.out
exit 1
fi

rm test.out
rm test-file-attrs.out
10 changes: 5 additions & 5 deletions fish/test-find0.sh
Expand Up @@ -20,20 +20,20 @@

set -e

rm -f test.out
rm -f test-find0.out

$VG guestfish <<'EOF'
add-ro ../test-data/test.iso
run
mount-ro /dev/sda /
find0 / test.out
find0 / test-find0.out
EOF

n=$(tr '\0' '\n' < test.out | grep '^known-[1-5]' | wc -l)
n=$(tr '\0' '\n' < test-find0.out | grep '^known-[1-5]' | wc -l)
[ "$n" = 5 ] || {
echo find0: Invalid list of files
tr '\0' '\n' < test.out
tr '\0' '\n' < test-find0.out
exit 1
}

rm -f test.out
rm -f test-find0.out
8 changes: 4 additions & 4 deletions fish/test-read-file.sh
Expand Up @@ -20,15 +20,15 @@

set -e

rm -f test.out
rm -f test-read-file.out

$VG guestfish <<'EOF' > test.out
$VG guestfish <<'EOF' > test-read-file.out
add-ro ../test-data/test.iso
run
mount-ro /dev/sda /
read-file /helloworld.tar
EOF

cmp $srcdir/../test-data/files/helloworld.tar test.out
cmp $srcdir/../test-data/files/helloworld.tar test-read-file.out

rm -f test.out
rm -f test-read-file.out
8 changes: 4 additions & 4 deletions tests/btrfs/test-btrfs-replace.sh
Expand Up @@ -32,12 +32,12 @@ if ! guestfish -a /dev/null run : available btrfs; then
exit 77
fi

rm -f test-btrfs-devices-{1,2}.img replace.output
rm -f test-btrfs-replace-{1,2}.img replace.output

guestfish <<EOF > replace.output
# Add 2 empty disks
sparse test-btrfs-devices-1.img 1G
sparse test-btrfs-devices-2.img 1G
sparse test-btrfs-replace-1.img 1G
sparse test-btrfs-replace-2.img 1G
run
mkfs-btrfs /dev/sda
Expand All @@ -63,4 +63,4 @@ filesanddirs-10M.tar.xz" ]; then
exit 1
fi

rm test-btrfs-devices-{1,2}.img replace.output
rm test-btrfs-replace-{1,2}.img replace.output
10 changes: 5 additions & 5 deletions tests/regressions/rhbz563450.sh
Expand Up @@ -27,9 +27,9 @@ if [ ! -s ../../test-data/phony-guests/fedora.img -o ! -s ../../test-data/test.i
exit 77
fi

rm -f test.out
rm -f rhbz563450.out

guestfish --ro > test.out <<EOF
guestfish --ro > rhbz563450.out <<EOF
add-drive-ro ../../test-data/phony-guests/fedora.img
add-cdrom ../../test-data/test.iso
add-drive-ro ../../test-data/phony-guests/debian.img
Expand All @@ -43,7 +43,7 @@ list-partitions | sed -r 's,^/dev/[abce-ln-z]+d,/dev/sd,'
ping-daemon
EOF

if [ "$(cat test.out)" != "/dev/sda
if [ "$(cat rhbz563450.out)" != "/dev/sda
/dev/sdb
/dev/sdc
----
Expand All @@ -52,8 +52,8 @@ if [ "$(cat test.out)" != "/dev/sda
/dev/sdc1
/dev/sdc2" ]; then
echo "$0: unexpected output:"
cat test.out
cat rhbz563450.out
exit 1
fi

rm -f test.out
rm -f rhbz563450.out
10 changes: 5 additions & 5 deletions tests/regressions/rhbz563450b.sh
Expand Up @@ -27,9 +27,9 @@ if [ ! -s ../../test-data/test.iso ]; then
exit 77
fi

rm -f test.out
rm -f rhbz563450b.out

guestfish --ro > test.out <<EOF
guestfish --ro > rhbz563450b.out <<EOF
add-cdrom ../../test-data/test.iso
run
Expand All @@ -39,10 +39,10 @@ list-devices | sed -r 's,^/dev/[abce-ln-z]+d,/dev/sd,'
ping-daemon
EOF

if [ "$(cat test.out)" != "/dev/sda" ]; then
if [ "$(cat rhbz563450b.out)" != "/dev/sda" ]; then
echo "$0: unexpected output:"
cat test.out
cat rhbz563450b.out
exit 1
fi

rm -f test.out
rm -f rhbz563450b.out
10 changes: 5 additions & 5 deletions tests/regressions/rhbz789960.sh
Expand Up @@ -22,9 +22,9 @@
set -e
export LANG=C

rm -f test.out
rm -f rhbz789960.out

guestfish -a ../../test-data/phony-guests/fedora.img --ro > test.out <<EOF
guestfish -a ../../test-data/phony-guests/fedora.img --ro > rhbz789960.out <<EOF
run
# Not a device at all, should fail.
Expand Down Expand Up @@ -59,10 +59,10 @@ echo done
EOF

if [ "$(cat test.out)" != "done" ]; then
if [ "$(cat rhbz789960.out)" != "done" ]; then
echo "$0: unexpected output:"
cat test.out
cat rhbz789960.out
exit 1
fi

rm -f test.out
rm -f rhbz789960.out
2 changes: 1 addition & 1 deletion v2v/test-v2v-oa-option.sh
Expand Up @@ -43,7 +43,7 @@ fi

export VIRT_TOOLS_DATA_DIR="$PWD/fake-virt-tools"

d=test-v2v-windows-conversion.d
d=test-v2v-oa-option.d
rm -rf $d
mkdir $d

Expand Down
2 changes: 1 addition & 1 deletion v2v/test-v2v-of-option.sh
Expand Up @@ -43,7 +43,7 @@ fi

export VIRT_TOOLS_DATA_DIR="$PWD/fake-virt-tools"

d=test-v2v-windows-conversion.d
d=test-v2v-of-option.d
rm -rf $d
mkdir $d

Expand Down
2 changes: 1 addition & 1 deletion v2v/test-v2v-on-option.sh
Expand Up @@ -43,7 +43,7 @@ fi

export VIRT_TOOLS_DATA_DIR="$PWD/fake-virt-tools"

d=test-v2v-windows-conversion.d
d=test-v2v-on-option.d
rm -rf $d
mkdir $d

Expand Down

0 comments on commit b20d36a

Please sign in to comment.