aboutsummaryrefslogtreecommitdiff
path: root/tests/qemu-iotests/check
diff options
context:
space:
mode:
authorMax Reitz <mreitz@redhat.com>2014-05-03 16:47:08 +0200
committerStefan Hajnoczi <stefanha@redhat.com>2014-05-09 13:32:16 +0200
commitf915db07ef9c368ea6db6430256de064fdd1525f (patch)
tree965256d297818a60b5327455a2fba089ba65b322 /tests/qemu-iotests/check
parent65f33bc0020112e7be7b8966495cd5efa2d0ab15 (diff)
iotests: Use configured python
Currently, QEMU's iotests rely on /usr/bin/env to start the correct Python (that is, at least Python 2.4, but not 3). On systems where Python 3 is the default, the user has no clean way of making the iotests use the correct binary. This commit makes the iotests use the Python selected by configure. Signed-off-by: Max Reitz <mreitz@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Diffstat (limited to 'tests/qemu-iotests/check')
-rwxr-xr-xtests/qemu-iotests/check18
1 files changed, 16 insertions, 2 deletions
diff --git a/tests/qemu-iotests/check b/tests/qemu-iotests/check
index e2ed5a95f8..ca2ee43d3b 100755
--- a/tests/qemu-iotests/check
+++ b/tests/qemu-iotests/check
@@ -34,6 +34,13 @@ timestamp=${TIMESTAMP:=false}
# generic initialization
iam=check
+# we need common.env
+if ! . ./common.env
+then
+ echo "$iam: failed to source common.env"
+ exit 1
+fi
+
# we need common.config
if ! . ./common.config
then
@@ -215,9 +222,16 @@ do
start=`_wallclock`
$timestamp && echo -n " ["`date "+%T"`"]"
- [ ! -x $seq ] && chmod u+x $seq # ensure we can run it
+
+ if [ "$(head -n 1 $seq)" == "#!/usr/bin/env python" ]; then
+ run_command="$PYTHON $seq"
+ else
+ [ ! -x $seq ] && chmod u+x $seq # ensure we can run it
+ run_command="./$seq"
+ fi
+
MALLOC_PERTURB_=${MALLOC_PERTURB_:-$(($RANDOM % 255 + 1))} \
- ./$seq >$tmp.out 2>&1
+ $run_command >$tmp.out 2>&1
sts=$?
$timestamp && _timestamp
stop=`_wallclock`