xfstest adapter produces incorrect output files because of erroring commands
Given a j-lang version 1 test file, the Ace xfstest adapter generates two files: a numbered test script (e.g. 362) and a verified output for that test (362.out). xfstest determines a test has failed if its output does not match this verified output.
Ace's xfstest adapter always emits verified output files that say tests should emit no output. However, the generated tests do sometimes produce erroring output under correct execution. This leads to spurious failures reported by xfstest, even when there was no crash consistency bug.
Here are 3 sources of such issues I have found, all running xfstests on Ubuntu 16.04:
1. fsync is run on non-existent files.
For example, a j-lang file whose run section begins:
# run
open foo O_RDWR|O_CREAT 0777
mkdir A 0777
mkdir AC 0777
fsync ACfoo
will convert to a test with the following snippet:
# Test cases
_mount_flakey
touch $SCRATCH_MNT/foo
chmod 0777 $SCRATCH_MNT/foo
mkdir $SCRATCH_MNT/A -p -m 0777
mkdir $SCRATCH_MNT/A/C -p -m 0777
$XFS_IO_PROG -c "fsync" $SCRATCH_MNT/A/C/foo
Here, fsync is run on A/C/foo, but A/C/foo is never created before hand, leading to the output
A/C/foo: No such file or directory.
2. renaming a directory into a subdirectory of itself
Tests with rename will often lead to j-lang snippets such as:
mkdir A 0777
opendir A 0777
close A
rename A AC
which translates into
mkdir $SCRATCH_MNT/A -p -m 0777
mkdir $SCRATCH_MNT/A -p -m 0777
rename $SCRATCH_MNT/A $SCRATCH_MNT/A/C
rename is implemented in terms of mv, which will (correctly) produce the following error:
mv: cannot move 'A' to a subdirectory of itself, A/C'
3. Clean-up after a test produces an error if test directory is empty
To clean up after a test, the generated xfstest scripts run:
clean_dir()
{
rm -rf $(find $SCRATCH_MNT/* | grep -v "lost+found")
sync
_unmount_flakey
}
But if $SCRATCH_MNT is empty, the call to find here will produce an error:
find: '/mnt/scratch/*': No such file or directory
Probably the correct thing to do instead would be to replace find $SCRATCH_MNT/* with find $SCRATCH_MNT/ -mindepth 1