tests: Use unique or temporary names for temporary files.

Review every test(!) to ensure that it:

 - Doesn't use a generic name (eg. "test1.img", "test.out") for any
   temporary file it needs.

 - Does instead use a unique name or a temporary name (eg. a name like
   "name-of-the-test.img", or a scratch disk).

 - Does not use 'rm -f' to clean up its temporary files (so we can
   detect errors if the wrong temporary file is created or removed).

This allows tests to be run in parallel, so they don't stomp on each
other's temporary files.
This commit is contained in:
Richard W.M. Jones
2013-07-19 19:36:49 +01:00
parent ccd069f859
commit 4180abcc1f
64 changed files with 421 additions and 432 deletions

View File

@@ -28,13 +28,13 @@ test -d /dev/fd || {
set -e
rm -f test1.img
rm -f test-edit.img
# The command will be 'echo ... >>/tmp/tmpfile'
export EDITOR="echo second line of text >>"
output=$(
./guestfish -N fs -m /dev/sda1 <<EOF
./guestfish -N test-edit.img=fs -m /dev/sda1 <<EOF
write /file.txt "this is a test\n"
chmod 0600 /file.txt
chown 10 11 /file.txt
@@ -57,4 +57,4 @@ gid: 11" ]; then
exit 1
fi
rm -f test1.img
rm test-edit.img