]> www.infradead.org Git - users/hch/xfstests-dev.git/commitdiff
common/rc: check error case and fail the test
authorNaohiro Aota <naohiro.aota@wdc.com>
Wed, 27 Sep 2023 06:11:00 +0000 (15:11 +0900)
committerZorro Lang <zlang@kernel.org>
Thu, 5 Oct 2023 14:44:29 +0000 (22:44 +0800)
If we place /var/lib/xfstests on a read-only filesystem, commands in
_link_out_file_named() fail to modify the files. However, they won't fail
the test. As a result, the test case fails mysteriously with only "no
qualified output" printed.

Fix it by checking the error case.

Signed-off-by: Naohiro Aota <naohiro.aota@wdc.com>
Reviewed-by: "Darrick J. Wong" <djwong@kernel.org>
Signed-off-by: Zorro Lang <zlang@kernel.org>
common/rc

index 84fad4b8560c1e03ca41bf3d047aec71251029d5..259a1ffb09b9dd6e18992ad8fade678e0c5e9dec 100644 (file)
--- a/common/rc
+++ b/common/rc
@@ -3431,8 +3431,8 @@ _link_out_file_named()
                }
                print $result
                ' <$seqfull.cfg)
-       rm -f $1
-       ln -fs $(basename $1).$suffix $1
+       rm -f $1 || _fail "_link_out_file_named: failed to remove existing output file"
+       ln -fs $(basename $1).$suffix $1 || _fail "$(basename $1).$suffix: could not setup output file"
 }
 
 _link_out_file()