mirror of
https://github.com/libguestfs/libguestfs.git
synced 2026-03-21 22:53:37 +00:00
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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user