Page MenuHomeFreeBSD

stress2: Fix script bugs in gnop6.sh, gnop7.sh and fdatasync*.sh
AcceptedPublic

Authored by sobomax on Tue, Sep 29, 5:19 PM.
Tags
None
Referenced Files
F174158041: D60136.id188075.diff
Thu, Oct 1, 12:26 AM
F174153972: D60136.diff
Wed, Sep 30, 11:41 PM
Unknown Object (File)
Wed, Sep 30, 2:07 AM
Unknown Object (File)
Wed, Sep 30, 1:58 AM

Details

Reviewers
pho
Summary

Summary

Three shell bugs that make these tests report the wrong result or skip a check. Git branch: https://github.com/sobomax/freebsd/tree/stress2-script-fixes

  • gnop6.sh recorded the checkfs result with checkfs ... || s=1 && s=0. The shell parses that as (checkfs || s=1) && s=0, so s always ended up 0 and the test passed even when the file system check failed. The line is now checkfs ...; s=$?.
  • gnop7.sh only set s when umount or fsck_ffs failed, and ended with exit $s. On a clean run s was unset, so the script exited with the status of the preceding [ $notloaded ] && gnop unload. That is 1 whenever geom_nop was already loaded, for instance by an earlier gnop test, so a passing run was reported as a failure. s is now initialized to 0.
  • fdatasync.sh and fdatasync2.sh ran df -i $RUNDIR before creating $RUNDIR. With a RUNDIR that did not exist yet, df failed, the test printed [: -lt: unexpected operator, and the free-inode check was skipped. The directory is now created before the check.

Files: tools/test/stress2/misc/gnop6.sh, gnop7.sh, fdatasync.sh, fdatasync2.sh (4 insertions, 5 deletions).

Test Plan

These were found while running stress2 against a UFS fix series on releng/14.3 (amd64), where they caused wrong results.

  • gnop7.sh: before the fix, runs with newfs_flags=-U and with -j exited 1, although fsck_ffs reported the file system clean, because geom_nop had been loaded by gnop10.sh earlier in the same session. After the fix, runs with -U and -j exited 0 in the same situation.
  • gnop6.sh: the new exit logic was checked on its own, with a stand-in checkfs returning 3: the script now exits 3, where the old line made it exit 0. A full run of gnop6.sh with the fix (5-minute load) exited 0, now taken from checkfs itself.
  • fdatasync.sh and fdatasync2.sh: before the fix, the df: ...: No such file or directory and [: -lt: unexpected operator messages appeared on every run with RUNDIR set to a directory not created yet. The fix moves the existing mkdir -p $dir && chmod 777 $dir in front of the check. With the fix, fdatasync.sh was run on a new md(4)-backed UFS with RUNDIR set to a subdirectory that did not exist. The script created it, printed neither message, and exited 0, and fsck_ffs -fn found the file system clean afterwards. fdatasync2.sh gets the identical one-line change and was not rerun.

No other script in tools/test/stress2/misc has either pattern. I searched all of them for [ $notloaded ] && gnop unload followed by exit $s with s possibly unset, and for df -i $dir before mkdir -p $dir. sendfile18.sh has the first line but ends with exit 0, so it is not affected.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped

Event Timeline

sobomax retitled this revision from Title: stress2: Fix script bugs in gnop6.sh, gnop7.sh and fdatasync*.sh to stress2: Fix script bugs in gnop6.sh, gnop7.sh and fdatasync*.sh.Tue, Sep 29, 6:23 PM
This revision is now accepted and ready to land.Thu, Oct 1, 7:32 AM