Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

xfstest adapter produces incorrect output files because of erroring commands #141

Open
jtassarotti opened this issue May 10, 2021 · 0 comments

Comments

@jtassarotti
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant