* [Qemu-devel] [PATCH v3 1/7] iotests: Allow out-of-tree run
2014-05-22 21:30 [Qemu-devel] [PATCH v3 0/7] iotests: Allow out-of-tree run Max Reitz
@ 2014-05-22 21:30 ` Max Reitz
2014-05-23 3:44 ` Fam Zheng
2014-05-22 21:30 ` [Qemu-devel] [PATCH v3 2/7] configure: Enable out-of-tree iotests Max Reitz
` (6 subsequent siblings)
7 siblings, 1 reply; 21+ messages in thread
From: Max Reitz @ 2014-05-22 21:30 UTC (permalink / raw)
To: qemu-devel
Cc: Kevin Wolf, Peter Maydell, Markus Armbruster, Max Reitz,
Stefan Hajnoczi
As out-of-tree builds are preferred for qemu, running the qemu-iotests
in that out-of-tree build should be supported as well. To do so, a
symbolic link has to be created pointing to the check script in the
source directory. That script will check whether it has been run through
a symlink, and if so, will assume it is run in the build tree. All
output and temporary operations performed by iotests are then redirected
here and, unless specified otherwise by the user, QEMU_PROG etc. will be
set to paths appropriate for the build tree.
Also, drop making every test case executable if it is not yet, as this
would modify the source tree which is not desired for out-of-tree runs
and should be fixed in the repository anyway.
Signed-off-by: Max Reitz <mreitz@redhat.com>
---
tests/qemu-iotests/check | 98 ++++++++++++++++++++++++++++++++++------
tests/qemu-iotests/common | 8 ++--
tests/qemu-iotests/common.config | 2 +-
tests/qemu-iotests/common.rc | 8 ++--
tests/qemu-iotests/iotests.py | 3 +-
5 files changed, 94 insertions(+), 25 deletions(-)
diff --git a/tests/qemu-iotests/check b/tests/qemu-iotests/check
index e2ed5a9..bd917a1 100755
--- a/tests/qemu-iotests/check
+++ b/tests/qemu-iotests/check
@@ -34,22 +34,89 @@ timestamp=${TIMESTAMP:=false}
# generic initialization
iam=check
+_init_error()
+{
+ echo "$iam: $1" >&2
+ exit 1
+}
+
+if [ -L "$0" ]
+then
+ # called from the build tree
+ source_iotests=$(dirname "$(readlink "$0")")
+ if [ -z "$source_iotests" ]
+ 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
+else
+ # called from the source tree
+ source_iotests=$PWD
+ # this may be an in-tree build (note that in the following code we may not
+ # assume that it truly as and always have to test whether the build results
+ # actually exist)
+ build_iotests=$PWD
+fi
+
+build_root="$build_iotests/../.."
+
+if [ -x "$build_iotests/socket_scm_helper" ]
+then
+ export SOCKET_SCM_HELPER="$build_iotests/socket_scm_helper"
+fi
+
+# if ./qemu exists, it should be prioritized and will be chosen by common.config
+if [[ -z "$QEMU_PROG" && ! -x './qemu' ]]
+then
+ arch=$(uname -m 2> /dev/null)
+
+ if [[ -n $arch && -x "$build_root/$arch-softmmu/qemu-system-$arch" ]]
+ then
+ export QEMU_PROG="$build_root/$arch-softmmu/qemu-system-$arch"
+ else
+ pushd -q "$build_root"
+ for binary in *-softmmu/qemu-system-*
+ do
+ if [ -x "$binary" ]
+ then
+ export QEMU_PROG="$build_root/$binary"
+ break
+ fi
+ done
+ popd -q
+ fi
+fi
+
+if [[ -z $QEMU_IMG_PROG && -x "$build_root/qemu-img" && ! -x './qemu-img' ]]
+then
+ export QEMU_IMG_PROG="$build_root/qemu-img"
+fi
+
+if [[ -z $QEMU_IO_PROG && -x "$build_root/qemu-io" && ! -x './qemu-io' ]]
+then
+ export QEMU_IO_PROG="$build_root/qemu-io"
+fi
+
+if [[ -z $QEMU_NBD_PROG && -x "$build_root/qemu-nbd" && ! -x './qemu-nbd' ]]
+then
+ export QEMU_NBD_PROG="$build_root/qemu-nbd"
+fi
+
# we need common.config
-if ! . ./common.config
+if ! . "$source_iotests/common.config"
then
- echo "$iam: failed to source common.config"
- exit 1
+ _init_error "failed to source common.config"
fi
# we need common.rc
-if ! . ./common.rc
+if ! . "$source_iotests/common.rc"
then
- echo "check: failed to source common.rc"
- exit 1
+ _init_error "failed to source common.rc"
fi
# we need common
-. ./common
+. "$source_iotests/common"
#if [ `id -u` -ne 0 ]
#then
@@ -194,7 +261,7 @@ do
echo " - expunged"
rm -f $seq.out.bad
echo "/^$seq\$/d" >>$tmp.expunged
- elif [ ! -f $seq ]
+ elif [ ! -f "$source_iotests/$seq" ]
then
echo " - no such test?"
echo "/^$seq\$/d" >>$tmp.expunged
@@ -215,9 +282,10 @@ do
start=`_wallclock`
$timestamp && echo -n " ["`date "+%T"`"]"
- [ ! -x $seq ] && chmod u+x $seq # ensure we can run it
+ export OUTPUT_DIR=$PWD
+ (cd "$source_iotests";
MALLOC_PERTURB_=${MALLOC_PERTURB_:-$(($RANDOM % 255 + 1))} \
- ./$seq >$tmp.out 2>&1
+ ./$seq >$tmp.out 2>&1)
sts=$?
$timestamp && _timestamp
stop=`_wallclock`
@@ -242,17 +310,17 @@ do
err=true
fi
- reference=$seq.out
+ reference="$source_iotests/$seq.out"
if [ "$CACHEMODE" = "none" ]; then
- [ -f $seq.out.nocache ] && reference=$seq.out.nocache
+ [ -f "$source_iotests/$seq.out.nocache" ] && reference="$source_iotests/$seq.out.nocache"
fi
- if [ ! -f $reference ]
+ if [ ! -f "$reference" ]
then
echo " - no qualified output"
err=true
else
- if diff -w $reference $tmp.out >/dev/null 2>&1
+ if diff -w "$reference" $tmp.out >/dev/null 2>&1
then
echo ""
if $err
@@ -264,7 +332,7 @@ do
else
echo " - output mismatch (see $seq.out.bad)"
mv $tmp.out $seq.out.bad
- $diff -w $reference $seq.out.bad
+ $diff -w "$reference" $seq.out.bad
err=true
fi
fi
diff --git a/tests/qemu-iotests/common b/tests/qemu-iotests/common
index 0aaf84d..3c53c4f 100644
--- a/tests/qemu-iotests/common
+++ b/tests/qemu-iotests/common
@@ -59,7 +59,7 @@ do
if $group
then
# arg after -g
- group_list=`sed -n <group -e 's/$/ /' -e "/^[0-9][0-9][0-9].* $r /"'{
+ group_list=`sed -n <"$source_iotests/group" -e 's/$/ /' -e "/^[0-9][0-9][0-9].* $r /"'{
s/ .*//p
}'`
if [ -z "$group_list" ]
@@ -84,7 +84,7 @@ s/ .*//p
then
# arg after -x
[ ! -s $tmp.list ] && ls [0-9][0-9][0-9] [0-9][0-9][0-9][0-9] >$tmp.list 2>/dev/null
- group_list=`sed -n <group -e 's/$/ /' -e "/^[0-9][0-9][0-9].* $r /"'{
+ group_list=`sed -n <"$source_iotests/group" -e 's/$/ /' -e "/^[0-9][0-9][0-9].* $r /"'{
s/ .*//p
}'`
if [ -z "$group_list" ]
@@ -366,7 +366,7 @@ testlist options
BEGIN { for (t='$start'; t<='$end'; t++) printf "%03d\n",t }' \
| while read id
do
- if grep -s "^$id " group >/dev/null
+ if grep -s "^$id " "$source_iotests/group" >/dev/null
then
# in group file ... OK
echo $id >>$tmp.list
@@ -402,7 +402,7 @@ else
touch $tmp.list
else
# no test numbers, do everything from group file
- sed -n -e '/^[0-9][0-9][0-9]*/s/[ ].*//p' <group >$tmp.list
+ sed -n -e '/^[0-9][0-9][0-9]*/s/[ ].*//p' <"$source_iotests/group" >$tmp.list
fi
fi
diff --git a/tests/qemu-iotests/common.config b/tests/qemu-iotests/common.config
index d90a8bc..bd6790b 100644
--- a/tests/qemu-iotests/common.config
+++ b/tests/qemu-iotests/common.config
@@ -126,7 +126,7 @@ fi
export TEST_DIR
if [ -z "$SAMPLE_IMG_DIR" ]; then
- SAMPLE_IMG_DIR=`pwd`/sample_images
+ SAMPLE_IMG_DIR="$source_iotests/sample_images"
fi
if [ ! -d "$SAMPLE_IMG_DIR" ]; then
diff --git a/tests/qemu-iotests/common.rc b/tests/qemu-iotests/common.rc
index 195c564..e0ea7e3 100644
--- a/tests/qemu-iotests/common.rc
+++ b/tests/qemu-iotests/common.rc
@@ -318,9 +318,9 @@ _do()
status=1; exit
fi
- (eval "echo '---' \"$_cmd\"") >>$here/$seq.full
+ (eval "echo '---' \"$_cmd\"") >>"$OUTPUT_DIR/$seq.full"
(eval "$_cmd") >$tmp._out 2>&1; ret=$?
- cat $tmp._out >>$here/$seq.full
+ cat $tmp._out >>"$OUTPUT_DIR/$seq.full"
if [ $# -eq 2 ]; then
if [ $ret -eq 0 ]; then
echo "done"
@@ -344,7 +344,7 @@ _do()
#
_notrun()
{
- echo "$*" >$seq.notrun
+ echo "$*" >"$OUTPUT_DIR/$seq.notrun"
echo "$seq not run: $*"
status=0
exit
@@ -354,7 +354,7 @@ _notrun()
#
_fail()
{
- echo "$*" | tee -a $here/$seq.full
+ echo "$*" | tee -a "$OUTPUT_DIR/$seq.full"
echo "(see $seq.full for details)"
status=1
exit 1
diff --git a/tests/qemu-iotests/iotests.py b/tests/qemu-iotests/iotests.py
index f6c437c..39a4cfc 100644
--- a/tests/qemu-iotests/iotests.py
+++ b/tests/qemu-iotests/iotests.py
@@ -37,6 +37,7 @@ qemu_args = os.environ.get('QEMU', 'qemu').strip().split(' ')
imgfmt = os.environ.get('IMGFMT', 'raw')
imgproto = os.environ.get('IMGPROTO', 'file')
test_dir = os.environ.get('TEST_DIR', '/var/tmp')
+output_dir = os.environ.get('OUTPUT_DIR', '.')
cachemode = os.environ.get('CACHEMODE')
socket_scm_helper = os.environ.get('SOCKET_SCM_HELPER', 'socket_scm_helper')
@@ -278,7 +279,7 @@ def notrun(reason):
# Each test in qemu-iotests has a number ("seq")
seq = os.path.basename(sys.argv[0])
- open('%s.notrun' % seq, 'wb').write(reason + '\n')
+ open('%s/%s.notrun' % (output_dir, seq), 'wb').write(reason + '\n')
print '%s not run: %s' % (seq, reason)
sys.exit(0)
--
1.9.3
^ permalink raw reply related [flat|nested] 21+ messages in thread
* Re: [Qemu-devel] [PATCH v3 1/7] iotests: Allow out-of-tree run
2014-05-22 21:30 ` [Qemu-devel] [PATCH v3 1/7] " Max Reitz
@ 2014-05-23 3:44 ` Fam Zheng
0 siblings, 0 replies; 21+ messages in thread
From: Fam Zheng @ 2014-05-23 3:44 UTC (permalink / raw)
To: Max Reitz
Cc: Kevin Wolf, Peter Maydell, qemu-devel, Stefan Hajnoczi,
Markus Armbruster
On Thu, 05/22 23:30, Max Reitz wrote:
> As out-of-tree builds are preferred for qemu, running the qemu-iotests
> in that out-of-tree build should be supported as well. To do so, a
> symbolic link has to be created pointing to the check script in the
> source directory. That script will check whether it has been run through
> a symlink, and if so, will assume it is run in the build tree. All
> output and temporary operations performed by iotests are then redirected
> here and, unless specified otherwise by the user, QEMU_PROG etc. will be
> set to paths appropriate for the build tree.
>
> Also, drop making every test case executable if it is not yet, as this
> would modify the source tree which is not desired for out-of-tree runs
> and should be fixed in the repository anyway.
>
> Signed-off-by: Max Reitz <mreitz@redhat.com>
> ---
> tests/qemu-iotests/check | 98 ++++++++++++++++++++++++++++++++++------
> tests/qemu-iotests/common | 8 ++--
> tests/qemu-iotests/common.config | 2 +-
> tests/qemu-iotests/common.rc | 8 ++--
> tests/qemu-iotests/iotests.py | 3 +-
> 5 files changed, 94 insertions(+), 25 deletions(-)
>
> diff --git a/tests/qemu-iotests/check b/tests/qemu-iotests/check
> index e2ed5a9..bd917a1 100755
> --- a/tests/qemu-iotests/check
> +++ b/tests/qemu-iotests/check
> @@ -34,22 +34,89 @@ timestamp=${TIMESTAMP:=false}
> # generic initialization
> iam=check
>
> +_init_error()
> +{
> + echo "$iam: $1" >&2
> + exit 1
> +}
> +
> +if [ -L "$0" ]
> +then
> + # called from the build tree
> + source_iotests=$(dirname "$(readlink "$0")")
> + if [ -z "$source_iotests" ]
> + 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
> +else
> + # called from the source tree
> + source_iotests=$PWD
> + # this may be an in-tree build (note that in the following code we may not
> + # assume that it truly as and always have to test whether the build results
> + # actually exist)
> + build_iotests=$PWD
> +fi
> +
> +build_root="$build_iotests/../.."
> +
> +if [ -x "$build_iotests/socket_scm_helper" ]
> +then
> + export SOCKET_SCM_HELPER="$build_iotests/socket_scm_helper"
> +fi
> +
> +# if ./qemu exists, it should be prioritized and will be chosen by common.config
> +if [[ -z "$QEMU_PROG" && ! -x './qemu' ]]
> +then
> + arch=$(uname -m 2> /dev/null)
> +
> + if [[ -n $arch && -x "$build_root/$arch-softmmu/qemu-system-$arch" ]]
> + then
> + export QEMU_PROG="$build_root/$arch-softmmu/qemu-system-$arch"
> + else
> + pushd -q "$build_root"
> + for binary in *-softmmu/qemu-system-*
> + do
> + if [ -x "$binary" ]
> + then
> + export QEMU_PROG="$build_root/$binary"
> + break
> + fi
> + done
> + popd -q
> + fi
> +fi
Sensible probe!
> +
> +if [[ -z $QEMU_IMG_PROG && -x "$build_root/qemu-img" && ! -x './qemu-img' ]]
> +then
> + export QEMU_IMG_PROG="$build_root/qemu-img"
> +fi
> +
> +if [[ -z $QEMU_IO_PROG && -x "$build_root/qemu-io" && ! -x './qemu-io' ]]
> +then
> + export QEMU_IO_PROG="$build_root/qemu-io"
> +fi
> +
> +if [[ -z $QEMU_NBD_PROG && -x "$build_root/qemu-nbd" && ! -x './qemu-nbd' ]]
> +then
> + export QEMU_NBD_PROG="$build_root/qemu-nbd"
> +fi
> +
> # we need common.config
> -if ! . ./common.config
> +if ! . "$source_iotests/common.config"
> then
> - echo "$iam: failed to source common.config"
> - exit 1
> + _init_error "failed to source common.config"
> fi
>
> # we need common.rc
> -if ! . ./common.rc
> +if ! . "$source_iotests/common.rc"
> then
> - echo "check: failed to source common.rc"
> - exit 1
> + _init_error "failed to source common.rc"
> fi
>
> # we need common
> -. ./common
> +. "$source_iotests/common"
>
> #if [ `id -u` -ne 0 ]
> #then
> @@ -194,7 +261,7 @@ do
> echo " - expunged"
> rm -f $seq.out.bad
> echo "/^$seq\$/d" >>$tmp.expunged
> - elif [ ! -f $seq ]
> + elif [ ! -f "$source_iotests/$seq" ]
> then
> echo " - no such test?"
> echo "/^$seq\$/d" >>$tmp.expunged
> @@ -215,9 +282,10 @@ do
>
> start=`_wallclock`
> $timestamp && echo -n " ["`date "+%T"`"]"
> - [ ! -x $seq ] && chmod u+x $seq # ensure we can run it
> + export OUTPUT_DIR=$PWD
> + (cd "$source_iotests";
> MALLOC_PERTURB_=${MALLOC_PERTURB_:-$(($RANDOM % 255 + 1))} \
> - ./$seq >$tmp.out 2>&1
> + ./$seq >$tmp.out 2>&1)
> sts=$?
> $timestamp && _timestamp
> stop=`_wallclock`
> @@ -242,17 +310,17 @@ do
> err=true
> fi
>
> - reference=$seq.out
> + reference="$source_iotests/$seq.out"
> if [ "$CACHEMODE" = "none" ]; then
> - [ -f $seq.out.nocache ] && reference=$seq.out.nocache
> + [ -f "$source_iotests/$seq.out.nocache" ] && reference="$source_iotests/$seq.out.nocache"
> fi
>
> - if [ ! -f $reference ]
> + if [ ! -f "$reference" ]
> then
> echo " - no qualified output"
> err=true
> else
> - if diff -w $reference $tmp.out >/dev/null 2>&1
> + if diff -w "$reference" $tmp.out >/dev/null 2>&1
> then
> echo ""
> if $err
> @@ -264,7 +332,7 @@ do
> else
> echo " - output mismatch (see $seq.out.bad)"
> mv $tmp.out $seq.out.bad
> - $diff -w $reference $seq.out.bad
> + $diff -w "$reference" $seq.out.bad
> err=true
> fi
> fi
> diff --git a/tests/qemu-iotests/common b/tests/qemu-iotests/common
> index 0aaf84d..3c53c4f 100644
> --- a/tests/qemu-iotests/common
> +++ b/tests/qemu-iotests/common
> @@ -59,7 +59,7 @@ do
> if $group
> then
> # arg after -g
> - group_list=`sed -n <group -e 's/$/ /' -e "/^[0-9][0-9][0-9].* $r /"'{
> + group_list=`sed -n <"$source_iotests/group" -e 's/$/ /' -e "/^[0-9][0-9][0-9].* $r /"'{
> s/ .*//p
> }'`
> if [ -z "$group_list" ]
> @@ -84,7 +84,7 @@ s/ .*//p
> then
> # arg after -x
> [ ! -s $tmp.list ] && ls [0-9][0-9][0-9] [0-9][0-9][0-9][0-9] >$tmp.list 2>/dev/null
> - group_list=`sed -n <group -e 's/$/ /' -e "/^[0-9][0-9][0-9].* $r /"'{
> + group_list=`sed -n <"$source_iotests/group" -e 's/$/ /' -e "/^[0-9][0-9][0-9].* $r /"'{
> s/ .*//p
> }'`
> if [ -z "$group_list" ]
> @@ -366,7 +366,7 @@ testlist options
> BEGIN { for (t='$start'; t<='$end'; t++) printf "%03d\n",t }' \
> | while read id
> do
> - if grep -s "^$id " group >/dev/null
> + if grep -s "^$id " "$source_iotests/group" >/dev/null
> then
> # in group file ... OK
> echo $id >>$tmp.list
> @@ -402,7 +402,7 @@ else
> touch $tmp.list
> else
> # no test numbers, do everything from group file
> - sed -n -e '/^[0-9][0-9][0-9]*/s/[ ].*//p' <group >$tmp.list
> + sed -n -e '/^[0-9][0-9][0-9]*/s/[ ].*//p' <"$source_iotests/group" >$tmp.list
> fi
> fi
>
> diff --git a/tests/qemu-iotests/common.config b/tests/qemu-iotests/common.config
> index d90a8bc..bd6790b 100644
> --- a/tests/qemu-iotests/common.config
> +++ b/tests/qemu-iotests/common.config
> @@ -126,7 +126,7 @@ fi
> export TEST_DIR
>
> if [ -z "$SAMPLE_IMG_DIR" ]; then
> - SAMPLE_IMG_DIR=`pwd`/sample_images
> + SAMPLE_IMG_DIR="$source_iotests/sample_images"
> fi
>
> if [ ! -d "$SAMPLE_IMG_DIR" ]; then
> diff --git a/tests/qemu-iotests/common.rc b/tests/qemu-iotests/common.rc
> index 195c564..e0ea7e3 100644
> --- a/tests/qemu-iotests/common.rc
> +++ b/tests/qemu-iotests/common.rc
> @@ -318,9 +318,9 @@ _do()
> status=1; exit
> fi
>
> - (eval "echo '---' \"$_cmd\"") >>$here/$seq.full
> + (eval "echo '---' \"$_cmd\"") >>"$OUTPUT_DIR/$seq.full"
> (eval "$_cmd") >$tmp._out 2>&1; ret=$?
> - cat $tmp._out >>$here/$seq.full
> + cat $tmp._out >>"$OUTPUT_DIR/$seq.full"
> if [ $# -eq 2 ]; then
> if [ $ret -eq 0 ]; then
> echo "done"
> @@ -344,7 +344,7 @@ _do()
> #
> _notrun()
> {
> - echo "$*" >$seq.notrun
> + echo "$*" >"$OUTPUT_DIR/$seq.notrun"
> echo "$seq not run: $*"
> status=0
> exit
> @@ -354,7 +354,7 @@ _notrun()
> #
> _fail()
> {
> - echo "$*" | tee -a $here/$seq.full
> + echo "$*" | tee -a "$OUTPUT_DIR/$seq.full"
> echo "(see $seq.full for details)"
> status=1
> exit 1
$here is unused now, Worth to clean up in all test cases in a follow up patch.
Reviewed-by: Fam Zheng <famz@redhat.com>
^ permalink raw reply [flat|nested] 21+ messages in thread
* [Qemu-devel] [PATCH v3 2/7] configure: Enable out-of-tree iotests
2014-05-22 21:30 [Qemu-devel] [PATCH v3 0/7] iotests: Allow out-of-tree run Max Reitz
2014-05-22 21:30 ` [Qemu-devel] [PATCH v3 1/7] " Max Reitz
@ 2014-05-22 21:30 ` Max Reitz
2014-05-23 3:47 ` Fam Zheng
2014-05-22 21:30 ` [Qemu-devel] [PATCH v3 3/7] iotests: Add default common.env Max Reitz
` (5 subsequent siblings)
7 siblings, 1 reply; 21+ messages in thread
From: Max Reitz @ 2014-05-22 21:30 UTC (permalink / raw)
To: qemu-devel
Cc: Kevin Wolf, Peter Maydell, Markus Armbruster, Max Reitz,
Stefan Hajnoczi
In order to allow out-of-tree iotests, create a symlink for the check
script in the build tree.
While doing so, also write configured options relevant to the iotests to
common.env in the build tree; currently, this is the command to invoke
Python 2.
Signed-off-by: Max Reitz <mreitz@redhat.com>
---
configure | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/configure b/configure
index 605a0ec..f9d7a4d 100755
--- a/configure
+++ b/configure
@@ -5206,6 +5206,18 @@ if test "$docs" = "yes" ; then
mkdir -p QMP
fi
+# set up qemu-iotests in this build directory
+iotests_common_env="tests/qemu-iotests/common.env"
+iotests_check="tests/qemu-iotests/check"
+
+echo "# Automatically generated by configure - do not modify" > "$iotests_common_env"
+echo >> "$iotests_common_env"
+echo "export PYTHON='$python'" >> "$iotests_common_env"
+
+if [ ! -e "$iotests_check" ]; then
+ ln -s "$source_path/$iotests_check" "$iotests_check"
+fi
+
# Save the configure command line for later reuse.
cat <<EOD >config.status
#!/bin/sh
--
1.9.3
^ permalink raw reply related [flat|nested] 21+ messages in thread
* Re: [Qemu-devel] [PATCH v3 2/7] configure: Enable out-of-tree iotests
2014-05-22 21:30 ` [Qemu-devel] [PATCH v3 2/7] configure: Enable out-of-tree iotests Max Reitz
@ 2014-05-23 3:47 ` Fam Zheng
2014-05-24 19:27 ` Max Reitz
0 siblings, 1 reply; 21+ messages in thread
From: Fam Zheng @ 2014-05-23 3:47 UTC (permalink / raw)
To: Max Reitz
Cc: Kevin Wolf, Peter Maydell, qemu-devel, Stefan Hajnoczi,
Markus Armbruster
On Thu, 05/22 23:30, Max Reitz wrote:
> In order to allow out-of-tree iotests, create a symlink for the check
> script in the build tree.
>
> While doing so, also write configured options relevant to the iotests to
> common.env in the build tree; currently, this is the command to invoke
> Python 2.
>
> Signed-off-by: Max Reitz <mreitz@redhat.com>
> ---
> configure | 12 ++++++++++++
> 1 file changed, 12 insertions(+)
>
> diff --git a/configure b/configure
> index 605a0ec..f9d7a4d 100755
> --- a/configure
> +++ b/configure
> @@ -5206,6 +5206,18 @@ if test "$docs" = "yes" ; then
> mkdir -p QMP
> fi
>
> +# set up qemu-iotests in this build directory
> +iotests_common_env="tests/qemu-iotests/common.env"
> +iotests_check="tests/qemu-iotests/check"
> +
> +echo "# Automatically generated by configure - do not modify" > "$iotests_common_env"
> +echo >> "$iotests_common_env"
> +echo "export PYTHON='$python'" >> "$iotests_common_env"
> +
> +if [ ! -e "$iotests_check" ]; then
> + ln -s "$source_path/$iotests_check" "$iotests_check"
> +fi
> +
Please use symlink().
Fam
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [Qemu-devel] [PATCH v3 2/7] configure: Enable out-of-tree iotests
2014-05-23 3:47 ` Fam Zheng
@ 2014-05-24 19:27 ` Max Reitz
0 siblings, 0 replies; 21+ messages in thread
From: Max Reitz @ 2014-05-24 19:27 UTC (permalink / raw)
To: Fam Zheng
Cc: Kevin Wolf, Peter Maydell, qemu-devel, Stefan Hajnoczi,
Markus Armbruster
On 23.05.2014 05:47, Fam Zheng wrote:
> On Thu, 05/22 23:30, Max Reitz wrote:
>> In order to allow out-of-tree iotests, create a symlink for the check
>> script in the build tree.
>>
>> While doing so, also write configured options relevant to the iotests to
>> common.env in the build tree; currently, this is the command to invoke
>> Python 2.
>>
>> Signed-off-by: Max Reitz <mreitz@redhat.com>
>> ---
>> configure | 12 ++++++++++++
>> 1 file changed, 12 insertions(+)
>>
>> diff --git a/configure b/configure
>> index 605a0ec..f9d7a4d 100755
>> --- a/configure
>> +++ b/configure
>> @@ -5206,6 +5206,18 @@ if test "$docs" = "yes" ; then
>> mkdir -p QMP
>> fi
>>
>> +# set up qemu-iotests in this build directory
>> +iotests_common_env="tests/qemu-iotests/common.env"
>> +iotests_check="tests/qemu-iotests/check"
>> +
>> +echo "# Automatically generated by configure - do not modify" > "$iotests_common_env"
>> +echo >> "$iotests_common_env"
>> +echo "export PYTHON='$python'" >> "$iotests_common_env"
>> +
>> +if [ ! -e "$iotests_check" ]; then
>> + ln -s "$source_path/$iotests_check" "$iotests_check"
>> +fi
>> +
> Please use symlink().
I'll do.
Max
^ permalink raw reply [flat|nested] 21+ messages in thread
* [Qemu-devel] [PATCH v3 3/7] iotests: Add default common.env
2014-05-22 21:30 [Qemu-devel] [PATCH v3 0/7] iotests: Allow out-of-tree run Max Reitz
2014-05-22 21:30 ` [Qemu-devel] [PATCH v3 1/7] " Max Reitz
2014-05-22 21:30 ` [Qemu-devel] [PATCH v3 2/7] configure: Enable out-of-tree iotests Max Reitz
@ 2014-05-22 21:30 ` Max Reitz
2014-05-23 6:10 ` Fam Zheng
2014-05-22 21:30 ` [Qemu-devel] [PATCH v3 4/7] iotests: Source common.env Max Reitz
` (4 subsequent siblings)
7 siblings, 1 reply; 21+ messages in thread
From: Max Reitz @ 2014-05-22 21:30 UTC (permalink / raw)
To: qemu-devel
Cc: Kevin Wolf, Peter Maydell, Markus Armbruster, Max Reitz,
Stefan Hajnoczi
Add a default common.env in case the one supposed to be emitted by
configure cannot be found.
Signed-off-by: Max Reitz <mreitz@redhat.com>
---
tests/qemu-iotests/common.env.default | 6 ++++++
1 file changed, 6 insertions(+)
create mode 100644 tests/qemu-iotests/common.env.default
diff --git a/tests/qemu-iotests/common.env.default b/tests/qemu-iotests/common.env.default
new file mode 100644
index 0000000..406e1f1
--- /dev/null
+++ b/tests/qemu-iotests/common.env.default
@@ -0,0 +1,6 @@
+if command -v python2 > /dev/null
+then
+ export PYTHON='python2'
+else
+ export PYTHON='python'
+fi
--
1.9.3
^ permalink raw reply related [flat|nested] 21+ messages in thread
* Re: [Qemu-devel] [PATCH v3 3/7] iotests: Add default common.env
2014-05-22 21:30 ` [Qemu-devel] [PATCH v3 3/7] iotests: Add default common.env Max Reitz
@ 2014-05-23 6:10 ` Fam Zheng
2014-05-23 12:27 ` Eric Blake
0 siblings, 1 reply; 21+ messages in thread
From: Fam Zheng @ 2014-05-23 6:10 UTC (permalink / raw)
To: Max Reitz
Cc: Kevin Wolf, Peter Maydell, qemu-devel, Stefan Hajnoczi,
Markus Armbruster
On Thu, 05/22 23:30, Max Reitz wrote:
> Add a default common.env in case the one supposed to be emitted by
> configure cannot be found.
>
> Signed-off-by: Max Reitz <mreitz@redhat.com>
Now we can run both from in-tree build and out-of-tree build without this,
which is already very good, but we need this patch to run from the source tree
with an out-of-tree build. I'm not sure we really need that, though.
common.env.default worries me a bit with the impression that we are guessing
the configure's output when we don't know the right place to look. Not a big
issue with $PYTHON itself, but it's dubious whether this file is right in its
place.
Let's wait for others' input.
Thanks,
Fam
> ---
> tests/qemu-iotests/common.env.default | 6 ++++++
> 1 file changed, 6 insertions(+)
> create mode 100644 tests/qemu-iotests/common.env.default
>
> diff --git a/tests/qemu-iotests/common.env.default b/tests/qemu-iotests/common.env.default
> new file mode 100644
> index 0000000..406e1f1
> --- /dev/null
> +++ b/tests/qemu-iotests/common.env.default
> @@ -0,0 +1,6 @@
> +if command -v python2 > /dev/null
> +then
> + export PYTHON='python2'
> +else
> + export PYTHON='python'
> +fi
> --
> 1.9.3
>
>
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [Qemu-devel] [PATCH v3 3/7] iotests: Add default common.env
2014-05-23 6:10 ` Fam Zheng
@ 2014-05-23 12:27 ` Eric Blake
2014-05-23 13:33 ` Markus Armbruster
0 siblings, 1 reply; 21+ messages in thread
From: Eric Blake @ 2014-05-23 12:27 UTC (permalink / raw)
To: Fam Zheng, Max Reitz
Cc: Kevin Wolf, Peter Maydell, qemu-devel, Stefan Hajnoczi,
Markus Armbruster
[-- Attachment #1: Type: text/plain, Size: 840 bytes --]
On 05/23/2014 12:10 AM, Fam Zheng wrote:
> On Thu, 05/22 23:30, Max Reitz wrote:
>> Add a default common.env in case the one supposed to be emitted by
>> configure cannot be found.
>>
>> Signed-off-by: Max Reitz <mreitz@redhat.com>
>
> Now we can run both from in-tree build and out-of-tree build without this,
> which is already very good, but we need this patch to run from the source tree
> with an out-of-tree build. I'm not sure we really need that, though.
If you have a source tree but no in-tree build, then there is no way to
know how many out-of-tree builds there are, or which one you should
pick. If you are going to do out-of-tree builds, you aren't going to
try to run tests from the source tree.
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 604 bytes --]
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [Qemu-devel] [PATCH v3 3/7] iotests: Add default common.env
2014-05-23 12:27 ` Eric Blake
@ 2014-05-23 13:33 ` Markus Armbruster
2014-05-24 19:40 ` Max Reitz
0 siblings, 1 reply; 21+ messages in thread
From: Markus Armbruster @ 2014-05-23 13:33 UTC (permalink / raw)
To: Eric Blake
Cc: Kevin Wolf, Peter Maydell, Fam Zheng, qemu-devel, Max Reitz,
Stefan Hajnoczi
Eric Blake <eblake@redhat.com> writes:
> On 05/23/2014 12:10 AM, Fam Zheng wrote:
>> On Thu, 05/22 23:30, Max Reitz wrote:
>>> Add a default common.env in case the one supposed to be emitted by
>>> configure cannot be found.
>>>
>>> Signed-off-by: Max Reitz <mreitz@redhat.com>
>>
>> Now we can run both from in-tree build and out-of-tree build without this,
>> which is already very good, but we need this patch to run from the source tree
>> with an out-of-tree build. I'm not sure we really need that, though.
>
> If you have a source tree but no in-tree build, then there is no way to
> know how many out-of-tree builds there are, or which one you should
> pick. If you are going to do out-of-tree builds, you aren't going to
> try to run tests from the source tree.
Let's not try to guess a build tree.
If someone tries to run tests in the source tree, and the source tree
has not been made a build tree by running configure there, simply fail.
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [Qemu-devel] [PATCH v3 3/7] iotests: Add default common.env
2014-05-23 13:33 ` Markus Armbruster
@ 2014-05-24 19:40 ` Max Reitz
0 siblings, 0 replies; 21+ messages in thread
From: Max Reitz @ 2014-05-24 19:40 UTC (permalink / raw)
To: Markus Armbruster, Eric Blake
Cc: Kevin Wolf, Peter Maydell, Fam Zheng, qemu-devel, Stefan Hajnoczi
On 23.05.2014 15:33, Markus Armbruster wrote:
> Eric Blake <eblake@redhat.com> writes:
>
>> On 05/23/2014 12:10 AM, Fam Zheng wrote:
>>> On Thu, 05/22 23:30, Max Reitz wrote:
>>>> Add a default common.env in case the one supposed to be emitted by
>>>> configure cannot be found.
>>>>
>>>> Signed-off-by: Max Reitz <mreitz@redhat.com>
>>> Now we can run both from in-tree build and out-of-tree build without this,
>>> which is already very good, but we need this patch to run from the source tree
>>> with an out-of-tree build. I'm not sure we really need that, though.
>> If you have a source tree but no in-tree build, then there is no way to
>> know how many out-of-tree builds there are, or which one you should
>> pick. If you are going to do out-of-tree builds, you aren't going to
>> try to run tests from the source tree.
> Let's not try to guess a build tree.
>
> If someone tries to run tests in the source tree, and the source tree
> has not been made a build tree by running configure there, simply fail.
Okay, as you and Fam (and probably also Eric) seem to agree on this,
I'll drop this patch and try to make the error message for failing to
include common.env more explanatory ("make sure the iotests are run from
the build tree" or something similar).
Max
^ permalink raw reply [flat|nested] 21+ messages in thread
* [Qemu-devel] [PATCH v3 4/7] iotests: Source common.env
2014-05-22 21:30 [Qemu-devel] [PATCH v3 0/7] iotests: Allow out-of-tree run Max Reitz
` (2 preceding siblings ...)
2014-05-22 21:30 ` [Qemu-devel] [PATCH v3 3/7] iotests: Add default common.env Max Reitz
@ 2014-05-22 21:30 ` Max Reitz
2014-05-23 4:01 ` Fam Zheng
2014-05-22 21:30 ` [Qemu-devel] [PATCH v3 5/7] iotests: Use $PYTHON for Python scripts Max Reitz
` (3 subsequent siblings)
7 siblings, 1 reply; 21+ messages in thread
From: Max Reitz @ 2014-05-22 21:30 UTC (permalink / raw)
To: qemu-devel
Cc: Kevin Wolf, Peter Maydell, Markus Armbruster, Max Reitz,
Stefan Hajnoczi
Source common.env in the iotests' check script. If the one supposed to
be created by configure cannot be found, use common.env.default from the
source tree.
Signed-off-by: Max Reitz <mreitz@redhat.com>
---
tests/qemu-iotests/check | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
diff --git a/tests/qemu-iotests/check b/tests/qemu-iotests/check
index bd917a1..8ec5b8d 100755
--- a/tests/qemu-iotests/check
+++ b/tests/qemu-iotests/check
@@ -103,6 +103,22 @@ then
export QEMU_NBD_PROG="$build_root/qemu-nbd"
fi
+# we need common.env
+if [ -n "$build_iotests" ]
+then
+ configured_common_env="$build_iotests/common.env"
+else
+ configured_common_env="$source_iotests/common.env"
+fi
+
+if ! . "$configured_common_env"
+then
+ if ! . "$source_iotests/common.env.default"
+ then
+ _init_error "failed to source common.env"
+ fi
+fi
+
# we need common.config
if ! . "$source_iotests/common.config"
then
--
1.9.3
^ permalink raw reply related [flat|nested] 21+ messages in thread
* Re: [Qemu-devel] [PATCH v3 4/7] iotests: Source common.env
2014-05-22 21:30 ` [Qemu-devel] [PATCH v3 4/7] iotests: Source common.env Max Reitz
@ 2014-05-23 4:01 ` Fam Zheng
2014-05-24 20:18 ` Max Reitz
0 siblings, 1 reply; 21+ messages in thread
From: Fam Zheng @ 2014-05-23 4:01 UTC (permalink / raw)
To: Max Reitz
Cc: Kevin Wolf, Peter Maydell, qemu-devel, Stefan Hajnoczi,
Markus Armbruster
On Thu, 05/22 23:30, Max Reitz wrote:
> Source common.env in the iotests' check script. If the one supposed to
> be created by configure cannot be found, use common.env.default from the
> source tree.
>
> Signed-off-by: Max Reitz <mreitz@redhat.com>
> ---
> tests/qemu-iotests/check | 16 ++++++++++++++++
> 1 file changed, 16 insertions(+)
>
> diff --git a/tests/qemu-iotests/check b/tests/qemu-iotests/check
> index bd917a1..8ec5b8d 100755
> --- a/tests/qemu-iotests/check
> +++ b/tests/qemu-iotests/check
> @@ -103,6 +103,22 @@ then
> export QEMU_NBD_PROG="$build_root/qemu-nbd"
> fi
>
> +# we need common.env
> +if [ -n "$build_iotests" ]
$build_iotests is always set in patch 1, so you don't need this if.
Fam
> +then
> + configured_common_env="$build_iotests/common.env"
> +else
> + configured_common_env="$source_iotests/common.env"
> +fi
> +
> +if ! . "$configured_common_env"
> +then
> + if ! . "$source_iotests/common.env.default"
> + then
> + _init_error "failed to source common.env"
> + fi
> +fi
> +
> # we need common.config
> if ! . "$source_iotests/common.config"
> then
> --
> 1.9.3
>
>
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [Qemu-devel] [PATCH v3 4/7] iotests: Source common.env
2014-05-23 4:01 ` Fam Zheng
@ 2014-05-24 20:18 ` Max Reitz
0 siblings, 0 replies; 21+ messages in thread
From: Max Reitz @ 2014-05-24 20:18 UTC (permalink / raw)
To: Fam Zheng
Cc: Kevin Wolf, Peter Maydell, qemu-devel, Stefan Hajnoczi,
Markus Armbruster
On 23.05.2014 06:01, Fam Zheng wrote:
> On Thu, 05/22 23:30, Max Reitz wrote:
>> Source common.env in the iotests' check script. If the one supposed to
>> be created by configure cannot be found, use common.env.default from the
>> source tree.
>>
>> Signed-off-by: Max Reitz <mreitz@redhat.com>
>> ---
>> tests/qemu-iotests/check | 16 ++++++++++++++++
>> 1 file changed, 16 insertions(+)
>>
>> diff --git a/tests/qemu-iotests/check b/tests/qemu-iotests/check
>> index bd917a1..8ec5b8d 100755
>> --- a/tests/qemu-iotests/check
>> +++ b/tests/qemu-iotests/check
>> @@ -103,6 +103,22 @@ then
>> export QEMU_NBD_PROG="$build_root/qemu-nbd"
>> fi
>>
>> +# we need common.env
>> +if [ -n "$build_iotests" ]
> $build_iotests is always set in patch 1, so you don't need this if.
Right, I forgot to update this in v3.
Thanks,
Max
> Fam
>
>> +then
>> + configured_common_env="$build_iotests/common.env"
>> +else
>> + configured_common_env="$source_iotests/common.env"
>> +fi
>> +
>> +if ! . "$configured_common_env"
>> +then
>> + if ! . "$source_iotests/common.env.default"
>> + then
>> + _init_error "failed to source common.env"
>> + fi
>> +fi
>> +
>> # we need common.config
>> if ! . "$source_iotests/common.config"
>> then
>> --
>> 1.9.3
>>
>>
^ permalink raw reply [flat|nested] 21+ messages in thread
* [Qemu-devel] [PATCH v3 5/7] iotests: Use $PYTHON for Python scripts
2014-05-22 21:30 [Qemu-devel] [PATCH v3 0/7] iotests: Allow out-of-tree run Max Reitz
` (3 preceding siblings ...)
2014-05-22 21:30 ` [Qemu-devel] [PATCH v3 4/7] iotests: Source common.env Max Reitz
@ 2014-05-22 21:30 ` Max Reitz
2014-05-23 3:58 ` Fam Zheng
2014-05-22 21:30 ` [Qemu-devel] [PATCH v3 6/7] iotests: Drop Python version from 065's Shebang Max Reitz
` (2 subsequent siblings)
7 siblings, 1 reply; 21+ messages in thread
From: Max Reitz @ 2014-05-22 21:30 UTC (permalink / raw)
To: qemu-devel
Cc: Kevin Wolf, Peter Maydell, Markus Armbruster, Max Reitz,
Stefan Hajnoczi
Instead of invoking Python scripts directly via ./, use $PYTHON to
obtain the correct Python interpreter command.
Signed-off-by: Max Reitz <mreitz@redhat.com>
---
tests/qemu-iotests/031 | 8 ++++----
tests/qemu-iotests/036 | 6 +++---
tests/qemu-iotests/039 | 18 +++++++++---------
tests/qemu-iotests/054 | 2 +-
tests/qemu-iotests/060 | 20 ++++++++++----------
tests/qemu-iotests/061 | 24 ++++++++++++------------
tests/qemu-iotests/083 | 2 +-
tests/qemu-iotests/check | 8 +++++++-
8 files changed, 47 insertions(+), 41 deletions(-)
diff --git a/tests/qemu-iotests/031 b/tests/qemu-iotests/031
index 1d920ea..2a77ba8 100755
--- a/tests/qemu-iotests/031
+++ b/tests/qemu-iotests/031
@@ -56,22 +56,22 @@ for IMGOPTS in "compat=0.10" "compat=1.1"; do
echo === Create image with unknown header extension ===
echo
_make_test_img 64M
- ./qcow2.py "$TEST_IMG" add-header-ext 0x12345678 "This is a test header extension"
- ./qcow2.py "$TEST_IMG" dump-header
+ $PYTHON qcow2.py "$TEST_IMG" add-header-ext 0x12345678 "This is a test header extension"
+ $PYTHON qcow2.py "$TEST_IMG" dump-header
_check_test_img
echo
echo === Rewrite header with no backing file ===
echo
$QEMU_IMG rebase -u -b "" "$TEST_IMG"
- ./qcow2.py "$TEST_IMG" dump-header
+ $PYTHON qcow2.py "$TEST_IMG" dump-header
_check_test_img
echo
echo === Add a backing file and format ===
echo
$QEMU_IMG rebase -u -b "/some/backing/file/path" -F host_device "$TEST_IMG"
- ./qcow2.py "$TEST_IMG" dump-header
+ $PYTHON qcow2.py "$TEST_IMG" dump-header
done
# success, all done
diff --git a/tests/qemu-iotests/036 b/tests/qemu-iotests/036
index 03b6aa9..a773653 100755
--- a/tests/qemu-iotests/036
+++ b/tests/qemu-iotests/036
@@ -53,15 +53,15 @@ IMGOPTS="compat=1.1"
echo === Create image with unknown autoclear feature bit ===
echo
_make_test_img 64M
-./qcow2.py "$TEST_IMG" set-feature-bit autoclear 63
-./qcow2.py "$TEST_IMG" dump-header
+$PYTHON qcow2.py "$TEST_IMG" set-feature-bit autoclear 63
+$PYTHON qcow2.py "$TEST_IMG" dump-header
echo
echo === Repair image ===
echo
_check_test_img -r all
-./qcow2.py "$TEST_IMG" dump-header
+$PYTHON qcow2.py "$TEST_IMG" dump-header
# success, all done
echo "*** done"
diff --git a/tests/qemu-iotests/039 b/tests/qemu-iotests/039
index 27fe4bd..84c9167 100755
--- a/tests/qemu-iotests/039
+++ b/tests/qemu-iotests/039
@@ -63,7 +63,7 @@ _make_test_img $size
$QEMU_IO -c "write -P 0x5a 0 512" "$TEST_IMG" | _filter_qemu_io
# The dirty bit must not be set
-./qcow2.py "$TEST_IMG" dump-header | grep incompatible_features
+$PYTHON qcow2.py "$TEST_IMG" dump-header | grep incompatible_features
_check_test_img
echo
@@ -75,7 +75,7 @@ _make_test_img $size
_no_dump_exec $QEMU_IO -c "write -P 0x5a 0 512" -c "abort" "$TEST_IMG" 2>&1 | _filter_qemu_io
# The dirty bit must be set
-./qcow2.py "$TEST_IMG" dump-header | grep incompatible_features
+$PYTHON qcow2.py "$TEST_IMG" dump-header | grep incompatible_features
_check_test_img
echo
@@ -84,7 +84,7 @@ echo "== Read-only access must still work =="
$QEMU_IO -r -c "read -P 0x5a 0 512" "$TEST_IMG" | _filter_qemu_io
# The dirty bit must be set
-./qcow2.py "$TEST_IMG" dump-header | grep incompatible_features
+$PYTHON qcow2.py "$TEST_IMG" dump-header | grep incompatible_features
echo
echo "== Repairing the image file must succeed =="
@@ -92,7 +92,7 @@ echo "== Repairing the image file must succeed =="
_check_test_img -r all
# The dirty bit must not be set
-./qcow2.py "$TEST_IMG" dump-header | grep incompatible_features
+$PYTHON qcow2.py "$TEST_IMG" dump-header | grep incompatible_features
echo
echo "== Data should still be accessible after repair =="
@@ -108,12 +108,12 @@ _make_test_img $size
_no_dump_exec $QEMU_IO -c "write -P 0x5a 0 512" -c "abort" "$TEST_IMG" 2>&1 | _filter_qemu_io
# The dirty bit must be set
-./qcow2.py "$TEST_IMG" dump-header | grep incompatible_features
+$PYTHON qcow2.py "$TEST_IMG" dump-header | grep incompatible_features
$QEMU_IO -c "write 0 512" "$TEST_IMG" | _filter_qemu_io
# The dirty bit must not be set
-./qcow2.py "$TEST_IMG" dump-header | grep incompatible_features
+$PYTHON qcow2.py "$TEST_IMG" dump-header | grep incompatible_features
echo
echo "== Creating an image file with lazy_refcounts=off =="
@@ -124,7 +124,7 @@ _make_test_img $size
_no_dump_exec $QEMU_IO -c "write -P 0x5a 0 512" -c "abort" "$TEST_IMG" 2>&1 | _filter_qemu_io
# The dirty bit must not be set since lazy_refcounts=off
-./qcow2.py "$TEST_IMG" dump-header | grep incompatible_features
+$PYTHON qcow2.py "$TEST_IMG" dump-header | grep incompatible_features
_check_test_img
echo
@@ -140,8 +140,8 @@ $QEMU_IO -c "write 0 512" "$TEST_IMG" | _filter_qemu_io
$QEMU_IMG commit "$TEST_IMG"
# The dirty bit must not be set
-./qcow2.py "$TEST_IMG" dump-header | grep incompatible_features
-./qcow2.py "$TEST_IMG".base dump-header | grep incompatible_features
+$PYTHON qcow2.py "$TEST_IMG" dump-header | grep incompatible_features
+$PYTHON qcow2.py "$TEST_IMG".base dump-header | grep incompatible_features
_check_test_img
TEST_IMG="$TEST_IMG".base _check_test_img
diff --git a/tests/qemu-iotests/054 b/tests/qemu-iotests/054
index c8b7082..bd94153 100755
--- a/tests/qemu-iotests/054
+++ b/tests/qemu-iotests/054
@@ -49,7 +49,7 @@ _make_test_img $((1024*1024))T
echo
echo "creating too large image (1 EB) using qcow2.py"
_make_test_img 4G
-./qcow2.py "$TEST_IMG" set-header size $((1024 ** 6))
+$PYTHON qcow2.py "$TEST_IMG" set-header size $((1024 ** 6))
_check_test_img
# success, all done
diff --git a/tests/qemu-iotests/060 b/tests/qemu-iotests/060
index f0116aa..3cffc12 100755
--- a/tests/qemu-iotests/060
+++ b/tests/qemu-iotests/060
@@ -68,13 +68,13 @@ poke_file "$TEST_IMG" "$l1_offset" "\x80\x00\x00\x00\x00\x03\x00\x00"
_check_test_img
# The corrupt bit should not be set anyway
-./qcow2.py "$TEST_IMG" dump-header | grep incompatible_features
+$PYTHON qcow2.py "$TEST_IMG" dump-header | grep incompatible_features
# Try to write something, thereby forcing the corrupt bit to be set
$QEMU_IO -c "$OPEN_RW" -c "write -P 0x2a 0 512" | _filter_qemu_io
# The corrupt bit must now be set
-./qcow2.py "$TEST_IMG" dump-header | grep incompatible_features
+$PYTHON qcow2.py "$TEST_IMG" dump-header | grep incompatible_features
# Try to open the image R/W (which should fail)
$QEMU_IO -c "$OPEN_RW" -c "read 0 512" 2>&1 | _filter_qemu_io \
@@ -99,19 +99,19 @@ poke_file "$TEST_IMG" "$(($rb_offset+8))" "\x00\x01"
# Redirect new data cluster onto refcount block
poke_file "$TEST_IMG" "$l2_offset" "\x80\x00\x00\x00\x00\x02\x00\x00"
_check_test_img
-./qcow2.py "$TEST_IMG" dump-header | grep incompatible_features
+$PYTHON qcow2.py "$TEST_IMG" dump-header | grep incompatible_features
$QEMU_IO -c "$OPEN_RW" -c "write -P 0x2a 0 512" | _filter_qemu_io
-./qcow2.py "$TEST_IMG" dump-header | grep incompatible_features
+$PYTHON qcow2.py "$TEST_IMG" dump-header | grep incompatible_features
# Try to fix it
_check_test_img -r all
# The corrupt bit should be cleared
-./qcow2.py "$TEST_IMG" dump-header | grep incompatible_features
+$PYTHON qcow2.py "$TEST_IMG" dump-header | grep incompatible_features
# Look if it's really really fixed
$QEMU_IO -c "$OPEN_RW" -c "write -P 0x2a 0 512" | _filter_qemu_io
-./qcow2.py "$TEST_IMG" dump-header | grep incompatible_features
+$PYTHON qcow2.py "$TEST_IMG" dump-header | grep incompatible_features
echo
echo "=== Testing cluster data reference into inactive L2 table ==="
@@ -124,13 +124,13 @@ $QEMU_IO -c "$OPEN_RW" -c "write -P 2 0 512" | _filter_qemu_io
poke_file "$TEST_IMG" "$l2_offset_after_snapshot" \
"\x80\x00\x00\x00\x00\x04\x00\x00"
_check_test_img
-./qcow2.py "$TEST_IMG" dump-header | grep incompatible_features
+$PYTHON qcow2.py "$TEST_IMG" dump-header | grep incompatible_features
$QEMU_IO -c "$OPEN_RW" -c "write -P 3 0 512" | _filter_qemu_io
-./qcow2.py "$TEST_IMG" dump-header | grep incompatible_features
+$PYTHON qcow2.py "$TEST_IMG" dump-header | grep incompatible_features
_check_test_img -r all
-./qcow2.py "$TEST_IMG" dump-header | grep incompatible_features
+$PYTHON qcow2.py "$TEST_IMG" dump-header | grep incompatible_features
$QEMU_IO -c "$OPEN_RW" -c "write -P 4 0 512" | _filter_qemu_io
-./qcow2.py "$TEST_IMG" dump-header | grep incompatible_features
+$PYTHON qcow2.py "$TEST_IMG" dump-header | grep incompatible_features
# Check data
$QEMU_IO -c "$OPEN_RO" -c "read -P 4 0 512" | _filter_qemu_io
diff --git a/tests/qemu-iotests/061 b/tests/qemu-iotests/061
index d3a6b38..ab98def 100755
--- a/tests/qemu-iotests/061
+++ b/tests/qemu-iotests/061
@@ -48,9 +48,9 @@ echo "=== Testing version downgrade with zero expansion ==="
echo
IMGOPTS="compat=1.1,lazy_refcounts=on" _make_test_img 64M
$QEMU_IO -c "write -z 0 128k" "$TEST_IMG" | _filter_qemu_io
-./qcow2.py "$TEST_IMG" dump-header
+$PYTHON qcow2.py "$TEST_IMG" dump-header
$QEMU_IMG amend -o "compat=0.10" "$TEST_IMG"
-./qcow2.py "$TEST_IMG" dump-header
+$PYTHON qcow2.py "$TEST_IMG" dump-header
$QEMU_IO -c "read -P 0 0 128k" "$TEST_IMG" | _filter_qemu_io
_check_test_img
@@ -59,9 +59,9 @@ echo "=== Testing dirty version downgrade ==="
echo
IMGOPTS="compat=1.1,lazy_refcounts=on" _make_test_img 64M
$QEMU_IO -c "write -P 0x2a 0 128k" -c flush -c abort "$TEST_IMG" | _filter_qemu_io
-./qcow2.py "$TEST_IMG" dump-header
+$PYTHON qcow2.py "$TEST_IMG" dump-header
$QEMU_IMG amend -o "compat=0.10" "$TEST_IMG"
-./qcow2.py "$TEST_IMG" dump-header
+$PYTHON qcow2.py "$TEST_IMG" dump-header
$QEMU_IO -c "read -P 0x2a 0 128k" "$TEST_IMG" | _filter_qemu_io
_check_test_img
@@ -69,11 +69,11 @@ echo
echo "=== Testing version downgrade with unknown compat/autoclear flags ==="
echo
IMGOPTS="compat=1.1" _make_test_img 64M
-./qcow2.py "$TEST_IMG" set-feature-bit compatible 42
-./qcow2.py "$TEST_IMG" set-feature-bit autoclear 42
-./qcow2.py "$TEST_IMG" dump-header
+$PYTHON qcow2.py "$TEST_IMG" set-feature-bit compatible 42
+$PYTHON qcow2.py "$TEST_IMG" set-feature-bit autoclear 42
+$PYTHON qcow2.py "$TEST_IMG" dump-header
$QEMU_IMG amend -o "compat=0.10" "$TEST_IMG"
-./qcow2.py "$TEST_IMG" dump-header
+$PYTHON qcow2.py "$TEST_IMG" dump-header
_check_test_img
echo
@@ -81,9 +81,9 @@ echo "=== Testing version upgrade and resize ==="
echo
IMGOPTS="compat=0.10" _make_test_img 64M
$QEMU_IO -c "write -P 0x2a 42M 64k" "$TEST_IMG" | _filter_qemu_io
-./qcow2.py "$TEST_IMG" dump-header
+$PYTHON qcow2.py "$TEST_IMG" dump-header
$QEMU_IMG amend -o "compat=1.1,lazy_refcounts=on,size=128M" "$TEST_IMG"
-./qcow2.py "$TEST_IMG" dump-header
+$PYTHON qcow2.py "$TEST_IMG" dump-header
$QEMU_IO -c "read -P 0x2a 42M 64k" "$TEST_IMG" | _filter_qemu_io
_check_test_img
@@ -92,9 +92,9 @@ echo "=== Testing dirty lazy_refcounts=off ==="
echo
IMGOPTS="compat=1.1,lazy_refcounts=on" _make_test_img 64M
$QEMU_IO -c "write -P 0x2a 0 128k" -c flush -c abort "$TEST_IMG" | _filter_qemu_io
-./qcow2.py "$TEST_IMG" dump-header
+$PYTHON qcow2.py "$TEST_IMG" dump-header
$QEMU_IMG amend -o "lazy_refcounts=off" "$TEST_IMG"
-./qcow2.py "$TEST_IMG" dump-header
+$PYTHON qcow2.py "$TEST_IMG" dump-header
$QEMU_IO -c "read -P 0x2a 0 128k" "$TEST_IMG" | _filter_qemu_io
_check_test_img
diff --git a/tests/qemu-iotests/083 b/tests/qemu-iotests/083
index f764534..b7ba860 100755
--- a/tests/qemu-iotests/083
+++ b/tests/qemu-iotests/083
@@ -81,7 +81,7 @@ EOF
nbd_url="nbd:127.0.0.1:$port:exportname=foo"
fi
- ./nbd-fault-injector.py $extra_args "127.0.0.1:$port" "$TEST_DIR/nbd-fault-injector.conf" 2>&1 >/dev/null &
+ $PYTHON nbd-fault-injector.py $extra_args "127.0.0.1:$port" "$TEST_DIR/nbd-fault-injector.conf" 2>&1 >/dev/null &
wait_for_tcp_port "127.0.0.1:$port"
$QEMU_IO -c "read 0 512" "$nbd_url" 2>&1 | _filter_qemu_io | filter_nbd
diff --git a/tests/qemu-iotests/check b/tests/qemu-iotests/check
index 8ec5b8d..8420bd6 100755
--- a/tests/qemu-iotests/check
+++ b/tests/qemu-iotests/check
@@ -298,10 +298,16 @@ do
start=`_wallclock`
$timestamp && echo -n " ["`date "+%T"`"]"
+
+ if [ "$(head -n 1 "$source_iotests/$seq")" == "#!/usr/bin/env python" ]; then
+ run_command="$PYTHON $seq"
+ else
+ run_command="./$seq"
+ fi
export OUTPUT_DIR=$PWD
(cd "$source_iotests";
MALLOC_PERTURB_=${MALLOC_PERTURB_:-$(($RANDOM % 255 + 1))} \
- ./$seq >$tmp.out 2>&1)
+ $run_command >$tmp.out 2>&1)
sts=$?
$timestamp && _timestamp
stop=`_wallclock`
--
1.9.3
^ permalink raw reply related [flat|nested] 21+ messages in thread
* Re: [Qemu-devel] [PATCH v3 5/7] iotests: Use $PYTHON for Python scripts
2014-05-22 21:30 ` [Qemu-devel] [PATCH v3 5/7] iotests: Use $PYTHON for Python scripts Max Reitz
@ 2014-05-23 3:58 ` Fam Zheng
2014-05-24 19:35 ` Max Reitz
0 siblings, 1 reply; 21+ messages in thread
From: Fam Zheng @ 2014-05-23 3:58 UTC (permalink / raw)
To: Max Reitz
Cc: Kevin Wolf, Peter Maydell, qemu-devel, Stefan Hajnoczi,
Markus Armbruster
On Thu, 05/22 23:30, Max Reitz wrote:
> Instead of invoking Python scripts directly via ./, use $PYTHON to
> obtain the correct Python interpreter command.
>
> Signed-off-by: Max Reitz <mreitz@redhat.com>
> ---
> tests/qemu-iotests/031 | 8 ++++----
> tests/qemu-iotests/036 | 6 +++---
> tests/qemu-iotests/039 | 18 +++++++++---------
> tests/qemu-iotests/054 | 2 +-
> tests/qemu-iotests/060 | 20 ++++++++++----------
> tests/qemu-iotests/061 | 24 ++++++++++++------------
> tests/qemu-iotests/083 | 2 +-
> tests/qemu-iotests/check | 8 +++++++-
> 8 files changed, 47 insertions(+), 41 deletions(-)
>
> diff --git a/tests/qemu-iotests/031 b/tests/qemu-iotests/031
> index 1d920ea..2a77ba8 100755
> --- a/tests/qemu-iotests/031
> +++ b/tests/qemu-iotests/031
> @@ -56,22 +56,22 @@ for IMGOPTS in "compat=0.10" "compat=1.1"; do
> echo === Create image with unknown header extension ===
> echo
> _make_test_img 64M
> - ./qcow2.py "$TEST_IMG" add-header-ext 0x12345678 "This is a test header extension"
> - ./qcow2.py "$TEST_IMG" dump-header
> + $PYTHON qcow2.py "$TEST_IMG" add-header-ext 0x12345678 "This is a test header extension"
> + $PYTHON qcow2.py "$TEST_IMG" dump-header
> _check_test_img
>
> echo
> echo === Rewrite header with no backing file ===
> echo
> $QEMU_IMG rebase -u -b "" "$TEST_IMG"
> - ./qcow2.py "$TEST_IMG" dump-header
> + $PYTHON qcow2.py "$TEST_IMG" dump-header
> _check_test_img
>
> echo
> echo === Add a backing file and format ===
> echo
> $QEMU_IMG rebase -u -b "/some/backing/file/path" -F host_device "$TEST_IMG"
> - ./qcow2.py "$TEST_IMG" dump-header
> + $PYTHON qcow2.py "$TEST_IMG" dump-header
> done
>
> # success, all done
> diff --git a/tests/qemu-iotests/036 b/tests/qemu-iotests/036
> index 03b6aa9..a773653 100755
> --- a/tests/qemu-iotests/036
> +++ b/tests/qemu-iotests/036
> @@ -53,15 +53,15 @@ IMGOPTS="compat=1.1"
> echo === Create image with unknown autoclear feature bit ===
> echo
> _make_test_img 64M
> -./qcow2.py "$TEST_IMG" set-feature-bit autoclear 63
> -./qcow2.py "$TEST_IMG" dump-header
> +$PYTHON qcow2.py "$TEST_IMG" set-feature-bit autoclear 63
> +$PYTHON qcow2.py "$TEST_IMG" dump-header
>
> echo
> echo === Repair image ===
> echo
> _check_test_img -r all
>
> -./qcow2.py "$TEST_IMG" dump-header
> +$PYTHON qcow2.py "$TEST_IMG" dump-header
>
> # success, all done
> echo "*** done"
> diff --git a/tests/qemu-iotests/039 b/tests/qemu-iotests/039
> index 27fe4bd..84c9167 100755
> --- a/tests/qemu-iotests/039
> +++ b/tests/qemu-iotests/039
> @@ -63,7 +63,7 @@ _make_test_img $size
> $QEMU_IO -c "write -P 0x5a 0 512" "$TEST_IMG" | _filter_qemu_io
>
> # The dirty bit must not be set
> -./qcow2.py "$TEST_IMG" dump-header | grep incompatible_features
> +$PYTHON qcow2.py "$TEST_IMG" dump-header | grep incompatible_features
> _check_test_img
>
> echo
> @@ -75,7 +75,7 @@ _make_test_img $size
> _no_dump_exec $QEMU_IO -c "write -P 0x5a 0 512" -c "abort" "$TEST_IMG" 2>&1 | _filter_qemu_io
>
> # The dirty bit must be set
> -./qcow2.py "$TEST_IMG" dump-header | grep incompatible_features
> +$PYTHON qcow2.py "$TEST_IMG" dump-header | grep incompatible_features
> _check_test_img
>
> echo
> @@ -84,7 +84,7 @@ echo "== Read-only access must still work =="
> $QEMU_IO -r -c "read -P 0x5a 0 512" "$TEST_IMG" | _filter_qemu_io
>
> # The dirty bit must be set
> -./qcow2.py "$TEST_IMG" dump-header | grep incompatible_features
> +$PYTHON qcow2.py "$TEST_IMG" dump-header | grep incompatible_features
>
> echo
> echo "== Repairing the image file must succeed =="
> @@ -92,7 +92,7 @@ echo "== Repairing the image file must succeed =="
> _check_test_img -r all
>
> # The dirty bit must not be set
> -./qcow2.py "$TEST_IMG" dump-header | grep incompatible_features
> +$PYTHON qcow2.py "$TEST_IMG" dump-header | grep incompatible_features
>
> echo
> echo "== Data should still be accessible after repair =="
> @@ -108,12 +108,12 @@ _make_test_img $size
> _no_dump_exec $QEMU_IO -c "write -P 0x5a 0 512" -c "abort" "$TEST_IMG" 2>&1 | _filter_qemu_io
>
> # The dirty bit must be set
> -./qcow2.py "$TEST_IMG" dump-header | grep incompatible_features
> +$PYTHON qcow2.py "$TEST_IMG" dump-header | grep incompatible_features
>
> $QEMU_IO -c "write 0 512" "$TEST_IMG" | _filter_qemu_io
>
> # The dirty bit must not be set
> -./qcow2.py "$TEST_IMG" dump-header | grep incompatible_features
> +$PYTHON qcow2.py "$TEST_IMG" dump-header | grep incompatible_features
>
> echo
> echo "== Creating an image file with lazy_refcounts=off =="
> @@ -124,7 +124,7 @@ _make_test_img $size
> _no_dump_exec $QEMU_IO -c "write -P 0x5a 0 512" -c "abort" "$TEST_IMG" 2>&1 | _filter_qemu_io
>
> # The dirty bit must not be set since lazy_refcounts=off
> -./qcow2.py "$TEST_IMG" dump-header | grep incompatible_features
> +$PYTHON qcow2.py "$TEST_IMG" dump-header | grep incompatible_features
> _check_test_img
>
> echo
> @@ -140,8 +140,8 @@ $QEMU_IO -c "write 0 512" "$TEST_IMG" | _filter_qemu_io
> $QEMU_IMG commit "$TEST_IMG"
>
> # The dirty bit must not be set
> -./qcow2.py "$TEST_IMG" dump-header | grep incompatible_features
> -./qcow2.py "$TEST_IMG".base dump-header | grep incompatible_features
> +$PYTHON qcow2.py "$TEST_IMG" dump-header | grep incompatible_features
> +$PYTHON qcow2.py "$TEST_IMG".base dump-header | grep incompatible_features
>
> _check_test_img
> TEST_IMG="$TEST_IMG".base _check_test_img
> diff --git a/tests/qemu-iotests/054 b/tests/qemu-iotests/054
> index c8b7082..bd94153 100755
> --- a/tests/qemu-iotests/054
> +++ b/tests/qemu-iotests/054
> @@ -49,7 +49,7 @@ _make_test_img $((1024*1024))T
> echo
> echo "creating too large image (1 EB) using qcow2.py"
> _make_test_img 4G
> -./qcow2.py "$TEST_IMG" set-header size $((1024 ** 6))
> +$PYTHON qcow2.py "$TEST_IMG" set-header size $((1024 ** 6))
> _check_test_img
>
> # success, all done
> diff --git a/tests/qemu-iotests/060 b/tests/qemu-iotests/060
> index f0116aa..3cffc12 100755
> --- a/tests/qemu-iotests/060
> +++ b/tests/qemu-iotests/060
> @@ -68,13 +68,13 @@ poke_file "$TEST_IMG" "$l1_offset" "\x80\x00\x00\x00\x00\x03\x00\x00"
> _check_test_img
>
> # The corrupt bit should not be set anyway
> -./qcow2.py "$TEST_IMG" dump-header | grep incompatible_features
> +$PYTHON qcow2.py "$TEST_IMG" dump-header | grep incompatible_features
>
> # Try to write something, thereby forcing the corrupt bit to be set
> $QEMU_IO -c "$OPEN_RW" -c "write -P 0x2a 0 512" | _filter_qemu_io
>
> # The corrupt bit must now be set
> -./qcow2.py "$TEST_IMG" dump-header | grep incompatible_features
> +$PYTHON qcow2.py "$TEST_IMG" dump-header | grep incompatible_features
>
> # Try to open the image R/W (which should fail)
> $QEMU_IO -c "$OPEN_RW" -c "read 0 512" 2>&1 | _filter_qemu_io \
> @@ -99,19 +99,19 @@ poke_file "$TEST_IMG" "$(($rb_offset+8))" "\x00\x01"
> # Redirect new data cluster onto refcount block
> poke_file "$TEST_IMG" "$l2_offset" "\x80\x00\x00\x00\x00\x02\x00\x00"
> _check_test_img
> -./qcow2.py "$TEST_IMG" dump-header | grep incompatible_features
> +$PYTHON qcow2.py "$TEST_IMG" dump-header | grep incompatible_features
> $QEMU_IO -c "$OPEN_RW" -c "write -P 0x2a 0 512" | _filter_qemu_io
> -./qcow2.py "$TEST_IMG" dump-header | grep incompatible_features
> +$PYTHON qcow2.py "$TEST_IMG" dump-header | grep incompatible_features
>
> # Try to fix it
> _check_test_img -r all
>
> # The corrupt bit should be cleared
> -./qcow2.py "$TEST_IMG" dump-header | grep incompatible_features
> +$PYTHON qcow2.py "$TEST_IMG" dump-header | grep incompatible_features
>
> # Look if it's really really fixed
> $QEMU_IO -c "$OPEN_RW" -c "write -P 0x2a 0 512" | _filter_qemu_io
> -./qcow2.py "$TEST_IMG" dump-header | grep incompatible_features
> +$PYTHON qcow2.py "$TEST_IMG" dump-header | grep incompatible_features
>
> echo
> echo "=== Testing cluster data reference into inactive L2 table ==="
> @@ -124,13 +124,13 @@ $QEMU_IO -c "$OPEN_RW" -c "write -P 2 0 512" | _filter_qemu_io
> poke_file "$TEST_IMG" "$l2_offset_after_snapshot" \
> "\x80\x00\x00\x00\x00\x04\x00\x00"
> _check_test_img
> -./qcow2.py "$TEST_IMG" dump-header | grep incompatible_features
> +$PYTHON qcow2.py "$TEST_IMG" dump-header | grep incompatible_features
> $QEMU_IO -c "$OPEN_RW" -c "write -P 3 0 512" | _filter_qemu_io
> -./qcow2.py "$TEST_IMG" dump-header | grep incompatible_features
> +$PYTHON qcow2.py "$TEST_IMG" dump-header | grep incompatible_features
> _check_test_img -r all
> -./qcow2.py "$TEST_IMG" dump-header | grep incompatible_features
> +$PYTHON qcow2.py "$TEST_IMG" dump-header | grep incompatible_features
> $QEMU_IO -c "$OPEN_RW" -c "write -P 4 0 512" | _filter_qemu_io
> -./qcow2.py "$TEST_IMG" dump-header | grep incompatible_features
> +$PYTHON qcow2.py "$TEST_IMG" dump-header | grep incompatible_features
>
> # Check data
> $QEMU_IO -c "$OPEN_RO" -c "read -P 4 0 512" | _filter_qemu_io
> diff --git a/tests/qemu-iotests/061 b/tests/qemu-iotests/061
> index d3a6b38..ab98def 100755
> --- a/tests/qemu-iotests/061
> +++ b/tests/qemu-iotests/061
> @@ -48,9 +48,9 @@ echo "=== Testing version downgrade with zero expansion ==="
> echo
> IMGOPTS="compat=1.1,lazy_refcounts=on" _make_test_img 64M
> $QEMU_IO -c "write -z 0 128k" "$TEST_IMG" | _filter_qemu_io
> -./qcow2.py "$TEST_IMG" dump-header
> +$PYTHON qcow2.py "$TEST_IMG" dump-header
> $QEMU_IMG amend -o "compat=0.10" "$TEST_IMG"
> -./qcow2.py "$TEST_IMG" dump-header
> +$PYTHON qcow2.py "$TEST_IMG" dump-header
> $QEMU_IO -c "read -P 0 0 128k" "$TEST_IMG" | _filter_qemu_io
> _check_test_img
>
> @@ -59,9 +59,9 @@ echo "=== Testing dirty version downgrade ==="
> echo
> IMGOPTS="compat=1.1,lazy_refcounts=on" _make_test_img 64M
> $QEMU_IO -c "write -P 0x2a 0 128k" -c flush -c abort "$TEST_IMG" | _filter_qemu_io
> -./qcow2.py "$TEST_IMG" dump-header
> +$PYTHON qcow2.py "$TEST_IMG" dump-header
> $QEMU_IMG amend -o "compat=0.10" "$TEST_IMG"
> -./qcow2.py "$TEST_IMG" dump-header
> +$PYTHON qcow2.py "$TEST_IMG" dump-header
> $QEMU_IO -c "read -P 0x2a 0 128k" "$TEST_IMG" | _filter_qemu_io
> _check_test_img
>
> @@ -69,11 +69,11 @@ echo
> echo "=== Testing version downgrade with unknown compat/autoclear flags ==="
> echo
> IMGOPTS="compat=1.1" _make_test_img 64M
> -./qcow2.py "$TEST_IMG" set-feature-bit compatible 42
> -./qcow2.py "$TEST_IMG" set-feature-bit autoclear 42
> -./qcow2.py "$TEST_IMG" dump-header
> +$PYTHON qcow2.py "$TEST_IMG" set-feature-bit compatible 42
> +$PYTHON qcow2.py "$TEST_IMG" set-feature-bit autoclear 42
> +$PYTHON qcow2.py "$TEST_IMG" dump-header
> $QEMU_IMG amend -o "compat=0.10" "$TEST_IMG"
> -./qcow2.py "$TEST_IMG" dump-header
> +$PYTHON qcow2.py "$TEST_IMG" dump-header
> _check_test_img
>
> echo
> @@ -81,9 +81,9 @@ echo "=== Testing version upgrade and resize ==="
> echo
> IMGOPTS="compat=0.10" _make_test_img 64M
> $QEMU_IO -c "write -P 0x2a 42M 64k" "$TEST_IMG" | _filter_qemu_io
> -./qcow2.py "$TEST_IMG" dump-header
> +$PYTHON qcow2.py "$TEST_IMG" dump-header
> $QEMU_IMG amend -o "compat=1.1,lazy_refcounts=on,size=128M" "$TEST_IMG"
> -./qcow2.py "$TEST_IMG" dump-header
> +$PYTHON qcow2.py "$TEST_IMG" dump-header
> $QEMU_IO -c "read -P 0x2a 42M 64k" "$TEST_IMG" | _filter_qemu_io
> _check_test_img
>
> @@ -92,9 +92,9 @@ echo "=== Testing dirty lazy_refcounts=off ==="
> echo
> IMGOPTS="compat=1.1,lazy_refcounts=on" _make_test_img 64M
> $QEMU_IO -c "write -P 0x2a 0 128k" -c flush -c abort "$TEST_IMG" | _filter_qemu_io
> -./qcow2.py "$TEST_IMG" dump-header
> +$PYTHON qcow2.py "$TEST_IMG" dump-header
> $QEMU_IMG amend -o "lazy_refcounts=off" "$TEST_IMG"
> -./qcow2.py "$TEST_IMG" dump-header
> +$PYTHON qcow2.py "$TEST_IMG" dump-header
> $QEMU_IO -c "read -P 0x2a 0 128k" "$TEST_IMG" | _filter_qemu_io
> _check_test_img
>
> diff --git a/tests/qemu-iotests/083 b/tests/qemu-iotests/083
> index f764534..b7ba860 100755
> --- a/tests/qemu-iotests/083
> +++ b/tests/qemu-iotests/083
> @@ -81,7 +81,7 @@ EOF
> nbd_url="nbd:127.0.0.1:$port:exportname=foo"
> fi
>
> - ./nbd-fault-injector.py $extra_args "127.0.0.1:$port" "$TEST_DIR/nbd-fault-injector.conf" 2>&1 >/dev/null &
> + $PYTHON nbd-fault-injector.py $extra_args "127.0.0.1:$port" "$TEST_DIR/nbd-fault-injector.conf" 2>&1 >/dev/null &
> wait_for_tcp_port "127.0.0.1:$port"
> $QEMU_IO -c "read 0 512" "$nbd_url" 2>&1 | _filter_qemu_io | filter_nbd
>
> diff --git a/tests/qemu-iotests/check b/tests/qemu-iotests/check
> index 8ec5b8d..8420bd6 100755
> --- a/tests/qemu-iotests/check
> +++ b/tests/qemu-iotests/check
> @@ -298,10 +298,16 @@ do
>
> start=`_wallclock`
> $timestamp && echo -n " ["`date "+%T"`"]"
> +
> + if [ "$(head -n 1 "$source_iotests/$seq")" == "#!/usr/bin/env python" ]; then
How about
if head -n 1 "$source_iotests/$seq" | grep -q '#!/usr/bin/env python'; then
? So you don't need patch 6 (Personally, I don't dislike #!/usr/bin/env
python2).
But no objection, so I'll leave my
Reviewed-by: Fam Zheng <famz@redhat.com>
> + run_command="$PYTHON $seq"
> + else
> + run_command="./$seq"
> + fi
> export OUTPUT_DIR=$PWD
> (cd "$source_iotests";
> MALLOC_PERTURB_=${MALLOC_PERTURB_:-$(($RANDOM % 255 + 1))} \
> - ./$seq >$tmp.out 2>&1)
> + $run_command >$tmp.out 2>&1)
> sts=$?
> $timestamp && _timestamp
> stop=`_wallclock`
> --
> 1.9.3
>
>
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [Qemu-devel] [PATCH v3 5/7] iotests: Use $PYTHON for Python scripts
2014-05-23 3:58 ` Fam Zheng
@ 2014-05-24 19:35 ` Max Reitz
0 siblings, 0 replies; 21+ messages in thread
From: Max Reitz @ 2014-05-24 19:35 UTC (permalink / raw)
To: Fam Zheng
Cc: Kevin Wolf, Peter Maydell, qemu-devel, Stefan Hajnoczi,
Markus Armbruster
On 23.05.2014 05:58, Fam Zheng wrote:
> On Thu, 05/22 23:30, Max Reitz wrote:
>> Instead of invoking Python scripts directly via ./, use $PYTHON to
>> obtain the correct Python interpreter command.
>>
>> Signed-off-by: Max Reitz <mreitz@redhat.com>
>> ---
>> tests/qemu-iotests/031 | 8 ++++----
>> tests/qemu-iotests/036 | 6 +++---
>> tests/qemu-iotests/039 | 18 +++++++++---------
>> tests/qemu-iotests/054 | 2 +-
>> tests/qemu-iotests/060 | 20 ++++++++++----------
>> tests/qemu-iotests/061 | 24 ++++++++++++------------
>> tests/qemu-iotests/083 | 2 +-
>> tests/qemu-iotests/check | 8 +++++++-
>> 8 files changed, 47 insertions(+), 41 deletions(-)
>>
>> diff --git a/tests/qemu-iotests/031 b/tests/qemu-iotests/031
>> index 1d920ea..2a77ba8 100755
>> --- a/tests/qemu-iotests/031
>> +++ b/tests/qemu-iotests/031
>> @@ -56,22 +56,22 @@ for IMGOPTS in "compat=0.10" "compat=1.1"; do
>> echo === Create image with unknown header extension ===
>> echo
>> _make_test_img 64M
>> - ./qcow2.py "$TEST_IMG" add-header-ext 0x12345678 "This is a test header extension"
>> - ./qcow2.py "$TEST_IMG" dump-header
>> + $PYTHON qcow2.py "$TEST_IMG" add-header-ext 0x12345678 "This is a test header extension"
>> + $PYTHON qcow2.py "$TEST_IMG" dump-header
>> _check_test_img
>>
>> echo
>> echo === Rewrite header with no backing file ===
>> echo
>> $QEMU_IMG rebase -u -b "" "$TEST_IMG"
>> - ./qcow2.py "$TEST_IMG" dump-header
>> + $PYTHON qcow2.py "$TEST_IMG" dump-header
>> _check_test_img
>>
>> echo
>> echo === Add a backing file and format ===
>> echo
>> $QEMU_IMG rebase -u -b "/some/backing/file/path" -F host_device "$TEST_IMG"
>> - ./qcow2.py "$TEST_IMG" dump-header
>> + $PYTHON qcow2.py "$TEST_IMG" dump-header
>> done
>>
>> # success, all done
>> diff --git a/tests/qemu-iotests/036 b/tests/qemu-iotests/036
>> index 03b6aa9..a773653 100755
>> --- a/tests/qemu-iotests/036
>> +++ b/tests/qemu-iotests/036
>> @@ -53,15 +53,15 @@ IMGOPTS="compat=1.1"
>> echo === Create image with unknown autoclear feature bit ===
>> echo
>> _make_test_img 64M
>> -./qcow2.py "$TEST_IMG" set-feature-bit autoclear 63
>> -./qcow2.py "$TEST_IMG" dump-header
>> +$PYTHON qcow2.py "$TEST_IMG" set-feature-bit autoclear 63
>> +$PYTHON qcow2.py "$TEST_IMG" dump-header
>>
>> echo
>> echo === Repair image ===
>> echo
>> _check_test_img -r all
>>
>> -./qcow2.py "$TEST_IMG" dump-header
>> +$PYTHON qcow2.py "$TEST_IMG" dump-header
>>
>> # success, all done
>> echo "*** done"
>> diff --git a/tests/qemu-iotests/039 b/tests/qemu-iotests/039
>> index 27fe4bd..84c9167 100755
>> --- a/tests/qemu-iotests/039
>> +++ b/tests/qemu-iotests/039
>> @@ -63,7 +63,7 @@ _make_test_img $size
>> $QEMU_IO -c "write -P 0x5a 0 512" "$TEST_IMG" | _filter_qemu_io
>>
>> # The dirty bit must not be set
>> -./qcow2.py "$TEST_IMG" dump-header | grep incompatible_features
>> +$PYTHON qcow2.py "$TEST_IMG" dump-header | grep incompatible_features
>> _check_test_img
>>
>> echo
>> @@ -75,7 +75,7 @@ _make_test_img $size
>> _no_dump_exec $QEMU_IO -c "write -P 0x5a 0 512" -c "abort" "$TEST_IMG" 2>&1 | _filter_qemu_io
>>
>> # The dirty bit must be set
>> -./qcow2.py "$TEST_IMG" dump-header | grep incompatible_features
>> +$PYTHON qcow2.py "$TEST_IMG" dump-header | grep incompatible_features
>> _check_test_img
>>
>> echo
>> @@ -84,7 +84,7 @@ echo "== Read-only access must still work =="
>> $QEMU_IO -r -c "read -P 0x5a 0 512" "$TEST_IMG" | _filter_qemu_io
>>
>> # The dirty bit must be set
>> -./qcow2.py "$TEST_IMG" dump-header | grep incompatible_features
>> +$PYTHON qcow2.py "$TEST_IMG" dump-header | grep incompatible_features
>>
>> echo
>> echo "== Repairing the image file must succeed =="
>> @@ -92,7 +92,7 @@ echo "== Repairing the image file must succeed =="
>> _check_test_img -r all
>>
>> # The dirty bit must not be set
>> -./qcow2.py "$TEST_IMG" dump-header | grep incompatible_features
>> +$PYTHON qcow2.py "$TEST_IMG" dump-header | grep incompatible_features
>>
>> echo
>> echo "== Data should still be accessible after repair =="
>> @@ -108,12 +108,12 @@ _make_test_img $size
>> _no_dump_exec $QEMU_IO -c "write -P 0x5a 0 512" -c "abort" "$TEST_IMG" 2>&1 | _filter_qemu_io
>>
>> # The dirty bit must be set
>> -./qcow2.py "$TEST_IMG" dump-header | grep incompatible_features
>> +$PYTHON qcow2.py "$TEST_IMG" dump-header | grep incompatible_features
>>
>> $QEMU_IO -c "write 0 512" "$TEST_IMG" | _filter_qemu_io
>>
>> # The dirty bit must not be set
>> -./qcow2.py "$TEST_IMG" dump-header | grep incompatible_features
>> +$PYTHON qcow2.py "$TEST_IMG" dump-header | grep incompatible_features
>>
>> echo
>> echo "== Creating an image file with lazy_refcounts=off =="
>> @@ -124,7 +124,7 @@ _make_test_img $size
>> _no_dump_exec $QEMU_IO -c "write -P 0x5a 0 512" -c "abort" "$TEST_IMG" 2>&1 | _filter_qemu_io
>>
>> # The dirty bit must not be set since lazy_refcounts=off
>> -./qcow2.py "$TEST_IMG" dump-header | grep incompatible_features
>> +$PYTHON qcow2.py "$TEST_IMG" dump-header | grep incompatible_features
>> _check_test_img
>>
>> echo
>> @@ -140,8 +140,8 @@ $QEMU_IO -c "write 0 512" "$TEST_IMG" | _filter_qemu_io
>> $QEMU_IMG commit "$TEST_IMG"
>>
>> # The dirty bit must not be set
>> -./qcow2.py "$TEST_IMG" dump-header | grep incompatible_features
>> -./qcow2.py "$TEST_IMG".base dump-header | grep incompatible_features
>> +$PYTHON qcow2.py "$TEST_IMG" dump-header | grep incompatible_features
>> +$PYTHON qcow2.py "$TEST_IMG".base dump-header | grep incompatible_features
>>
>> _check_test_img
>> TEST_IMG="$TEST_IMG".base _check_test_img
>> diff --git a/tests/qemu-iotests/054 b/tests/qemu-iotests/054
>> index c8b7082..bd94153 100755
>> --- a/tests/qemu-iotests/054
>> +++ b/tests/qemu-iotests/054
>> @@ -49,7 +49,7 @@ _make_test_img $((1024*1024))T
>> echo
>> echo "creating too large image (1 EB) using qcow2.py"
>> _make_test_img 4G
>> -./qcow2.py "$TEST_IMG" set-header size $((1024 ** 6))
>> +$PYTHON qcow2.py "$TEST_IMG" set-header size $((1024 ** 6))
>> _check_test_img
>>
>> # success, all done
>> diff --git a/tests/qemu-iotests/060 b/tests/qemu-iotests/060
>> index f0116aa..3cffc12 100755
>> --- a/tests/qemu-iotests/060
>> +++ b/tests/qemu-iotests/060
>> @@ -68,13 +68,13 @@ poke_file "$TEST_IMG" "$l1_offset" "\x80\x00\x00\x00\x00\x03\x00\x00"
>> _check_test_img
>>
>> # The corrupt bit should not be set anyway
>> -./qcow2.py "$TEST_IMG" dump-header | grep incompatible_features
>> +$PYTHON qcow2.py "$TEST_IMG" dump-header | grep incompatible_features
>>
>> # Try to write something, thereby forcing the corrupt bit to be set
>> $QEMU_IO -c "$OPEN_RW" -c "write -P 0x2a 0 512" | _filter_qemu_io
>>
>> # The corrupt bit must now be set
>> -./qcow2.py "$TEST_IMG" dump-header | grep incompatible_features
>> +$PYTHON qcow2.py "$TEST_IMG" dump-header | grep incompatible_features
>>
>> # Try to open the image R/W (which should fail)
>> $QEMU_IO -c "$OPEN_RW" -c "read 0 512" 2>&1 | _filter_qemu_io \
>> @@ -99,19 +99,19 @@ poke_file "$TEST_IMG" "$(($rb_offset+8))" "\x00\x01"
>> # Redirect new data cluster onto refcount block
>> poke_file "$TEST_IMG" "$l2_offset" "\x80\x00\x00\x00\x00\x02\x00\x00"
>> _check_test_img
>> -./qcow2.py "$TEST_IMG" dump-header | grep incompatible_features
>> +$PYTHON qcow2.py "$TEST_IMG" dump-header | grep incompatible_features
>> $QEMU_IO -c "$OPEN_RW" -c "write -P 0x2a 0 512" | _filter_qemu_io
>> -./qcow2.py "$TEST_IMG" dump-header | grep incompatible_features
>> +$PYTHON qcow2.py "$TEST_IMG" dump-header | grep incompatible_features
>>
>> # Try to fix it
>> _check_test_img -r all
>>
>> # The corrupt bit should be cleared
>> -./qcow2.py "$TEST_IMG" dump-header | grep incompatible_features
>> +$PYTHON qcow2.py "$TEST_IMG" dump-header | grep incompatible_features
>>
>> # Look if it's really really fixed
>> $QEMU_IO -c "$OPEN_RW" -c "write -P 0x2a 0 512" | _filter_qemu_io
>> -./qcow2.py "$TEST_IMG" dump-header | grep incompatible_features
>> +$PYTHON qcow2.py "$TEST_IMG" dump-header | grep incompatible_features
>>
>> echo
>> echo "=== Testing cluster data reference into inactive L2 table ==="
>> @@ -124,13 +124,13 @@ $QEMU_IO -c "$OPEN_RW" -c "write -P 2 0 512" | _filter_qemu_io
>> poke_file "$TEST_IMG" "$l2_offset_after_snapshot" \
>> "\x80\x00\x00\x00\x00\x04\x00\x00"
>> _check_test_img
>> -./qcow2.py "$TEST_IMG" dump-header | grep incompatible_features
>> +$PYTHON qcow2.py "$TEST_IMG" dump-header | grep incompatible_features
>> $QEMU_IO -c "$OPEN_RW" -c "write -P 3 0 512" | _filter_qemu_io
>> -./qcow2.py "$TEST_IMG" dump-header | grep incompatible_features
>> +$PYTHON qcow2.py "$TEST_IMG" dump-header | grep incompatible_features
>> _check_test_img -r all
>> -./qcow2.py "$TEST_IMG" dump-header | grep incompatible_features
>> +$PYTHON qcow2.py "$TEST_IMG" dump-header | grep incompatible_features
>> $QEMU_IO -c "$OPEN_RW" -c "write -P 4 0 512" | _filter_qemu_io
>> -./qcow2.py "$TEST_IMG" dump-header | grep incompatible_features
>> +$PYTHON qcow2.py "$TEST_IMG" dump-header | grep incompatible_features
>>
>> # Check data
>> $QEMU_IO -c "$OPEN_RO" -c "read -P 4 0 512" | _filter_qemu_io
>> diff --git a/tests/qemu-iotests/061 b/tests/qemu-iotests/061
>> index d3a6b38..ab98def 100755
>> --- a/tests/qemu-iotests/061
>> +++ b/tests/qemu-iotests/061
>> @@ -48,9 +48,9 @@ echo "=== Testing version downgrade with zero expansion ==="
>> echo
>> IMGOPTS="compat=1.1,lazy_refcounts=on" _make_test_img 64M
>> $QEMU_IO -c "write -z 0 128k" "$TEST_IMG" | _filter_qemu_io
>> -./qcow2.py "$TEST_IMG" dump-header
>> +$PYTHON qcow2.py "$TEST_IMG" dump-header
>> $QEMU_IMG amend -o "compat=0.10" "$TEST_IMG"
>> -./qcow2.py "$TEST_IMG" dump-header
>> +$PYTHON qcow2.py "$TEST_IMG" dump-header
>> $QEMU_IO -c "read -P 0 0 128k" "$TEST_IMG" | _filter_qemu_io
>> _check_test_img
>>
>> @@ -59,9 +59,9 @@ echo "=== Testing dirty version downgrade ==="
>> echo
>> IMGOPTS="compat=1.1,lazy_refcounts=on" _make_test_img 64M
>> $QEMU_IO -c "write -P 0x2a 0 128k" -c flush -c abort "$TEST_IMG" | _filter_qemu_io
>> -./qcow2.py "$TEST_IMG" dump-header
>> +$PYTHON qcow2.py "$TEST_IMG" dump-header
>> $QEMU_IMG amend -o "compat=0.10" "$TEST_IMG"
>> -./qcow2.py "$TEST_IMG" dump-header
>> +$PYTHON qcow2.py "$TEST_IMG" dump-header
>> $QEMU_IO -c "read -P 0x2a 0 128k" "$TEST_IMG" | _filter_qemu_io
>> _check_test_img
>>
>> @@ -69,11 +69,11 @@ echo
>> echo "=== Testing version downgrade with unknown compat/autoclear flags ==="
>> echo
>> IMGOPTS="compat=1.1" _make_test_img 64M
>> -./qcow2.py "$TEST_IMG" set-feature-bit compatible 42
>> -./qcow2.py "$TEST_IMG" set-feature-bit autoclear 42
>> -./qcow2.py "$TEST_IMG" dump-header
>> +$PYTHON qcow2.py "$TEST_IMG" set-feature-bit compatible 42
>> +$PYTHON qcow2.py "$TEST_IMG" set-feature-bit autoclear 42
>> +$PYTHON qcow2.py "$TEST_IMG" dump-header
>> $QEMU_IMG amend -o "compat=0.10" "$TEST_IMG"
>> -./qcow2.py "$TEST_IMG" dump-header
>> +$PYTHON qcow2.py "$TEST_IMG" dump-header
>> _check_test_img
>>
>> echo
>> @@ -81,9 +81,9 @@ echo "=== Testing version upgrade and resize ==="
>> echo
>> IMGOPTS="compat=0.10" _make_test_img 64M
>> $QEMU_IO -c "write -P 0x2a 42M 64k" "$TEST_IMG" | _filter_qemu_io
>> -./qcow2.py "$TEST_IMG" dump-header
>> +$PYTHON qcow2.py "$TEST_IMG" dump-header
>> $QEMU_IMG amend -o "compat=1.1,lazy_refcounts=on,size=128M" "$TEST_IMG"
>> -./qcow2.py "$TEST_IMG" dump-header
>> +$PYTHON qcow2.py "$TEST_IMG" dump-header
>> $QEMU_IO -c "read -P 0x2a 42M 64k" "$TEST_IMG" | _filter_qemu_io
>> _check_test_img
>>
>> @@ -92,9 +92,9 @@ echo "=== Testing dirty lazy_refcounts=off ==="
>> echo
>> IMGOPTS="compat=1.1,lazy_refcounts=on" _make_test_img 64M
>> $QEMU_IO -c "write -P 0x2a 0 128k" -c flush -c abort "$TEST_IMG" | _filter_qemu_io
>> -./qcow2.py "$TEST_IMG" dump-header
>> +$PYTHON qcow2.py "$TEST_IMG" dump-header
>> $QEMU_IMG amend -o "lazy_refcounts=off" "$TEST_IMG"
>> -./qcow2.py "$TEST_IMG" dump-header
>> +$PYTHON qcow2.py "$TEST_IMG" dump-header
>> $QEMU_IO -c "read -P 0x2a 0 128k" "$TEST_IMG" | _filter_qemu_io
>> _check_test_img
>>
>> diff --git a/tests/qemu-iotests/083 b/tests/qemu-iotests/083
>> index f764534..b7ba860 100755
>> --- a/tests/qemu-iotests/083
>> +++ b/tests/qemu-iotests/083
>> @@ -81,7 +81,7 @@ EOF
>> nbd_url="nbd:127.0.0.1:$port:exportname=foo"
>> fi
>>
>> - ./nbd-fault-injector.py $extra_args "127.0.0.1:$port" "$TEST_DIR/nbd-fault-injector.conf" 2>&1 >/dev/null &
>> + $PYTHON nbd-fault-injector.py $extra_args "127.0.0.1:$port" "$TEST_DIR/nbd-fault-injector.conf" 2>&1 >/dev/null &
>> wait_for_tcp_port "127.0.0.1:$port"
>> $QEMU_IO -c "read 0 512" "$nbd_url" 2>&1 | _filter_qemu_io | filter_nbd
>>
>> diff --git a/tests/qemu-iotests/check b/tests/qemu-iotests/check
>> index 8ec5b8d..8420bd6 100755
>> --- a/tests/qemu-iotests/check
>> +++ b/tests/qemu-iotests/check
>> @@ -298,10 +298,16 @@ do
>>
>> start=`_wallclock`
>> $timestamp && echo -n " ["`date "+%T"`"]"
>> +
>> + if [ "$(head -n 1 "$source_iotests/$seq")" == "#!/usr/bin/env python" ]; then
> How about
>
> if head -n 1 "$source_iotests/$seq" | grep -q '#!/usr/bin/env python'; then
>
> ? So you don't need patch 6 (Personally, I don't dislike #!/usr/bin/env
> python2).
I'll need patch 6 anyway. The original idea why this series exists in
the first place was that my main system (Arch) links /usr/bin/python to
python3, which breaks the I/O tests. Therefore, I wanted to make the I/O
tests always use python2 or, if possible, the Python version chosen by
configure. After my first attempt broke badly, I thought of replacing
all Shebangs by "#!/usr/bin/env python2" - but it turned out, Debian
normally does not provide /usr/bin/python2 (albeit having Python 2
itself). Therefore, I discarded that idea and wrote this series instead.
However, knowing this, it's better to "fix" the Shebang in test 065. On
the other hand, with this series we wouldn't have to, as the Shebang is
not actually used anyway. But I'd rather like to have it "valid" (which
means valid for Debian and invalid for Arch).
Max
> But no objection, so I'll leave my
>
> Reviewed-by: Fam Zheng <famz@redhat.com>
>
>> + run_command="$PYTHON $seq"
>> + else
>> + run_command="./$seq"
>> + fi
>> export OUTPUT_DIR=$PWD
>> (cd "$source_iotests";
>> MALLOC_PERTURB_=${MALLOC_PERTURB_:-$(($RANDOM % 255 + 1))} \
>> - ./$seq >$tmp.out 2>&1)
>> + $run_command >$tmp.out 2>&1)
>> sts=$?
>> $timestamp && _timestamp
>> stop=`_wallclock`
>> --
>> 1.9.3
>>
>>
^ permalink raw reply [flat|nested] 21+ messages in thread
* [Qemu-devel] [PATCH v3 6/7] iotests: Drop Python version from 065's Shebang
2014-05-22 21:30 [Qemu-devel] [PATCH v3 0/7] iotests: Allow out-of-tree run Max Reitz
` (4 preceding siblings ...)
2014-05-22 21:30 ` [Qemu-devel] [PATCH v3 5/7] iotests: Use $PYTHON for Python scripts Max Reitz
@ 2014-05-22 21:30 ` Max Reitz
2014-05-23 4:02 ` Fam Zheng
2014-05-22 21:30 ` [Qemu-devel] [PATCH v3 7/7] iotests: Fix 083 for out-of-tree builds Max Reitz
2014-05-22 21:35 ` [Qemu-devel] [PATCH v3 0/7] iotests: Allow out-of-tree run Max Reitz
7 siblings, 1 reply; 21+ messages in thread
From: Max Reitz @ 2014-05-22 21:30 UTC (permalink / raw)
To: qemu-devel
Cc: Kevin Wolf, Peter Maydell, Markus Armbruster, Max Reitz,
Stefan Hajnoczi
Test 065 specified python2 to be used in its Shebang; this might not
work on systems without a python2 symlink and furthermore it is now
counter-productive, as the check script compares the Shebang to
"#!/usr/bin/env python" and only uses the Python interpreter selected by
configure on an exact match.
Signed-off-by: Max Reitz <mreitz@redhat.com>
---
tests/qemu-iotests/065 | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tests/qemu-iotests/065 b/tests/qemu-iotests/065
index ab5445f..e89b61d 100755
--- a/tests/qemu-iotests/065
+++ b/tests/qemu-iotests/065
@@ -1,4 +1,4 @@
-#!/usr/bin/env python2
+#!/usr/bin/env python
#
# Test for additional information emitted by qemu-img info on qcow2
# images
--
1.9.3
^ permalink raw reply related [flat|nested] 21+ messages in thread
* Re: [Qemu-devel] [PATCH v3 6/7] iotests: Drop Python version from 065's Shebang
2014-05-22 21:30 ` [Qemu-devel] [PATCH v3 6/7] iotests: Drop Python version from 065's Shebang Max Reitz
@ 2014-05-23 4:02 ` Fam Zheng
0 siblings, 0 replies; 21+ messages in thread
From: Fam Zheng @ 2014-05-23 4:02 UTC (permalink / raw)
To: Max Reitz
Cc: Kevin Wolf, Peter Maydell, qemu-devel, Stefan Hajnoczi,
Markus Armbruster
On Thu, 05/22 23:30, Max Reitz wrote:
> Test 065 specified python2 to be used in its Shebang; this might not
> work on systems without a python2 symlink and furthermore it is now
> counter-productive, as the check script compares the Shebang to
> "#!/usr/bin/env python" and only uses the Python interpreter selected by
> configure on an exact match.
>
> Signed-off-by: Max Reitz <mreitz@redhat.com>
> ---
> tests/qemu-iotests/065 | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/tests/qemu-iotests/065 b/tests/qemu-iotests/065
> index ab5445f..e89b61d 100755
> --- a/tests/qemu-iotests/065
> +++ b/tests/qemu-iotests/065
> @@ -1,4 +1,4 @@
> -#!/usr/bin/env python2
> +#!/usr/bin/env python
> #
> # Test for additional information emitted by qemu-img info on qcow2
> # images
> --
> 1.9.3
>
>
If you decide to keep this patch (see my comments in 5/7),
Reviewed-by: Fam Zheng <famz@redhat.com>
^ permalink raw reply [flat|nested] 21+ messages in thread
* [Qemu-devel] [PATCH v3 7/7] iotests: Fix 083 for out-of-tree builds
2014-05-22 21:30 [Qemu-devel] [PATCH v3 0/7] iotests: Allow out-of-tree run Max Reitz
` (5 preceding siblings ...)
2014-05-22 21:30 ` [Qemu-devel] [PATCH v3 6/7] iotests: Drop Python version from 065's Shebang Max Reitz
@ 2014-05-22 21:30 ` Max Reitz
2014-05-22 21:35 ` [Qemu-devel] [PATCH v3 0/7] iotests: Allow out-of-tree run Max Reitz
7 siblings, 0 replies; 21+ messages in thread
From: Max Reitz @ 2014-05-22 21:30 UTC (permalink / raw)
To: qemu-devel
Cc: Kevin Wolf, Peter Maydell, Markus Armbruster, Max Reitz,
Stefan Hajnoczi
iotest 083 filters out debug messages from nbd, which are prefixed (and
recognized) by __FILE__. However, the current filter (/^nbd\.c…/) is
valid for in-tree builds only, as out-of-tree builds will have a path
before that filename (e.g. "/tmp/qemu/nbd.c"). Fix this by adding .*
before "nbd\.c".
While working on this, also fix the regexes: '.' should be escaped and a
single backslash is not enough for escaping when enclosed by double
quotes.
Signed-off-by: Max Reitz <mreitz@redhat.com>
---
tests/qemu-iotests/083 | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/tests/qemu-iotests/083 b/tests/qemu-iotests/083
index b7ba860..991a9d9 100755
--- a/tests/qemu-iotests/083
+++ b/tests/qemu-iotests/083
@@ -44,7 +44,7 @@ choose_tcp_port() {
wait_for_tcp_port() {
while ! (netstat --tcp --listening --numeric | \
- grep "$1.*0.0.0.0:\*.*LISTEN") 2>&1 >/dev/null; do
+ grep "$1.*0\\.0\\.0\\.0:\\*.*LISTEN") 2>&1 >/dev/null; do
sleep 0.1
done
}
@@ -55,8 +55,8 @@ filter_nbd() {
# callbacks sometimes, making them unreliable.
#
# Filter out the TCP port number since this changes between runs.
- sed -e 's#^nbd.c:.*##g' \
- -e 's#nbd:127.0.0.1:[^:]*:#nbd:127.0.0.1:PORT:#g'
+ sed -e 's#^.*nbd\.c:.*##g' \
+ -e 's#nbd:127\.0\.0\.1:[^:]*:#nbd:127\.0\.0\.1:PORT:#g'
}
check_disconnect() {
@@ -82,7 +82,7 @@ EOF
fi
$PYTHON nbd-fault-injector.py $extra_args "127.0.0.1:$port" "$TEST_DIR/nbd-fault-injector.conf" 2>&1 >/dev/null &
- wait_for_tcp_port "127.0.0.1:$port"
+ wait_for_tcp_port "127\\.0\\.0\\.1:$port"
$QEMU_IO -c "read 0 512" "$nbd_url" 2>&1 | _filter_qemu_io | filter_nbd
echo
--
1.9.3
^ permalink raw reply related [flat|nested] 21+ messages in thread
* Re: [Qemu-devel] [PATCH v3 0/7] iotests: Allow out-of-tree run
2014-05-22 21:30 [Qemu-devel] [PATCH v3 0/7] iotests: Allow out-of-tree run Max Reitz
` (6 preceding siblings ...)
2014-05-22 21:30 ` [Qemu-devel] [PATCH v3 7/7] iotests: Fix 083 for out-of-tree builds Max Reitz
@ 2014-05-22 21:35 ` Max Reitz
7 siblings, 0 replies; 21+ messages in thread
From: Max Reitz @ 2014-05-22 21:35 UTC (permalink / raw)
To: qemu-devel
Cc: Kevin Wolf, Peter Maydell, Fam Zheng, Markus Armbruster,
Stefan Hajnoczi
On 22.05.2014 23:30, Max Reitz wrote:
> This series enables qemu-iotests to be run in a build tree outside of
> the source tree. It also makes the tests use the command for invoking
> the Python interpreter specified through configure instead of always
> using "/usr/bin/env python".
>
>
> v3:
> - Patch 1:
> - assume in-tree build when run from the source tree [Fam]
> - if "./qemu", "./qemu-io" etc. exist, prefer them over automatic
> detection
> - 'for binary in "*-softmmu/qemu-system-*"' is not what we want, but
> rather 'for binary in *-softmmu/qemu-system-*'
Forgot to CC Fam, I hope he'll forgive me. :-)
Max
^ permalink raw reply [flat|nested] 21+ messages in thread