]> www.infradead.org Git - users/dwmw2/qemu.git/commitdiff
iotests: Allow running from different directory
authorKevin Wolf <kwolf@redhat.com>
Wed, 2 Sep 2020 11:03:26 +0000 (13:03 +0200)
committerKevin Wolf <kwolf@redhat.com>
Thu, 10 Sep 2020 09:11:05 +0000 (11:11 +0200)
It is convenient to be able to edit the tests and run them without
changing the current working directory back and forth. Instead of
assuming that $PWD is the qemu-iotests build directory, derive the build
directory from the executed script.

This allows 'check' to find the required files even when called from
another directory. The scratch directory will still be in the current
working directory.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Message-Id: <20200902110326.257115-1-kwolf@redhat.com>
Reviewed-by: Claudio Fontana <cfontana@suse.de>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
tests/qemu-iotests/check

index 3ab859ac1aa344dff5471b85f1a3d08275aac77d..e14a1f354dd93d97cdd4467be90b85aaf04a1513 100755 (executable)
@@ -44,7 +44,7 @@ then
         _init_error "failed to obtain source tree name from check symlink"
     fi
     source_iotests=$(cd "$source_iotests"; pwd) || _init_error "failed to enter source tree"
-    build_iotests=$PWD
+    build_iotests=$(readlink -f $(dirname "$0"))
 else
     # called from the source tree
     source_iotests=$PWD