xfstests: random fixes
v3 cover xfstests: random fixes
Hi folks,
This series contain a few random fixes I apply for xfstests in my immutable test machines. These make it easier to work with read-only xfstests package.
Changes from v2:
- Remove .out.good before running the test
- Fix "diff ..." message for tests with .out.good
Changes from v1:
- Add RvB
- Add comment in generic/452
Andrey Albershteyn (4):
xfs/071: use _link_out_link instead of opencoding file picking
common: link .out file to the output directory generic/452: make coping work with multi-call binary
xfstests: fix permissions on system file installed by libtoolize
Makefile | 3 +++
check | 14 +++++++++-----
common/rc | 4 ++--
tests/generic/452 | 7 +++++--
tests/generic/452.out | 4 ++--
tests/xfs/071 | 7 +++----
tests/xfs/071.cfg | 1 +
tests/xfs/{071.out.64 => 071.out.default} | 0
8 files changed, 25 insertions(+), 15 deletions(-)
create mode 100644 tests/xfs/071.cfg
rename tests/xfs/{071.out.64 => 071.out.default} (100%)Signature · 1 line
2.54.0
PATCH v3 1/4 xfs/071: use _link_out_link instead of opencoding file picking
There's function which handles picking the right output file based on the .cfg.
---
tests/xfs/071 | 7 +++----
tests/xfs/071.cfg | 1 +
tests/xfs/{071.out.64 => 071.out.default} | 0
3 files changed, 4 insertions(+), 4 deletions(-)
create mode 100644 tests/xfs/071.cfg
rename tests/xfs/{071.out.64 => 071.out.default} (100%)tests/xfs/071 +3 -4
@@ -5,7 +5,6 @@ # FS QA Test No. 071 # # Exercise IO at large file offsets. -seqfull=$0 . ./common/preamble _begin_fstest rw auto
@@ -22,11 +21,11 @@ _cleanup() bitsperlong=`$here/src/feature -w` # link correct .out file -rm -f $seqfull.out +seqfull=$0 if [ "$bitsperlong" -eq 32 ]; then - ln -s $seq.out.32 $seqfull.out + _link_out_file "32" else - ln -s $seq.out.64 $seqfull.out + _link_out_file "" fi _filter_io()
tests/xfs/071.cfg new file +1 -0
@@ -0,0 +1 @@ +32: 32
tests/xfs/071.out.default renamed from tests/xfs/071.out.64 +0 -0
Signature · 1 line
2.54.0
Re: [PATCH v3 1/4] xfs/071: use _link_out_link instead of opencoding file picking
Quoted 5 lines · Andrey Albershteyn
There's function which handles picking the right output file based on the .cfg.
Reviewed-by Christoph Hellwig <[email protected]>Signed-off-by Andrey Albershteyn <[email protected]>
Looks ok,
--D
Quoted 50 lines
--- tests/xfs/071 | 7 +++---- tests/xfs/071.cfg | 1 + tests/xfs/{071.out.64 => 071.out.default} | 0 3 files changed, 4 insertions(+), 4 deletions(-) create mode 100644 tests/xfs/071.cfg rename tests/xfs/{071.out.64 => 071.out.default} (100%)tests/xfs/071 +3
-4@@ -5,7 +5,6 @@ # FS QA Test No. 071 # # Exercise IO at large file offsets. -seqfull=$0 . ./common/preamble _begin_fstest rw auto@@ -22,11 +21,11 @@ _cleanup() bitsperlong=`$here/src/feature -w` # link correct .out file -rm -f $seqfull.out +seqfull=$0 if [ "$bitsperlong" -eq 32 ]; then - ln -s $seq.out.32 $seqfull.out + _link_out_file "32" else - ln -s $seq.out.64 $seqfull.out + _link_out_file "" fi _filter_io()tests/xfs/071.cfg new file +1
-0@@ -0,0 +1 @@ +32: 32tests/xfs/071.out.default renamed from tests/xfs/071.out.64 +0
-0Signature · 1 line
2.54.0
PATCH v3 2/4 common: link .out file to the output directory
In reply to Andrey AlbershteynOn immutable systems with read-only system packages, 'ln' will fail to link .out files into system xfstests root directory. Fix this by linking golden output file to the results output directory as a .out.good.
--- check | 14 +++++++++----- common/rc | 4 ++-- 2 files changed, 11 insertions(+), 7 deletions(-)
check +9 -5
@@ -1050,7 +1050,7 @@ function run_section() mkdir -p $RESULT_DIR rm -f ${RESULT_DIR}/require_scratch* rm -f ${RESULT_DIR}/require_test* - rm -f $seqres.out.bad $seqres.hints + rm -f $seqres.out.bad $seqres.hints $seqres.out.good # check if we really should run it if _expunge_test $seqnum; then
@@ -1181,7 +1181,11 @@ function run_section() $timestamp && _timestamp stop=`_wallclock` - if [ ! -f $seq.out ]; then + local out=$here/$seq.out + if [ -f $seqres.out.good ]; then + out=$seqres.out.good + fi + if [ ! -f $out ]; then _dump_err "no qualified output" tc_status="fail" rm -f "$seqres.mountfail?"
@@ -1193,7 +1197,7 @@ function run_section() # from `foo' to 'foo'. Filter old versions to match the new # version. sed -i "s/\`/\'/g" $tmp.out - if diff $seq.out $tmp.out >/dev/null 2>&1 ; then + if diff $out $tmp.out >/dev/null 2>&1 ; then if [ "$tc_status" != "fail" ]; then echo "$seqnum `expr $stop - $start`" >>$tmp.time echo -n " `expr $stop - $start`s"
@@ -1202,13 +1206,13 @@ function run_section() else _dump_err "- output mismatch (see $seqres.out.bad)" mv $tmp.out $seqres.out.bad - $diff $seq.out $seqres.out.bad | { + $diff $out $seqres.out.bad | { if test "$DIFF_LENGTH" -le 0; then cat else head -n "$DIFF_LENGTH" echo "..." - echo "(Run '$diff $here/$seq.out $seqres.out.bad'" \ + echo "(Run '$diff $out $seqres.out.bad'" \ " to see the entire diff)" fi; } | sed -e 's/^\(.\)/ \1/' tc_status="fail"
common/rc +2 -2
@@ -3907,8 +3907,8 @@ _link_out_file_named() print $result ' <$seqfull.cfg) 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" - test -r $1 || _fail "$(basename $1).$suffix: output file for feature set \"$2\" not found" + ln -fs $(realpath $1).$suffix $seqres.out.good || _fail "$(basename $1).$suffix: could not setup output file" + test -r $seqres.out.good || _fail "$(basename $1).$suffix: output file for feature set \"$2\" not found" } _link_out_file()
Signature · 1 line
2.54.0
Re: [PATCH v3 2/4] common: link .out file to the output directory
Quoted 6 lines · Andrey Albershteyn
On immutable systems with read-only system packages, 'ln' will fail to link .out files into system xfstests root directory. Fix this by linking golden output file to the results output directory as a .out.good.
Reviewed-by Christoph Hellwig <[email protected]>Signed-off-by Andrey Albershteyn <[email protected]>
Looks good, thanks for fixing the diff instructions.
--D
Quoted 75 lines
--- check | 14 +++++++++----- common/rc | 4 ++-- 2 files changed, 11 insertions(+), 7 deletions(-)check +9
-5@@ -1050,7 +1050,7 @@ function run_section() mkdir -p $RESULT_DIR rm -f ${RESULT_DIR}/require_scratch* rm -f ${RESULT_DIR}/require_test* - rm -f $seqres.out.bad $seqres.hints + rm -f $seqres.out.bad $seqres.hints $seqres.out.good # check if we really should run it if _expunge_test $seqnum; then@@ -1181,7 +1181,11 @@ function run_section() $timestamp && _timestamp stop=`_wallclock` - if [ ! -f $seq.out ]; then + local out=$here/$seq.out + if [ -f $seqres.out.good ]; then + out=$seqres.out.good + fi + if [ ! -f $out ]; then _dump_err "no qualified output" tc_status="fail" rm -f "$seqres.mountfail?"@@ -1193,7 +1197,7 @@ function run_section() # from `foo' to 'foo'. Filter old versions to match the new # version. sed -i "s/\`/\'/g" $tmp.out - if diff $seq.out $tmp.out >/dev/null 2>&1 ; then + if diff $out $tmp.out >/dev/null 2>&1 ; then if [ "$tc_status" != "fail" ]; then echo "$seqnum `expr $stop - $start`" >>$tmp.time echo -n " `expr $stop - $start`s"@@ -1202,13 +1206,13 @@ function run_section() else _dump_err "- output mismatch (see $seqres.out.bad)" mv $tmp.out $seqres.out.bad - $diff $seq.out $seqres.out.bad | { + $diff $out $seqres.out.bad | { if test "$DIFF_LENGTH" -le 0; then cat else head -n "$DIFF_LENGTH" echo "..." - echo "(Run '$diff $here/$seq.out $seqres.out.bad'" \ + echo "(Run '$diff $out $seqres.out.bad'" \ " to see the entire diff)" fi; } | sed -e 's/^\(.\)/ \1/' tc_status="fail"common/rc +2
-2@@ -3907,8 +3907,8 @@ _link_out_file_named() print $result ' <$seqfull.cfg) 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" - test -r $1 || _fail "$(basename $1).$suffix: output file for feature set \"$2\" not found" + ln -fs $(realpath $1).$suffix $seqres.out.good || _fail "$(basename $1).$suffix: could not setup output file" + test -r $seqres.out.good || _fail "$(basename $1).$suffix: output file for feature set \"$2\" not found" } _link_out_file()Signature · 1 line
2.54.0
PATCH v3 3/4 generic/452: make coping work with multi-call binary
In reply to Andrey AlbershteynOn some system coreutils binaries are all symlink to the single coreutils binary. Just copying 'ls' will not work in this setup, especially, with the different binary name.
Add 'realpath' to find out the real binary is make it behave like an 'ls' by renaming it to 'ls'.
--- tests/generic/452 | 7 +++++-- tests/generic/452.out | 4 ++-- 2 files changed, 7 insertions(+), 4 deletions(-)
tests/generic/452 +5 -2
@@ -24,8 +24,11 @@ _exclude_scratch_mount_option "noexec" _scratch_mkfs > $seqres.full 2>&1 _scratch_mount >> $seqres.full 2>&1 -LS="$(type -P ls)" -SCRATCH_LS=$SCRATCH_MNT/ls_on_scratch +# Resolve full absolute path to the ls binary. This is necessary for multi-call +# binaries. In multi-call binary setup "ls" is just a symlink to a binary (e.g. +# coreutils) which behaves as "ls" based on the executable name (first arg $0). +LS="$(realpath $(type -P ls))" +SCRATCH_LS=$SCRATCH_MNT/ls cp $LS $SCRATCH_LS $SCRATCH_LS $SCRATCH_LS | _filter_scratch
tests/generic/452.out +2 -2
@@ -1,3 +1,3 @@ QA output created by 452 -SCRATCH_MNT/ls_on_scratch -SCRATCH_MNT/ls_on_scratch +SCRATCH_MNT/ls +SCRATCH_MNT/ls
Signature · 1 line
2.54.0
Re: [PATCH v3 3/4] generic/452: make coping work with multi-call binary
Quoted 8 lines · Andrey Albershteyn
On some system coreutils binaries are all symlink to the single coreutils binary. Just copying 'ls' will not work in this setup, especially, with the different binary name.
Add 'realpath' to find out the real binary is make it behave like an 'ls' by renaming it to 'ls'.
Signed-off-by Andrey Albershteyn <[email protected]>
Seems fine to me, though I wonder if we should change this to copy /bin/echo instead of ls so that the output is more stable...
--D
Quoted 37 lines
--- tests/generic/452 | 7 +++++-- tests/generic/452.out | 4 ++-- 2 files changed, 7 insertions(+), 4 deletions(-)tests/generic/452 +5
-2@@ -24,8 +24,11 @@ _exclude_scratch_mount_option "noexec" _scratch_mkfs > $seqres.full 2>&1 _scratch_mount >> $seqres.full 2>&1 -LS="$(type -P ls)" -SCRATCH_LS=$SCRATCH_MNT/ls_on_scratch +# Resolve full absolute path to the ls binary. This is necessary for multi-call +# binaries. In multi-call binary setup "ls" is just a symlink to a binary (e.g. +# coreutils) which behaves as "ls" based on the executable name (first arg $0). +LS="$(realpath $(type -P ls))" +SCRATCH_LS=$SCRATCH_MNT/ls cp $LS $SCRATCH_LS $SCRATCH_LS $SCRATCH_LS | _filter_scratchtests/generic/452.out +2
-2@@ -1,3 +1,3 @@ QA output created by 452 -SCRATCH_MNT/ls_on_scratch -SCRATCH_MNT/ls_on_scratch +SCRATCH_MNT/ls +SCRATCH_MNT/lsSignature · 1 line
2.54.0
PATCH v3 4/4 xfstests: fix permissions on system file installed by libtoolize
In reply to Andrey AlbershteynLibtoolize installs set of auxiliary files from its system package. Not all distributions have the same permissions set on these files. For example, read-only libtoolize system package will copy those files without write permissions. This causes build to fail as next line copies ./include/install-sh over ./install-sh which will fail.
Fix this by setting permission explicitly on files copied by libtoolize.
See similar commit in xfsprogs:6b32423addd2 ("xfsprogs: fix permissions on files installed by libtoolize")
--- Makefile | 3 +++ 1 file changed, 3 insertions(+)
Makefile +3 -0
@@ -76,6 +76,9 @@ endif configure: configure.ac libtoolize -cfi + chmod 755 config.guess config.sub install-sh + chmod 644 ltmain.sh m4/libtool.m4 m4/ltoptions.m4 m4/ltsugar.m4 \ + m4/ltversion.m4 m4/lt~obsolete.m4 cp include/install-sh . aclocal -I m4 autoheader
Signature · 1 line
2.54.0
Re: [PATCH v3 4/4] xfstests: fix permissions on system file installed by libtoolize
Quoted 6 lines · Andrey Albershteyn
Libtoolize installs set of auxiliary files from its system package. Not all distributions have the same permissions set on these files. For example, read-only libtoolize system package will copy those files without write permissions. This causes build to fail as next line copies
./include/install-shover ./install-sh which will fail.
Quoted 7 lines
Fix this by setting permission explicitly on files copied by libtoolize.
See similar commit in xfsprogs:
6b32423addd2("xfsprogs: fix permissions on files installed by libtoolize")Reviewed-by Christoph Hellwig <[email protected]>Signed-off-by Andrey Albershteyn <[email protected]>
Looks ok,
--D
Quoted 22 lines
--- Makefile | 3 +++ 1 file changed, 3 insertions(+)Makefile +3
-0@@ -76,6 +76,9 @@ endif configure: configure.ac libtoolize -cfi + chmod 755 config.guess config.sub install-sh + chmod 644 ltmain.sh m4/libtool.m4 m4/ltoptions.m4 m4/ltsugar.m4 \ + m4/ltversion.m4 m4/lt~obsolete.m4 cp include/install-sh . aclocal -I m4 autoheaderSignature · 1 line
2.54.0
Quoted 6 lines · Andrey Albershteyn
Hi folks,
This series contain a few random fixes I apply for xfstests in my immutable test machines. These make it easier to work with read-only xfstests package.
Quoted 6 lines
Changes from v2:
- Remove .out.good before running the test
- Fix "diff ..." message for tests with .out.good
Changes from v1:
- Add RvB
- Add comment in generic/452
Thanks, this patchset is good to me now. I'll merge it.
Quoted 22 lines
Andrey Albershteyn (4):
xfs/071: use_link_out_linkinstead of opencoding file picking
common: link .out file to the output directory generic/452: make coping work with multi-call binary
xfstests: fix permissions on system file installed by libtoolizeMakefile | 3 +++ check | 14 +++++++++----- common/rc | 4 ++-- tests/generic/452 | 7 +++++-- tests/generic/452.out | 4 ++-- tests/xfs/071 | 7 +++---- tests/xfs/071.cfg | 1 + tests/xfs/{071.out.64 => 071.out.default} | 0 8 files changed, 25 insertions(+), 15 deletions(-) create mode 100644 tests/xfs/071.cfg rename tests/xfs/{071.out.64 => 071.out.default} (100%)Signature · 1 line
2.54.0