From: Amir Goldstein Date: Wed, 23 Aug 2017 15:49:11 +0000 (+0300) Subject: common/rc: fix _require_xfs_io_command params check X-Git-Tag: v2022.05.01~1905 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=9b1358a22b93302cbd5339ec38335e7b3cf751e6;p=xfstests-dev.git common/rc: fix _require_xfs_io_command params check When _require_xfs_io_command is passed command parameters, the resulting error from invalid parameters may be ignored. For example, the following bogus params would not abort the test: _require_xfs_io_command "falloc" "-X" _require_xfs_io_command "fiemap" "-X" Fix this by looking for the relevant error message. Signed-off-by: Amir Goldstein Reviewed-by: Eryu Guan Reviewed-by: Darrick J. Wong Signed-off-by: Eryu Guan --- diff --git a/common/rc b/common/rc index 9d7b7830..44b98f6f 100644 --- a/common/rc +++ b/common/rc @@ -2212,9 +2212,14 @@ _require_xfs_io_command() echo $testio | grep -q "Function not implemented" && \ _notrun "xfs_io $command support is missing (missing syscall?)" - if [ -n "$param" -a $param_checked -eq 0 ]; then + [ -n "$param" ] || return + + if [ $param_checked -eq 0 ]; then $XFS_IO_PROG -c "help $command" | grep -q "^ $param --" || \ _notrun "xfs_io $command doesn't support $param" + else + echo $testio | grep -q "invalid option" && \ + _notrun "xfs_io $command doesn't support $param" fi }