qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH 00/12] cleanup qemu-iotests
@ 2017-08-09 21:54 Paolo Bonzini
  2017-08-09 21:54 ` [Qemu-devel] [PATCH 01/12] qemu-iotests: remove dead code Paolo Bonzini
                   ` (12 more replies)
  0 siblings, 13 replies; 34+ messages in thread
From: Paolo Bonzini @ 2017-08-09 21:54 UTC (permalink / raw)
  To: qemu-devel; +Cc: qemu-block, kwolf

The purpose of this series is to separate the "check" sources from
the tests.  After these patches, common.config is reduced to simple
shell initialization, and common.rc is only included by the tests.

Along the way, a lot of dead code is removed too.

Paolo

Paolo Bonzini (12):
  qemu-iotests: remove dead code
  qemu-iotests: get rid of AWK_PROG
  qemu-iotests: move "check" code out of common.rc
  qemu-iotests: limit non-_PROG-suffixed variables to common.rc
  qemu-iotests: do not include common.rc in "check"
  qemu-iotests: do not do useless search for QEMU_*_PROG
  qemu-iotests: disintegrate more parts of common.config
  qemu-iotests: fix uninitialized variable
  qemu-iotests: do not search for binaries in the current directory
  qemu-iotests: get rid of $iam
  qemu-iotests: include common.env and common.config early
  qemu-iotests: merge "check" and "common"

 tests/qemu-iotests/039.out       |  10 +-
 tests/qemu-iotests/061.out       |   4 +-
 tests/qemu-iotests/137.out       |   2 +-
 tests/qemu-iotests/check         | 551 ++++++++++++++++++++++++++++++++++-----
 tests/qemu-iotests/common        | 459 --------------------------------
 tests/qemu-iotests/common.config | 205 +--------------
 tests/qemu-iotests/common.qemu   |   1 +
 tests/qemu-iotests/common.rc     | 225 ++++++++--------
 8 files changed, 615 insertions(+), 842 deletions(-)
 delete mode 100644 tests/qemu-iotests/common

-- 
2.13.3

^ permalink raw reply	[flat|nested] 34+ messages in thread

* [Qemu-devel] [PATCH 01/12] qemu-iotests: remove dead code
  2017-08-09 21:54 [Qemu-devel] [PATCH 00/12] cleanup qemu-iotests Paolo Bonzini
@ 2017-08-09 21:54 ` Paolo Bonzini
  2017-08-09 22:18   ` Eric Blake
  2017-08-09 21:55 ` [Qemu-devel] [PATCH 02/12] qemu-iotests: get rid of AWK_PROG Paolo Bonzini
                   ` (11 subsequent siblings)
  12 siblings, 1 reply; 34+ messages in thread
From: Paolo Bonzini @ 2017-08-09 21:54 UTC (permalink / raw)
  To: qemu-devel; +Cc: qemu-block, kwolf

This includes shell function, shell variables, command line options
(randomize.awk does not exist) and conditions that can never be true
(./qemu does not exist anymore).

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 tests/qemu-iotests/check         | 36 +--------------------
 tests/qemu-iotests/common        | 23 --------------
 tests/qemu-iotests/common.config | 26 ---------------
 tests/qemu-iotests/common.rc     | 68 ----------------------------------------
 4 files changed, 1 insertion(+), 152 deletions(-)

diff --git a/tests/qemu-iotests/check b/tests/qemu-iotests/check
index 2a55ec9ada..01fd5a26e5 100755
--- a/tests/qemu-iotests/check
+++ b/tests/qemu-iotests/check
@@ -65,8 +65,7 @@ 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' ]]
+if [[ -z "$QEMU_PROG" ]]
 then
     arch=$(uname -m 2> /dev/null)
 
@@ -123,12 +122,6 @@ fi
 # we need common
 . "$source_iotests/common"
 
-#if [ `id -u` -ne 0 ]
-#then
-#    echo "check: QA must be run as root"
-#    exit 1
-#fi
-
 TIMESTAMP_FILE=check.time-$IMGPROTO-$IMGFMT
 
 tmp="${TEST_DIR}"/$$
@@ -146,12 +139,6 @@ _timestamp()
 
 _wrapup()
 {
-    # for hangcheck ...
-    # remove files that were used by hangcheck
-    #
-    [ -f "${TEST_DIR}"/check.pid ] && rm -rf "${TEST_DIR}"/check.pid
-    [ -f "${TEST_DIR}"/check.sts ] && rm -rf "${TEST_DIR}"/check.sts
-
     if $showme
     then
         :
@@ -207,24 +194,6 @@ END        { if (NR > 0) {
 
 trap "_wrapup; exit \$status" 0 1 2 3 15
 
-# for hangcheck ...
-# Save pid of check in a well known place, so that hangcheck can be sure it
-# has the right pid (getting the pid from ps output is not reliable enough).
-#
-rm -rf "${TEST_DIR}"/check.pid
-echo $$ > "${TEST_DIR}"/check.pid
-
-# for hangcheck ...
-# Save the status of check in a well known place, so that hangcheck can be
-# sure to know where check is up to (getting test number from ps output is
-# not reliable enough since the trace stuff has been introduced).
-#
-rm -rf "${TEST_DIR}"/check.sts
-echo "preamble" > "${TEST_DIR}"/check.sts
-
-# don't leave old full output behind on a clean run
-rm -f check.full
-
 [ -f $TIMESTAMP_FILE ] || touch $TIMESTAMP_FILE
 
 FULL_IMGFMT_DETAILS=`_full_imgfmt_details`
@@ -287,9 +256,6 @@ do
         fi
         rm -f core $seq.notrun
 
-        # for hangcheck ...
-        echo "$seq" > "${TEST_DIR}"/check.sts
-
         start=`_wallclock`
         $timestamp && printf %s "        [$(date "+%T")]"
 
diff --git a/tests/qemu-iotests/common b/tests/qemu-iotests/common
index d34c11c056..867918895b 100644
--- a/tests/qemu-iotests/common
+++ b/tests/qemu-iotests/common
@@ -19,17 +19,6 @@
 # common procedures for QA scripts
 #
 
-_setenvironment()
-{
-    MSGVERB="text:action"
-    export MSGVERB
-}
-
-rm -f "$OUTPUT_DIR/$iam.out"
-_setenvironment
-
-check=${check-true}
-
 diff="diff -u"
 verbose=false
 debug=false
@@ -40,7 +29,6 @@ showme=false
 sortme=false
 expunge=true
 have_test_arg=false
-randomize=false
 cachemode=false
 rm -f $tmp.list $tmp.tmp $tmp.sed
 
@@ -170,7 +158,6 @@ other options
     -n                  show me, do not run tests
     -o options          -o options to pass to qemu-img create/convert
     -T                  output timestamps
-    -r                  randomize test order
     -c mode             cache mode
 
 testlist options
@@ -327,11 +314,6 @@ testlist options
             cachemode=true
             xpand=false
             ;;
-        -r)        # randomize test order
-            randomize=true
-            xpand=false
-            ;;
-
         -T)        # turn on timestamp output
             timestamp=true
             xpand=false
@@ -445,11 +427,6 @@ fi
 list=`sort $tmp.list`
 rm -f $tmp.list $tmp.tmp $tmp.sed
 
-if $randomize
-then
-    list=`echo $list | awk -f randomize.awk`
-fi
-
 [ "$QEMU" = "" ] && _fatal "qemu not found"
 [ "$QEMU_IMG" = "" ] && _fatal "qemu-img not found"
 [ "$QEMU_IO" = "" ] && _fatal "qemu-io not found"
diff --git a/tests/qemu-iotests/common.config b/tests/qemu-iotests/common.config
index e0883a0c65..b599c72211 100644
--- a/tests/qemu-iotests/common.config
+++ b/tests/qemu-iotests/common.config
@@ -15,33 +15,14 @@
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 #
-#
-# setup and check for config parameters, and in particular
-#
-# EMAIL -           email of the script runner.
-# TEST_DIR -        scratch test directory
-#
-# - These can be added to $HOST_CONFIG_DIR (witch default to ./config)
-#   below or a separate local configuration file can be used (using
-#   the HOST_OPTIONS variable).
-# - This script is shared by the stress test system and the auto-qa
-#   system (includes both regression test and benchmark components).
-# - this script shouldn't make any assertions about filesystem
-#   validity or mountedness.
-#
-
 # all tests should use a common language setting to prevent golden
 # output mismatches.
 export LANG=C
 
 PATH=".:$PATH"
 
-HOST=`hostname -s 2> /dev/null`
 HOSTOS=`uname -s`
 
-EMAIL=root@localhost    # where auto-qa will send its status messages
-export HOST_OPTIONS=${HOST_OPTIONS:=local.config}
-export CHECK_OPTIONS=${CHECK_OPTIONS:="-g auto"}
 export PWD=`pwd`
 
 export _QEMU_HANDLE=0
@@ -78,11 +59,6 @@ _fatal()
 export AWK_PROG="`set_prog_path awk`"
 [ "$AWK_PROG" = "" ] && _fatal "awk not found"
 
-export SED_PROG="`set_prog_path sed`"
-[ "$SED_PROG" = "" ] && _fatal "sed not found"
-
-export PS_ALL_FLAGS="-ef"
-
 if [ -z "$QEMU_PROG" ]; then
     export QEMU_PROG="`set_prog_path qemu`"
 fi
@@ -198,8 +174,6 @@ fi
 
 export QEMU_DEFAULT_MACHINE="$default_machine"
 
-[ -f /etc/qemu-iotest.config ]       && . /etc/qemu-iotest.config
-
 if [ -z "$TEST_DIR" ]; then
         TEST_DIR=`pwd`/scratch
 fi
diff --git a/tests/qemu-iotests/common.rc b/tests/qemu-iotests/common.rc
index bfbc80e5f6..dd91a2b79a 100644
--- a/tests/qemu-iotests/common.rc
+++ b/tests/qemu-iotests/common.rc
@@ -293,51 +293,6 @@ _img_info()
         done
 }
 
-_get_pids_by_name()
-{
-    if [ $# -ne 1 ]
-    then
-        echo "Usage: _get_pids_by_name process-name" 1>&2
-        exit 1
-    fi
-
-    # Algorithm ... all ps(1) variants have a time of the form MM:SS or
-    # HH:MM:SS before the psargs field, use this as the search anchor.
-    #
-    # Matches with $1 (process-name) occur if the first psarg is $1
-    # or ends in /$1 ... the matching uses sed's regular expressions,
-    # so passing a regex into $1 will work.
-
-    ps $PS_ALL_FLAGS \
-    | sed -n \
-        -e 's/$/ /' \
-        -e 's/[         ][         ]*/ /g' \
-        -e 's/^ //' \
-        -e 's/^[^ ]* //' \
-        -e "/[0-9]:[0-9][0-9]  *[^ ]*\/$1 /s/ .*//p" \
-        -e "/[0-9]:[0-9][0-9]  *$1 /s/ .*//p"
-}
-
-# fqdn for localhost
-#
-_get_fqdn()
-{
-    host=`hostname`
-    $NSLOOKUP_PROG $host | $AWK_PROG '{ if ($1 == "Name:") print $2 }'
-}
-
-# check if run as root
-#
-_need_to_be_root()
-{
-    id=`id | $SED_PROG -e 's/(.*//' -e 's/.*=//'`
-    if [ "$id" -ne 0 ]
-    then
-        echo "Arrgh ... you need to be root (not uid=$id) to run this test"
-        exit 1
-    fi
-}
-
 # bail out, setting up .notrun file
 #
 _notrun()
@@ -496,28 +451,5 @@ _full_platform_details()
     echo "$os/$platform $host $kernel"
 }
 
-_link_out_file()
-{
-   if [ -z "$1" ]; then
-      echo Error must pass \$seq.
-      exit
-   fi
-   rm -f $1
-   if [ "`uname`" == "IRIX64" ] || [ "`uname`" == "IRIX" ]; then
-      ln -s $1.irix $1
-   elif [ "`uname`" == "Linux" ]; then
-      ln -s $1.linux $1
-   else
-      echo Error test $seq does not run on the operating system: `uname`
-      exit
-   fi
-}
-
-_die()
-{
-        echo $@
-        exit 1
-}
-
 # make sure this script returns success
 true
-- 
2.13.3

^ permalink raw reply related	[flat|nested] 34+ messages in thread

* [Qemu-devel] [PATCH 02/12] qemu-iotests: get rid of AWK_PROG
  2017-08-09 21:54 [Qemu-devel] [PATCH 00/12] cleanup qemu-iotests Paolo Bonzini
  2017-08-09 21:54 ` [Qemu-devel] [PATCH 01/12] qemu-iotests: remove dead code Paolo Bonzini
@ 2017-08-09 21:55 ` Paolo Bonzini
  2017-08-09 22:21   ` Eric Blake
  2017-08-09 22:28   ` Philippe Mathieu-Daudé
  2017-08-09 21:55 ` [Qemu-devel] [PATCH 03/12] qemu-iotests: move "check" code out of common.rc Paolo Bonzini
                   ` (10 subsequent siblings)
  12 siblings, 2 replies; 34+ messages in thread
From: Paolo Bonzini @ 2017-08-09 21:55 UTC (permalink / raw)
  To: qemu-devel; +Cc: qemu-block, kwolf

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 tests/qemu-iotests/check         | 4 ++--
 tests/qemu-iotests/common        | 2 +-
 tests/qemu-iotests/common.config | 3 ---
 3 files changed, 3 insertions(+), 6 deletions(-)

diff --git a/tests/qemu-iotests/check b/tests/qemu-iotests/check
index 01fd5a26e5..5075029e89 100755
--- a/tests/qemu-iotests/check
+++ b/tests/qemu-iotests/check
@@ -128,7 +128,7 @@ tmp="${TEST_DIR}"/$$
 
 _wallclock()
 {
-    date "+%H %M %S" | $AWK_PROG '{ print $1*3600 + $2*60 + $3 }'
+    date "+%H %M %S" | awk '{ print $1*3600 + $2*60 + $3 }'
 }
 
 _timestamp()
@@ -147,7 +147,7 @@ _wrapup()
         if [ -f $TIMESTAMP_FILE -a -f $tmp.time ]
         then
             cat $TIMESTAMP_FILE $tmp.time \
-            | $AWK_PROG '
+            | awk '
         { t[$1] = $2 }
 END        { if (NR > 0) {
             for (i in t) print i " " t[i]
diff --git a/tests/qemu-iotests/common b/tests/qemu-iotests/common
index 867918895b..130f647a4d 100644
--- a/tests/qemu-iotests/common
+++ b/tests/qemu-iotests/common
@@ -366,7 +366,7 @@ testlist options
     if $xpand
     then
         have_test_arg=true
-        $AWK_PROG </dev/null '
+        awk </dev/null '
 BEGIN        { for (t='$start'; t<='$end'; t++) printf "%03d\n",t }' \
         | while read id
         do
diff --git a/tests/qemu-iotests/common.config b/tests/qemu-iotests/common.config
index b599c72211..0f571d46eb 100644
--- a/tests/qemu-iotests/common.config
+++ b/tests/qemu-iotests/common.config
@@ -56,9 +56,6 @@ _fatal()
     exit 1
 }
 
-export AWK_PROG="`set_prog_path awk`"
-[ "$AWK_PROG" = "" ] && _fatal "awk not found"
-
 if [ -z "$QEMU_PROG" ]; then
     export QEMU_PROG="`set_prog_path qemu`"
 fi
-- 
2.13.3

^ permalink raw reply related	[flat|nested] 34+ messages in thread

* [Qemu-devel] [PATCH 03/12] qemu-iotests: move "check" code out of common.rc
  2017-08-09 21:54 [Qemu-devel] [PATCH 00/12] cleanup qemu-iotests Paolo Bonzini
  2017-08-09 21:54 ` [Qemu-devel] [PATCH 01/12] qemu-iotests: remove dead code Paolo Bonzini
  2017-08-09 21:55 ` [Qemu-devel] [PATCH 02/12] qemu-iotests: get rid of AWK_PROG Paolo Bonzini
@ 2017-08-09 21:55 ` Paolo Bonzini
  2017-08-09 22:27   ` Philippe Mathieu-Daudé
  2017-08-09 21:55 ` [Qemu-devel] [PATCH 04/12] qemu-iotests: limit non-_PROG-suffixed variables to common.rc Paolo Bonzini
                   ` (9 subsequent siblings)
  12 siblings, 1 reply; 34+ messages in thread
From: Paolo Bonzini @ 2017-08-09 21:55 UTC (permalink / raw)
  To: qemu-devel; +Cc: qemu-block, kwolf

Some functions in common.rc are never used by the tests.  Move
them out of that file and into common, which is already included
only by "check".

Code that actually *is* common to "check" and tests can be placed in
common.config.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 tests/qemu-iotests/common        | 30 ++++++++++++++++++++++++++-
 tests/qemu-iotests/common.config | 12 +++++++++++
 tests/qemu-iotests/common.rc     | 45 ----------------------------------------
 3 files changed, 41 insertions(+), 46 deletions(-)

diff --git a/tests/qemu-iotests/common b/tests/qemu-iotests/common
index 130f647a4d..50720f080f 100644
--- a/tests/qemu-iotests/common
+++ b/tests/qemu-iotests/common
@@ -19,6 +19,29 @@
 # common procedures for QA scripts
 #
 
+_full_imgfmt_details()
+{
+    if [ -n "$IMGOPTS" ]; then
+        echo "$IMGFMT ($IMGOPTS)"
+    else
+        echo "$IMGFMT"
+    fi
+}
+
+_full_imgproto_details()
+{
+    echo "$IMGPROTO"
+}
+
+_full_platform_details()
+{
+    os=`uname -s`
+    host=`hostname -s`
+    kernel=`uname -r`
+    platform=`uname -m`
+    echo "$os/$platform $host $kernel"
+}
+
 diff="diff -u"
 verbose=false
 debug=false
@@ -404,7 +427,12 @@ if [ "$IMGOPTSSYNTAX" != "true" ]; then
 fi
 
 # Set default options for qemu-img create -o if they were not specified
-_set_default_imgopts
+if [ "$IMGFMT" == "qcow2" ] && ! (echo "$IMGOPTS" | grep "compat=" > /dev/null); then
+    IMGOPTS=$(_optstr_add "$IMGOPTS" "compat=1.1")
+fi
+if [ "$IMGFMT" == "luks" ] && ! (echo "$IMGOPTS" | grep "iter-time=" > /dev/null); then
+    IMGOPTS=$(_optstr_add "$IMGOPTS" "iter-time=10")
+fi
 
 if [ -s $tmp.list ]
 then
diff --git a/tests/qemu-iotests/common.config b/tests/qemu-iotests/common.config
index 0f571d46eb..91da65f3dc 100644
--- a/tests/qemu-iotests/common.config
+++ b/tests/qemu-iotests/common.config
@@ -27,6 +27,9 @@ export PWD=`pwd`
 
 export _QEMU_HANDLE=0
 
+# make sure we have a standard umask
+umask 022
+
 # $1 = prog to look for, $2* = default pathnames if not found in $PATH
 set_prog_path()
 {
@@ -49,6 +52,15 @@ set_prog_path()
     return 1
 }
 
+_optstr_add()
+{
+    if [ -n "$1" ]; then
+        echo "$1,$2"
+    else
+        echo "$2"
+    fi
+}
+
 _fatal()
 {
     echo "$*"
diff --git a/tests/qemu-iotests/common.rc b/tests/qemu-iotests/common.rc
index dd91a2b79a..6f6e03366f 100644
--- a/tests/qemu-iotests/common.rc
+++ b/tests/qemu-iotests/common.rc
@@ -50,9 +50,6 @@ then
     fi
 fi
 
-# make sure we have a standard umask
-umask 022
-
 if [ "$IMGOPTSSYNTAX" = "true" ]; then
     DRIVER="driver=$IMGFMT"
     if [ "$IMGFMT" = "luks" ]; then
@@ -94,25 +91,6 @@ else
 fi
 ORIG_TEST_IMG="$TEST_IMG"
 
-_optstr_add()
-{
-    if [ -n "$1" ]; then
-        echo "$1,$2"
-    else
-        echo "$2"
-    fi
-}
-
-_set_default_imgopts()
-{
-    if [ "$IMGFMT" == "qcow2" ] && ! (echo "$IMGOPTS" | grep "compat=" > /dev/null); then
-        IMGOPTS=$(_optstr_add "$IMGOPTS" "compat=1.1")
-    fi
-    if [ "$IMGFMT" == "luks" ] && ! (echo "$IMGOPTS" | grep "iter-time=" > /dev/null); then
-        IMGOPTS=$(_optstr_add "$IMGOPTS" "iter-time=10")
-    fi
-}
-
 _use_sample_img()
 {
     SAMPLE_IMG_FILE="${1%\.bz2}"
@@ -428,28 +406,5 @@ _require_command()
     [ -x "$c" ] || _notrun "$1 utility required, skipped this test"
 }
 
-_full_imgfmt_details()
-{
-    if [ -n "$IMGOPTS" ]; then
-        echo "$IMGFMT ($IMGOPTS)"
-    else
-        echo "$IMGFMT"
-    fi
-}
-
-_full_imgproto_details()
-{
-    echo "$IMGPROTO"
-}
-
-_full_platform_details()
-{
-    os=`uname -s`
-    host=`hostname -s`
-    kernel=`uname -r`
-    platform=`uname -m`
-    echo "$os/$platform $host $kernel"
-}
-
 # make sure this script returns success
 true
-- 
2.13.3

^ permalink raw reply related	[flat|nested] 34+ messages in thread

* [Qemu-devel] [PATCH 04/12] qemu-iotests: limit non-_PROG-suffixed variables to common.rc
  2017-08-09 21:54 [Qemu-devel] [PATCH 00/12] cleanup qemu-iotests Paolo Bonzini
                   ` (2 preceding siblings ...)
  2017-08-09 21:55 ` [Qemu-devel] [PATCH 03/12] qemu-iotests: move "check" code out of common.rc Paolo Bonzini
@ 2017-08-09 21:55 ` Paolo Bonzini
  2017-09-12 10:31   ` Kevin Wolf
  2017-08-09 21:55 ` [Qemu-devel] [PATCH 05/12] qemu-iotests: do not include common.rc in "check" Paolo Bonzini
                   ` (8 subsequent siblings)
  12 siblings, 1 reply; 34+ messages in thread
From: Paolo Bonzini @ 2017-08-09 21:55 UTC (permalink / raw)
  To: qemu-devel; +Cc: qemu-block, kwolf

These are never used by "check", with one exception that does not need
$QEMU_OPTIONS.  Keep them in common.rc, which will be soon included only
by the tests.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 tests/qemu-iotests/039.out       | 10 ++---
 tests/qemu-iotests/061.out       |  4 +-
 tests/qemu-iotests/137.out       |  2 +-
 tests/qemu-iotests/common        |  8 ----
 tests/qemu-iotests/common.config | 75 +------------------------------------
 tests/qemu-iotests/common.rc     | 80 ++++++++++++++++++++++++++++++++++++++++
 6 files changed, 90 insertions(+), 89 deletions(-)

diff --git a/tests/qemu-iotests/039.out b/tests/qemu-iotests/039.out
index c6e0ac2da3..724d7b2508 100644
--- a/tests/qemu-iotests/039.out
+++ b/tests/qemu-iotests/039.out
@@ -11,7 +11,7 @@ No errors were found on the image.
 Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=134217728
 wrote 512/512 bytes at offset 0
 512 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
-./common.config: Killed                  ( if [ "${VALGRIND_QEMU}" == "y" ]; then
+./common.rc: Killed                  ( if [ "${VALGRIND_QEMU}" == "y" ]; then
     exec valgrind --log-file="${VALGRIND_LOGFILE}" --error-exitcode=99 "$QEMU_IO_PROG" $QEMU_IO_ARGS "$@";
 else
     exec "$QEMU_IO_PROG" $QEMU_IO_ARGS "$@";
@@ -50,7 +50,7 @@ read 512/512 bytes at offset 0
 Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=134217728
 wrote 512/512 bytes at offset 0
 512 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
-./common.config: Killed                  ( if [ "${VALGRIND_QEMU}" == "y" ]; then
+./common.rc: Killed                  ( if [ "${VALGRIND_QEMU}" == "y" ]; then
     exec valgrind --log-file="${VALGRIND_LOGFILE}" --error-exitcode=99 "$QEMU_IO_PROG" $QEMU_IO_ARGS "$@";
 else
     exec "$QEMU_IO_PROG" $QEMU_IO_ARGS "$@";
@@ -68,7 +68,7 @@ incompatible_features     0x0
 Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=134217728
 wrote 512/512 bytes at offset 0
 512 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
-./common.config: Killed                  ( if [ "${VALGRIND_QEMU}" == "y" ]; then
+./common.rc: Killed                  ( if [ "${VALGRIND_QEMU}" == "y" ]; then
     exec valgrind --log-file="${VALGRIND_LOGFILE}" --error-exitcode=99 "$QEMU_IO_PROG" $QEMU_IO_ARGS "$@";
 else
     exec "$QEMU_IO_PROG" $QEMU_IO_ARGS "$@";
@@ -91,7 +91,7 @@ No errors were found on the image.
 Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=134217728
 wrote 512/512 bytes at offset 0
 512 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
-./common.config: Killed                  ( if [ "${VALGRIND_QEMU}" == "y" ]; then
+./common.rc: Killed                  ( if [ "${VALGRIND_QEMU}" == "y" ]; then
     exec valgrind --log-file="${VALGRIND_LOGFILE}" --error-exitcode=99 "$QEMU_IO_PROG" $QEMU_IO_ARGS "$@";
 else
     exec "$QEMU_IO_PROG" $QEMU_IO_ARGS "$@";
@@ -105,7 +105,7 @@ Data may be corrupted, or further writes to the image may corrupt it.
 Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=134217728
 wrote 512/512 bytes at offset 0
 512 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
-./common.config: Killed                  ( if [ "${VALGRIND_QEMU}" == "y" ]; then
+./common.rc: Killed                  ( if [ "${VALGRIND_QEMU}" == "y" ]; then
     exec valgrind --log-file="${VALGRIND_LOGFILE}" --error-exitcode=99 "$QEMU_IO_PROG" $QEMU_IO_ARGS "$@";
 else
     exec "$QEMU_IO_PROG" $QEMU_IO_ARGS "$@";
diff --git a/tests/qemu-iotests/061.out b/tests/qemu-iotests/061.out
index a431b7f305..942485de99 100644
--- a/tests/qemu-iotests/061.out
+++ b/tests/qemu-iotests/061.out
@@ -57,7 +57,7 @@ No errors were found on the image.
 Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=67108864
 wrote 131072/131072 bytes at offset 0
 128 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
-./common.config: Killed                  ( if [ "${VALGRIND_QEMU}" == "y" ]; then
+./common.rc: Killed                  ( if [ "${VALGRIND_QEMU}" == "y" ]; then
     exec valgrind --log-file="${VALGRIND_LOGFILE}" --error-exitcode=99 "$QEMU_IO_PROG" $QEMU_IO_ARGS "$@";
 else
     exec "$QEMU_IO_PROG" $QEMU_IO_ARGS "$@";
@@ -219,7 +219,7 @@ No errors were found on the image.
 Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=67108864
 wrote 131072/131072 bytes at offset 0
 128 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
-./common.config: Killed                  ( if [ "${VALGRIND_QEMU}" == "y" ]; then
+./common.rc: Killed                  ( if [ "${VALGRIND_QEMU}" == "y" ]; then
     exec valgrind --log-file="${VALGRIND_LOGFILE}" --error-exitcode=99 "$QEMU_IO_PROG" $QEMU_IO_ARGS "$@";
 else
     exec "$QEMU_IO_PROG" $QEMU_IO_ARGS "$@";
diff --git a/tests/qemu-iotests/137.out b/tests/qemu-iotests/137.out
index c0e753483b..05efd74d17 100644
--- a/tests/qemu-iotests/137.out
+++ b/tests/qemu-iotests/137.out
@@ -31,7 +31,7 @@ Cache clean interval too big
 Unsupported value 'blubb' for qcow2 option 'overlap-check'. Allowed are any of the following: none, constant, cached, all
 wrote 512/512 bytes at offset 0
 512 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
-./common.config: Killed                  ( if [ "${VALGRIND_QEMU}" == "y" ]; then
+./common.rc: Killed                  ( if [ "${VALGRIND_QEMU}" == "y" ]; then
     exec valgrind --log-file="${VALGRIND_LOGFILE}" --error-exitcode=99 "$QEMU_IO_PROG" $QEMU_IO_ARGS "$@";
 else
     exec "$QEMU_IO_PROG" $QEMU_IO_ARGS "$@";
diff --git a/tests/qemu-iotests/common b/tests/qemu-iotests/common
index 50720f080f..f58e56fc40 100644
--- a/tests/qemu-iotests/common
+++ b/tests/qemu-iotests/common
@@ -454,11 +454,3 @@ fi
 #
 list=`sort $tmp.list`
 rm -f $tmp.list $tmp.tmp $tmp.sed
-
-[ "$QEMU" = "" ] && _fatal "qemu not found"
-[ "$QEMU_IMG" = "" ] && _fatal "qemu-img not found"
-[ "$QEMU_IO" = "" ] && _fatal "qemu-io not found"
-
-if [ "$IMGPROTO" = "nbd" ] ; then
-    [ "$QEMU_NBD" = "" ] && _fatal "qemu-nbd not found"
-fi
diff --git a/tests/qemu-iotests/common.config b/tests/qemu-iotests/common.config
index 91da65f3dc..ee10c23672 100644
--- a/tests/qemu-iotests/common.config
+++ b/tests/qemu-iotests/common.config
@@ -61,13 +61,6 @@ _optstr_add()
     fi
 }
 
-_fatal()
-{
-    echo "$*"
-    status=1
-    exit 1
-}
-
 if [ -z "$QEMU_PROG" ]; then
     export QEMU_PROG="`set_prog_path qemu`"
 fi
@@ -99,70 +92,6 @@ if [ -n "$QEMU_VXHS_PROG" ]; then
     export QEMU_VXHS_PROG=$(realpath -- "$(type -p "$QEMU_VXHS_PROG")")
 fi
 
-_qemu_wrapper()
-{
-    (
-        if [ -n "${QEMU_NEED_PID}" ]; then
-            echo $BASHPID > "${QEMU_TEST_DIR}/qemu-${_QEMU_HANDLE}.pid"
-        fi
-        exec "$QEMU_PROG" $QEMU_OPTIONS "$@"
-    )
-}
-
-_qemu_img_wrapper()
-{
-    (exec "$QEMU_IMG_PROG" $QEMU_IMG_OPTIONS "$@")
-}
-
-_qemu_io_wrapper()
-{
-    local VALGRIND_LOGFILE="${TEST_DIR}"/$$.valgrind
-    local QEMU_IO_ARGS="$QEMU_IO_OPTIONS"
-    if [ "$IMGOPTSSYNTAX" = "true" ]; then
-        QEMU_IO_ARGS="--image-opts $QEMU_IO_ARGS"
-        if [ -n "$IMGKEYSECRET" ]; then
-            QEMU_IO_ARGS="--object secret,id=keysec0,data=$IMGKEYSECRET $QEMU_IO_ARGS"
-        fi
-    fi
-    local RETVAL
-    (
-        if [ "${VALGRIND_QEMU}" == "y" ]; then
-            exec valgrind --log-file="${VALGRIND_LOGFILE}" --error-exitcode=99 "$QEMU_IO_PROG" $QEMU_IO_ARGS "$@"
-        else
-            exec "$QEMU_IO_PROG" $QEMU_IO_ARGS "$@"
-        fi
-    )
-    RETVAL=$?
-    if [ "${VALGRIND_QEMU}" == "y" ]; then
-        if [ $RETVAL == 99 ]; then
-            cat "${VALGRIND_LOGFILE}"
-        fi
-        rm -f "${VALGRIND_LOGFILE}"
-    fi
-    (exit $RETVAL)
-}
-
-_qemu_nbd_wrapper()
-{
-    (
-        echo $BASHPID > "${QEMU_TEST_DIR}/qemu-nbd.pid"
-        exec "$QEMU_NBD_PROG" $QEMU_NBD_OPTIONS "$@"
-    )
-}
-
-_qemu_vxhs_wrapper()
-{
-    (
-        echo $BASHPID > "${TEST_DIR}/qemu-vxhs.pid"
-        exec "$QEMU_VXHS_PROG" $QEMU_VXHS_OPTIONS "$@"
-    )
-}
-
-export QEMU=_qemu_wrapper
-export QEMU_IMG=_qemu_img_wrapper
-export QEMU_IO=_qemu_io_wrapper
-export QEMU_NBD=_qemu_nbd_wrapper
-export QEMU_VXHS=_qemu_vxhs_wrapper
 
 QEMU_IMG_EXTRA_ARGS=
 if [ "$IMGOPTSSYNTAX" = "true" ]; then
@@ -174,8 +103,8 @@ fi
 export QEMU_IMG_EXTRA_ARGS
 
 
-default_machine=$($QEMU -machine help | sed -n '/(default)/ s/ .*//p')
-default_alias_machine=$($QEMU -machine help | \
+default_machine=$($QEMU_PROG -machine help | sed -n '/(default)/ s/ .*//p')
+default_alias_machine=$($QEMU_PROG -machine help | \
    sed -n "/(alias of $default_machine)/ { s/ .*//p; q; }")
 if [[ "$default_alias_machine" ]]; then
     default_machine="$default_alias_machine"
diff --git a/tests/qemu-iotests/common.rc b/tests/qemu-iotests/common.rc
index 6f6e03366f..ef5cdb3385 100644
--- a/tests/qemu-iotests/common.rc
+++ b/tests/qemu-iotests/common.rc
@@ -50,6 +50,86 @@ then
     fi
 fi
 
+_fatal()
+{
+    echo "$*"
+    status=1
+    exit 1
+}
+
+[ -n "$QEMU_PROG" ] || _fatal "qemu not found"
+[ -n "$QEMU_IMG_PROG" ] || _fatal "qemu-img not found"
+[ -n "$QEMU_IO_PROG" ] || _fatal "qemu-io not found"
+[ -n "$QEMU_NBD_PROG" ] || _fatal "qemu-nbd not found"
+if [ -z "$QEMU_VXHS_PROG" ] && [ "$IMGPROTO" = "vhxs" ]; then
+  _fatal "qnio_server not found"
+fi
+
+_qemu_wrapper()
+{
+    (
+        if [ -n "${QEMU_NEED_PID}" ]; then
+            echo $BASHPID > "${QEMU_TEST_DIR}/qemu-${_QEMU_HANDLE}.pid"
+        fi
+        exec "$QEMU_PROG" $QEMU_OPTIONS "$@"
+    )
+}
+
+_qemu_img_wrapper()
+{
+    (exec "$QEMU_IMG_PROG" $QEMU_IMG_OPTIONS "$@")
+}
+
+_qemu_io_wrapper()
+{
+    local VALGRIND_LOGFILE="${TEST_DIR}"/$$.valgrind
+    local QEMU_IO_ARGS="$QEMU_IO_OPTIONS"
+    if [ "$IMGOPTSSYNTAX" = "true" ]; then
+        QEMU_IO_ARGS="--image-opts $QEMU_IO_ARGS"
+        if [ -n "$IMGKEYSECRET" ]; then
+            QEMU_IO_ARGS="--object secret,id=keysec0,data=$IMGKEYSECRET $QEMU_IO_ARGS"
+        fi
+    fi
+    local RETVAL
+    (
+        if [ "${VALGRIND_QEMU}" == "y" ]; then
+            exec valgrind --log-file="${VALGRIND_LOGFILE}" --error-exitcode=99 "$QEMU_IO_PROG" $QEMU_IO_ARGS "$@"
+        else
+            exec "$QEMU_IO_PROG" $QEMU_IO_ARGS "$@"
+        fi
+    )
+    RETVAL=$?
+    if [ "${VALGRIND_QEMU}" == "y" ]; then
+        if [ $RETVAL == 99 ]; then
+            cat "${VALGRIND_LOGFILE}"
+        fi
+        rm -f "${VALGRIND_LOGFILE}"
+    fi
+    (exit $RETVAL)
+}
+
+_qemu_nbd_wrapper()
+{
+    (
+        echo $BASHPID > "${QEMU_TEST_DIR}/qemu-nbd.pid"
+        exec "$QEMU_NBD_PROG" $QEMU_NBD_OPTIONS "$@"
+    )
+}
+
+_qemu_vxhs_wrapper()
+{
+    (
+        echo $BASHPID > "${TEST_DIR}/qemu-vxhs.pid"
+        exec "$QEMU_VXHS_PROG" $QEMU_VXHS_OPTIONS "$@"
+    )
+}
+
+export QEMU=_qemu_wrapper
+export QEMU_IMG=_qemu_img_wrapper
+export QEMU_IO=_qemu_io_wrapper
+export QEMU_NBD=_qemu_nbd_wrapper
+export QEMU_VXHS=_qemu_vxhs_wrapper
+
 if [ "$IMGOPTSSYNTAX" = "true" ]; then
     DRIVER="driver=$IMGFMT"
     if [ "$IMGFMT" = "luks" ]; then
-- 
2.13.3

^ permalink raw reply related	[flat|nested] 34+ messages in thread

* [Qemu-devel] [PATCH 05/12] qemu-iotests: do not include common.rc in "check"
  2017-08-09 21:54 [Qemu-devel] [PATCH 00/12] cleanup qemu-iotests Paolo Bonzini
                   ` (3 preceding siblings ...)
  2017-08-09 21:55 ` [Qemu-devel] [PATCH 04/12] qemu-iotests: limit non-_PROG-suffixed variables to common.rc Paolo Bonzini
@ 2017-08-09 21:55 ` Paolo Bonzini
  2017-08-09 22:26   ` Philippe Mathieu-Daudé
  2017-08-09 21:55 ` [Qemu-devel] [PATCH 06/12] qemu-iotests: do not do useless search for QEMU_*_PROG Paolo Bonzini
                   ` (7 subsequent siblings)
  12 siblings, 1 reply; 34+ messages in thread
From: Paolo Bonzini @ 2017-08-09 21:55 UTC (permalink / raw)
  To: qemu-devel; +Cc: qemu-block, kwolf

It only provides functions used by the test programs.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 tests/qemu-iotests/check     |  6 ------
 tests/qemu-iotests/common.rc | 13 +++++--------
 2 files changed, 5 insertions(+), 14 deletions(-)

diff --git a/tests/qemu-iotests/check b/tests/qemu-iotests/check
index 5075029e89..1ef6d0ac3a 100755
--- a/tests/qemu-iotests/check
+++ b/tests/qemu-iotests/check
@@ -113,12 +113,6 @@ then
     _init_error "failed to source common.config"
 fi
 
-# we need common.rc
-if ! . "$source_iotests/common.rc"
-then
-    _init_error "failed to source common.rc"
-fi
-
 # we need common
 . "$source_iotests/common"
 
diff --git a/tests/qemu-iotests/common.rc b/tests/qemu-iotests/common.rc
index ef5cdb3385..390aa81224 100644
--- a/tests/qemu-iotests/common.rc
+++ b/tests/qemu-iotests/common.rc
@@ -40,14 +40,11 @@ poke_file()
     printf "$3" | dd "of=$1" bs=1 "seek=$2" conv=notrunc &>/dev/null
 }
 
-# we need common.config
-if [ "$iam" != "check" ]
-then
-    if ! . ./common.config
-        then
-        echo "$iam: failed to source common.config"
-        exit 1
-    fi
+
+if ! . ./common.config
+    then
+    echo "$iam: failed to source common.config"
+    exit 1
 fi
 
 _fatal()
-- 
2.13.3

^ permalink raw reply related	[flat|nested] 34+ messages in thread

* [Qemu-devel] [PATCH 06/12] qemu-iotests: do not do useless search for QEMU_*_PROG
  2017-08-09 21:54 [Qemu-devel] [PATCH 00/12] cleanup qemu-iotests Paolo Bonzini
                   ` (4 preceding siblings ...)
  2017-08-09 21:55 ` [Qemu-devel] [PATCH 05/12] qemu-iotests: do not include common.rc in "check" Paolo Bonzini
@ 2017-08-09 21:55 ` Paolo Bonzini
  2017-08-09 21:55 ` [Qemu-devel] [PATCH 07/12] qemu-iotests: disintegrate more parts of common.config Paolo Bonzini
                   ` (6 subsequent siblings)
  12 siblings, 0 replies; 34+ messages in thread
From: Paolo Bonzini @ 2017-08-09 21:55 UTC (permalink / raw)
  To: qemu-devel; +Cc: qemu-block, kwolf

With the exception of qnio_server, all the variables are initialized
by "check" prior to "common" being sourced.  They cannot be empty.
Only the "realpath" invocation is useful, and can be done just once
in "check" rather than in the tests.

For qnio_server, move the detection to "common", simplifying
set_prog_path to stop handling the unused second argument, and
embedding the "realpath" pass.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 tests/qemu-iotests/common        | 19 ++++++++++++++
 tests/qemu-iotests/common.config | 54 ----------------------------------------
 2 files changed, 19 insertions(+), 54 deletions(-)

diff --git a/tests/qemu-iotests/common b/tests/qemu-iotests/common
index f58e56fc40..33557abe6c 100644
--- a/tests/qemu-iotests/common
+++ b/tests/qemu-iotests/common
@@ -42,6 +42,25 @@ _full_platform_details()
     echo "$os/$platform $host $kernel"
 }
 
+# $1 = prog to look for
+set_prog_path()
+{
+    p=`command -v $1 2> /dev/null`
+    if [ -n "$p" -a -x "$p" ]; then
+        realpath -- "$(type -p "$p")"
+    else
+        return 1
+    fi
+}
+
+export QEMU_PROG=$(realpath -- "$(type -p "$QEMU_PROG")")
+export QEMU_IMG_PROG=$(realpath -- "$(type -p "$QEMU_IMG_PROG")")
+export QEMU_IO_PROG=$(realpath -- "$(type -p "$QEMU_IO_PROG")")
+export QEMU_NBD_PROG=$(realpath -- "$(type -p "$QEMU_NBD_PROG")")
+if [ -z "$QEMU_VXHS_PROG" ]; then
+  export QEMU_VXHS_PROG="`set_prog_path qnio_server`"
+fi
+
 diff="diff -u"
 verbose=false
 debug=false
diff --git a/tests/qemu-iotests/common.config b/tests/qemu-iotests/common.config
index ee10c23672..9d535415b5 100644
--- a/tests/qemu-iotests/common.config
+++ b/tests/qemu-iotests/common.config
@@ -30,28 +30,6 @@ export _QEMU_HANDLE=0
 # make sure we have a standard umask
 umask 022
 
-# $1 = prog to look for, $2* = default pathnames if not found in $PATH
-set_prog_path()
-{
-    p=`command -v $1 2> /dev/null`
-    if [ -n "$p" -a -x "$p" ]; then
-        echo $p
-        return 0
-    fi
-    p=$1
-
-    shift
-    for f; do
-        if [ -x $f ]; then
-            echo $f
-            return 0
-        fi
-    done
-
-    echo ""
-    return 1
-}
-
 _optstr_add()
 {
     if [ -n "$1" ]; then
@@ -61,38 +39,6 @@ _optstr_add()
     fi
 }
 
-if [ -z "$QEMU_PROG" ]; then
-    export QEMU_PROG="`set_prog_path qemu`"
-fi
-
-if [ -z "$QEMU_IMG_PROG" ]; then
-    export QEMU_IMG_PROG="`set_prog_path qemu-img`"
-fi
-
-if [ -z "$QEMU_IO_PROG" ]; then
-    export QEMU_IO_PROG="`set_prog_path qemu-io`"
-fi
-
-if [ -z "$QEMU_NBD_PROG" ]; then
-    export QEMU_NBD_PROG="`set_prog_path qemu-nbd`"
-fi
-
-if [ -z "$QEMU_VXHS_PROG" ]; then
-    export QEMU_VXHS_PROG="`set_prog_path qnio_server`"
-fi
-
-export QEMU_PROG=$(realpath -- "$(type -p "$QEMU_PROG")")
-export QEMU_IMG_PROG=$(realpath -- "$(type -p "$QEMU_IMG_PROG")")
-export QEMU_IO_PROG=$(realpath -- "$(type -p "$QEMU_IO_PROG")")
-export QEMU_NBD_PROG=$(realpath -- "$(type -p "$QEMU_NBD_PROG")")
-
-# This program is not built as part of qemu but (possibly) provided by the
-# system, so it may not be present at all
-if [ -n "$QEMU_VXHS_PROG" ]; then
-    export QEMU_VXHS_PROG=$(realpath -- "$(type -p "$QEMU_VXHS_PROG")")
-fi
-
-
 QEMU_IMG_EXTRA_ARGS=
 if [ "$IMGOPTSSYNTAX" = "true" ]; then
     QEMU_IMG_EXTRA_ARGS="--image-opts $QEMU_IMG_EXTRA_ARGS"
-- 
2.13.3

^ permalink raw reply related	[flat|nested] 34+ messages in thread

* [Qemu-devel] [PATCH 07/12] qemu-iotests: disintegrate more parts of common.config
  2017-08-09 21:54 [Qemu-devel] [PATCH 00/12] cleanup qemu-iotests Paolo Bonzini
                   ` (5 preceding siblings ...)
  2017-08-09 21:55 ` [Qemu-devel] [PATCH 06/12] qemu-iotests: do not do useless search for QEMU_*_PROG Paolo Bonzini
@ 2017-08-09 21:55 ` Paolo Bonzini
  2017-09-12 10:40   ` Kevin Wolf
  2017-08-09 21:55 ` [Qemu-devel] [PATCH 08/12] qemu-iotests: fix uninitialized variable Paolo Bonzini
                   ` (5 subsequent siblings)
  12 siblings, 1 reply; 34+ messages in thread
From: Paolo Bonzini @ 2017-08-09 21:55 UTC (permalink / raw)
  To: qemu-devel; +Cc: qemu-block, kwolf

Split "check" parts from tests part.

For the directory setup, the actual computation of directories goes
in "check", while the sanity checks go in the tests.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 tests/qemu-iotests/common        | 24 ++++++++++++++++++++
 tests/qemu-iotests/common.config | 49 ----------------------------------------
 tests/qemu-iotests/common.qemu   |  1 +
 tests/qemu-iotests/common.rc     | 25 ++++++++++++++++++++
 4 files changed, 50 insertions(+), 49 deletions(-)

diff --git a/tests/qemu-iotests/common b/tests/qemu-iotests/common
index 33557abe6c..adf427501e 100644
--- a/tests/qemu-iotests/common
+++ b/tests/qemu-iotests/common
@@ -61,6 +61,14 @@ if [ -z "$QEMU_VXHS_PROG" ]; then
   export QEMU_VXHS_PROG="`set_prog_path qnio_server`"
 fi
 
+if [ -z "$TEST_DIR" ]; then
+        TEST_DIR=`pwd`/scratch
+fi
+
+if [ ! -e "$TEST_DIR" ]; then
+        mkdir "$TEST_DIR"
+fi
+
 diff="diff -u"
 verbose=false
 debug=false
@@ -87,6 +95,15 @@ export VALGRIND_QEMU=
 export IMGKEYSECRET=
 export IMGOPTSSYNTAX=false
 
+default_machine=$($QEMU_PROG -machine help | sed -n '/(default)/ s/ .*//p')
+default_alias_machine=$($QEMU_PROG -machine help | \
+   sed -n "/(alias of $default_machine)/ { s/ .*//p; q; }")
+if [[ "$default_alias_machine" ]]; then
+    default_machine="$default_alias_machine"
+fi
+
+export QEMU_DEFAULT_MACHINE="$default_machine"
+
 for r
 do
 
@@ -453,6 +470,13 @@ if [ "$IMGFMT" == "luks" ] && ! (echo "$IMGOPTS" | grep "iter-time=" > /dev/null
     IMGOPTS=$(_optstr_add "$IMGOPTS" "iter-time=10")
 fi
 
+if [ -z "$SAMPLE_IMG_DIR" ]; then
+        SAMPLE_IMG_DIR="$source_iotests/sample_images"
+fi
+
+export TEST_DIR
+export SAMPLE_IMG_DIR
+
 if [ -s $tmp.list ]
 then
     # found some valid test numbers ... this is good
diff --git a/tests/qemu-iotests/common.config b/tests/qemu-iotests/common.config
index 9d535415b5..dd2ffe034d 100644
--- a/tests/qemu-iotests/common.config
+++ b/tests/qemu-iotests/common.config
@@ -25,8 +25,6 @@ HOSTOS=`uname -s`
 
 export PWD=`pwd`
 
-export _QEMU_HANDLE=0
-
 # make sure we have a standard umask
 umask 022
 
@@ -39,52 +37,5 @@ _optstr_add()
     fi
 }
 
-QEMU_IMG_EXTRA_ARGS=
-if [ "$IMGOPTSSYNTAX" = "true" ]; then
-    QEMU_IMG_EXTRA_ARGS="--image-opts $QEMU_IMG_EXTRA_ARGS"
-    if [ -n "$IMGKEYSECRET" ]; then
-        QEMU_IMG_EXTRA_ARGS="--object secret,id=keysec0,data=$IMGKEYSECRET $QEMU_IMG_EXTRA_ARGS"
-    fi
-fi
-export QEMU_IMG_EXTRA_ARGS
-
-
-default_machine=$($QEMU_PROG -machine help | sed -n '/(default)/ s/ .*//p')
-default_alias_machine=$($QEMU_PROG -machine help | \
-   sed -n "/(alias of $default_machine)/ { s/ .*//p; q; }")
-if [[ "$default_alias_machine" ]]; then
-    default_machine="$default_alias_machine"
-fi
-
-export QEMU_DEFAULT_MACHINE="$default_machine"
-
-if [ -z "$TEST_DIR" ]; then
-        TEST_DIR=`pwd`/scratch
-fi
-
-QEMU_TEST_DIR="${TEST_DIR}"
-
-if [ ! -e "$TEST_DIR" ]; then
-        mkdir "$TEST_DIR"
-fi
-
-if [ ! -d "$TEST_DIR" ]; then
-    echo "common.config: Error: \$TEST_DIR ($TEST_DIR) is not a directory"
-    exit 1
-fi
-
-export TEST_DIR
-
-if [ -z "$SAMPLE_IMG_DIR" ]; then
-        SAMPLE_IMG_DIR="$source_iotests/sample_images"
-fi
-
-if [ ! -d "$SAMPLE_IMG_DIR" ]; then
-    echo "common.config: Error: \$SAMPLE_IMG_DIR ($SAMPLE_IMG_DIR) is not a directory"
-    exit 1
-fi
-
-export SAMPLE_IMG_DIR
-
 # make sure this script returns success
 true
diff --git a/tests/qemu-iotests/common.qemu b/tests/qemu-iotests/common.qemu
index 7645f1dc72..9f9aecc9df 100644
--- a/tests/qemu-iotests/common.qemu
+++ b/tests/qemu-iotests/common.qemu
@@ -31,6 +31,7 @@ QEMU_FIFO_IN="${QEMU_TEST_DIR}/qmp-in-$$"
 QEMU_FIFO_OUT="${QEMU_TEST_DIR}/qmp-out-$$"
 
 QEMU_HANDLE=0
+export _QEMU_HANDLE=0
 
 # If bash version is >= 4.1, these will be overwritten and dynamic
 # file descriptor values assigned.
diff --git a/tests/qemu-iotests/common.rc b/tests/qemu-iotests/common.rc
index 390aa81224..7046a83974 100644
--- a/tests/qemu-iotests/common.rc
+++ b/tests/qemu-iotests/common.rc
@@ -129,6 +129,10 @@ export QEMU_VXHS=_qemu_vxhs_wrapper
 
 if [ "$IMGOPTSSYNTAX" = "true" ]; then
     DRIVER="driver=$IMGFMT"
+    QEMU_IMG_EXTRA_ARGS="--image-opts $QEMU_IMG_EXTRA_ARGS"
+    if [ -n "$IMGKEYSECRET" ]; then
+        QEMU_IMG_EXTRA_ARGS="--object secret,id=keysec0,data=$IMGKEYSECRET $QEMU_IMG_EXTRA_ARGS"
+    fi
     if [ "$IMGFMT" = "luks" ]; then
         DRIVER="$DRIVER,key-secret=keysec0"
     fi
@@ -148,6 +152,7 @@ if [ "$IMGOPTSSYNTAX" = "true" ]; then
         TEST_IMG="$DRIVER,file.driver=$IMGPROTO,file.filename=$TEST_DIR/t.$IMGFMT"
     fi
 else
+    QEMU_IMG_EXTRA_ARGS=
     if [ "$IMGPROTO" = "file" ]; then
         TEST_IMG=$TEST_DIR/t.$IMGFMT
     elif [ "$IMGPROTO" = "nbd" ]; then
@@ -168,6 +173,26 @@ else
 fi
 ORIG_TEST_IMG="$TEST_IMG"
 
+if [ -z "$TEST_DIR" ]; then
+        TEST_DIR=`pwd`/scratch
+fi
+
+QEMU_TEST_DIR="${TEST_DIR}"
+
+if [ ! -e "$TEST_DIR" ]; then
+        mkdir "$TEST_DIR"
+fi
+
+if [ ! -d "$TEST_DIR" ]; then
+    echo "common.config: Error: \$TEST_DIR ($TEST_DIR) is not a directory"
+    exit 1
+fi
+
+if [ ! -d "$SAMPLE_IMG_DIR" ]; then
+    echo "common.config: Error: \$SAMPLE_IMG_DIR ($SAMPLE_IMG_DIR) is not a directory"
+    exit 1
+fi
+
 _use_sample_img()
 {
     SAMPLE_IMG_FILE="${1%\.bz2}"
-- 
2.13.3

^ permalink raw reply related	[flat|nested] 34+ messages in thread

* [Qemu-devel] [PATCH 08/12] qemu-iotests: fix uninitialized variable
  2017-08-09 21:54 [Qemu-devel] [PATCH 00/12] cleanup qemu-iotests Paolo Bonzini
                   ` (6 preceding siblings ...)
  2017-08-09 21:55 ` [Qemu-devel] [PATCH 07/12] qemu-iotests: disintegrate more parts of common.config Paolo Bonzini
@ 2017-08-09 21:55 ` Paolo Bonzini
  2017-08-10  9:17   ` Markus Armbruster
  2017-08-09 21:55 ` [Qemu-devel] [PATCH 09/12] qemu-iotests: do not search for binaries in the current directory Paolo Bonzini
                   ` (4 subsequent siblings)
  12 siblings, 1 reply; 34+ messages in thread
From: Paolo Bonzini @ 2017-08-09 21:55 UTC (permalink / raw)
  To: qemu-devel; +Cc: qemu-block, kwolf

The function is used in "common" but defined only after the file
is sourced.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 tests/qemu-iotests/check  | 2 --
 tests/qemu-iotests/common | 2 ++
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/tests/qemu-iotests/check b/tests/qemu-iotests/check
index 1ef6d0ac3a..5b9c0c8ade 100755
--- a/tests/qemu-iotests/check
+++ b/tests/qemu-iotests/check
@@ -118,8 +118,6 @@ fi
 
 TIMESTAMP_FILE=check.time-$IMGPROTO-$IMGFMT
 
-tmp="${TEST_DIR}"/$$
-
 _wallclock()
 {
     date "+%H %M %S" | awk '{ print $1*3600 + $2*60 + $3 }'
diff --git a/tests/qemu-iotests/common b/tests/qemu-iotests/common
index adf427501e..35e4d0f87b 100644
--- a/tests/qemu-iotests/common
+++ b/tests/qemu-iotests/common
@@ -80,6 +80,8 @@ sortme=false
 expunge=true
 have_test_arg=false
 cachemode=false
+
+tmp="${TEST_DIR}"/$$
 rm -f $tmp.list $tmp.tmp $tmp.sed
 
 export IMGFMT=raw
-- 
2.13.3

^ permalink raw reply related	[flat|nested] 34+ messages in thread

* [Qemu-devel] [PATCH 09/12] qemu-iotests: do not search for binaries in the current directory
  2017-08-09 21:54 [Qemu-devel] [PATCH 00/12] cleanup qemu-iotests Paolo Bonzini
                   ` (7 preceding siblings ...)
  2017-08-09 21:55 ` [Qemu-devel] [PATCH 08/12] qemu-iotests: fix uninitialized variable Paolo Bonzini
@ 2017-08-09 21:55 ` Paolo Bonzini
  2017-08-10  9:18   ` Markus Armbruster
  2017-08-09 21:55 ` [Qemu-devel] [PATCH 10/12] qemu-iotests: get rid of $iam Paolo Bonzini
                   ` (3 subsequent siblings)
  12 siblings, 1 reply; 34+ messages in thread
From: Paolo Bonzini @ 2017-08-09 21:55 UTC (permalink / raw)
  To: qemu-devel; +Cc: qemu-block, kwolf

Looking in the build root is enough.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 tests/qemu-iotests/check | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/tests/qemu-iotests/check b/tests/qemu-iotests/check
index 5b9c0c8ade..e5d1ae3d92 100755
--- a/tests/qemu-iotests/check
+++ b/tests/qemu-iotests/check
@@ -86,17 +86,17 @@ then
     fi
 fi
 
-if [[ -z $QEMU_IMG_PROG && -x "$build_root/qemu-img" && ! -x './qemu-img' ]]
+if [[ -z $QEMU_IMG_PROG && -x "$build_root/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' ]]
+if [[ -z $QEMU_IO_PROG && -x "$build_root/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' ]]
+if [[ -z $QEMU_NBD_PROG && -x "$build_root/qemu-nbd" ]]
 then
     export QEMU_NBD_PROG="$build_root/qemu-nbd"
 fi
-- 
2.13.3

^ permalink raw reply related	[flat|nested] 34+ messages in thread

* [Qemu-devel] [PATCH 10/12] qemu-iotests: get rid of $iam
  2017-08-09 21:54 [Qemu-devel] [PATCH 00/12] cleanup qemu-iotests Paolo Bonzini
                   ` (8 preceding siblings ...)
  2017-08-09 21:55 ` [Qemu-devel] [PATCH 09/12] qemu-iotests: do not search for binaries in the current directory Paolo Bonzini
@ 2017-08-09 21:55 ` Paolo Bonzini
  2017-08-09 22:23   ` Philippe Mathieu-Daudé
  2017-08-09 21:55 ` [Qemu-devel] [PATCH 11/12] qemu-iotests: include common.env and common.config early Paolo Bonzini
                   ` (2 subsequent siblings)
  12 siblings, 1 reply; 34+ messages in thread
From: Paolo Bonzini @ 2017-08-09 21:55 UTC (permalink / raw)
  To: qemu-devel; +Cc: qemu-block, kwolf

The variable is almost unused, and one of the two uses is actually
uninitialized.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 tests/qemu-iotests/check     | 5 +----
 tests/qemu-iotests/common.rc | 2 +-
 2 files changed, 2 insertions(+), 5 deletions(-)

diff --git a/tests/qemu-iotests/check b/tests/qemu-iotests/check
index e5d1ae3d92..dc60e17e6a 100755
--- a/tests/qemu-iotests/check
+++ b/tests/qemu-iotests/check
@@ -30,12 +30,9 @@ interrupt=true
 # by default don't output timestamps
 timestamp=${TIMESTAMP:=false}
 
-# generic initialization
-iam=check
-
 _init_error()
 {
-    echo "$iam: $1" >&2
+    echo "check: $1" >&2
     exit 1
 }
 
diff --git a/tests/qemu-iotests/common.rc b/tests/qemu-iotests/common.rc
index 7046a83974..d0aa22543e 100644
--- a/tests/qemu-iotests/common.rc
+++ b/tests/qemu-iotests/common.rc
@@ -43,7 +43,7 @@ poke_file()
 
 if ! . ./common.config
     then
-    echo "$iam: failed to source common.config"
+    echo "$0: failed to source common.config"
     exit 1
 fi
 
-- 
2.13.3

^ permalink raw reply related	[flat|nested] 34+ messages in thread

* [Qemu-devel] [PATCH 11/12] qemu-iotests: include common.env and common.config early
  2017-08-09 21:54 [Qemu-devel] [PATCH 00/12] cleanup qemu-iotests Paolo Bonzini
                   ` (9 preceding siblings ...)
  2017-08-09 21:55 ` [Qemu-devel] [PATCH 10/12] qemu-iotests: get rid of $iam Paolo Bonzini
@ 2017-08-09 21:55 ` Paolo Bonzini
  2017-08-09 21:55 ` [Qemu-devel] [PATCH 12/12] qemu-iotests: merge "check" and "common" Paolo Bonzini
  2017-09-11 22:22 ` [Qemu-devel] [Qemu-block] [PATCH 00/12] cleanup qemu-iotests John Snow
  12 siblings, 0 replies; 34+ messages in thread
From: Paolo Bonzini @ 2017-08-09 21:55 UTC (permalink / raw)
  To: qemu-devel; +Cc: qemu-block, kwolf

They are now very small and they do not have external dependencies.  We
can source them as soon as we have their path.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 tests/qemu-iotests/check | 24 ++++++++++++------------
 1 file changed, 12 insertions(+), 12 deletions(-)

diff --git a/tests/qemu-iotests/check b/tests/qemu-iotests/check
index dc60e17e6a..28b3444963 100755
--- a/tests/qemu-iotests/check
+++ b/tests/qemu-iotests/check
@@ -55,6 +55,18 @@ else
     build_iotests=$PWD
 fi
 
+# we need common.env
+if ! . "$build_iotests/common.env"
+then
+    _init_error "failed to source common.env (make sure the qemu-iotests are run from tests/qemu-iotests in the build tree)"
+fi
+
+# we need common.config
+if ! . "$source_iotests/common.config"
+then
+    _init_error "failed to source common.config"
+fi
+
 build_root="$build_iotests/../.."
 
 if [ -x "$build_iotests/socket_scm_helper" ]
@@ -98,18 +110,6 @@ then
     export QEMU_NBD_PROG="$build_root/qemu-nbd"
 fi
 
-# we need common.env
-if ! . "$build_iotests/common.env"
-then
-    _init_error "failed to source common.env (make sure the qemu-iotests are run from tests/qemu-iotests in the build tree)"
-fi
-
-# we need common.config
-if ! . "$source_iotests/common.config"
-then
-    _init_error "failed to source common.config"
-fi
-
 # we need common
 . "$source_iotests/common"
 
-- 
2.13.3

^ permalink raw reply related	[flat|nested] 34+ messages in thread

* [Qemu-devel] [PATCH 12/12] qemu-iotests: merge "check" and "common"
  2017-08-09 21:54 [Qemu-devel] [PATCH 00/12] cleanup qemu-iotests Paolo Bonzini
                   ` (10 preceding siblings ...)
  2017-08-09 21:55 ` [Qemu-devel] [PATCH 11/12] qemu-iotests: include common.env and common.config early Paolo Bonzini
@ 2017-08-09 21:55 ` Paolo Bonzini
  2017-09-11 22:22 ` [Qemu-devel] [Qemu-block] [PATCH 00/12] cleanup qemu-iotests John Snow
  12 siblings, 0 replies; 34+ messages in thread
From: Paolo Bonzini @ 2017-08-09 21:55 UTC (permalink / raw)
  To: qemu-devel; +Cc: qemu-block, kwolf

"check" is full of qemu-iotests--specific details.  Separating it
from "common" does not make much sense anymore.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 tests/qemu-iotests/check  | 482 +++++++++++++++++++++++++++++++++++++++++++-
 tests/qemu-iotests/common | 501 ----------------------------------------------
 2 files changed, 480 insertions(+), 503 deletions(-)
 delete mode 100644 tests/qemu-iotests/common

diff --git a/tests/qemu-iotests/check b/tests/qemu-iotests/check
index 28b3444963..6d4d01e432 100755
--- a/tests/qemu-iotests/check
+++ b/tests/qemu-iotests/check
@@ -110,8 +110,486 @@ then
     export QEMU_NBD_PROG="$build_root/qemu-nbd"
 fi
 
-# we need common
-. "$source_iotests/common"
+_full_imgfmt_details()
+{
+    if [ -n "$IMGOPTS" ]; then
+        echo "$IMGFMT ($IMGOPTS)"
+    else
+        echo "$IMGFMT"
+    fi
+}
+
+_full_imgproto_details()
+{
+    echo "$IMGPROTO"
+}
+
+_full_platform_details()
+{
+    os=`uname -s`
+    host=`hostname -s`
+    kernel=`uname -r`
+    platform=`uname -m`
+    echo "$os/$platform $host $kernel"
+}
+
+# $1 = prog to look for
+set_prog_path()
+{
+    p=`command -v $1 2> /dev/null`
+    if [ -n "$p" -a -x "$p" ]; then
+        realpath -- "$(type -p "$p")"
+    else
+        return 1
+    fi
+}
+
+export QEMU_PROG=$(realpath -- "$(type -p "$QEMU_PROG")")
+export QEMU_IMG_PROG=$(realpath -- "$(type -p "$QEMU_IMG_PROG")")
+export QEMU_IO_PROG=$(realpath -- "$(type -p "$QEMU_IO_PROG")")
+export QEMU_NBD_PROG=$(realpath -- "$(type -p "$QEMU_NBD_PROG")")
+if [ -z "$QEMU_VXHS_PROG" ]; then
+  export QEMU_VXHS_PROG="`set_prog_path qnio_server`"
+fi
+
+if [ -z "$TEST_DIR" ]; then
+        TEST_DIR=`pwd`/scratch
+fi
+
+if [ ! -e "$TEST_DIR" ]; then
+        mkdir "$TEST_DIR"
+fi
+
+diff="diff -u"
+verbose=false
+debug=false
+group=false
+xgroup=false
+imgopts=false
+showme=false
+sortme=false
+expunge=true
+have_test_arg=false
+cachemode=false
+
+tmp="${TEST_DIR}"/$$
+rm -f $tmp.list $tmp.tmp $tmp.sed
+
+export IMGFMT=raw
+export IMGFMT_GENERIC=true
+export IMGPROTO=file
+export IMGOPTS=""
+export CACHEMODE="writeback"
+export QEMU_IO_OPTIONS=""
+export QEMU_IO_OPTIONS_NO_FMT=""
+export CACHEMODE_IS_DEFAULT=true
+export QEMU_OPTIONS="-nodefaults -machine accel=qtest"
+export VALGRIND_QEMU=
+export IMGKEYSECRET=
+export IMGOPTSSYNTAX=false
+
+default_machine=$($QEMU_PROG -machine help | sed -n '/(default)/ s/ .*//p')
+default_alias_machine=$($QEMU_PROG -machine help | \
+   sed -n "/(alias of $default_machine)/ { s/ .*//p; q; }")
+if [[ "$default_alias_machine" ]]; then
+    default_machine="$default_alias_machine"
+fi
+
+export QEMU_DEFAULT_MACHINE="$default_machine"
+
+for r
+do
+
+    if $group
+    then
+        # arg after -g
+        group_list=`sed -n <"$source_iotests/group" -e 's/$/ /' -e "/^[0-9][0-9][0-9].* $r /"'{
+s/ .*//p
+}'`
+        if [ -z "$group_list" ]
+        then
+            echo "Group \"$r\" is empty or not defined?"
+            exit 1
+        fi
+        [ ! -s $tmp.list ] && touch $tmp.list
+        for t in $group_list
+        do
+            if grep -s "^$t\$" $tmp.list >/dev/null
+            then
+                :
+            else
+                echo "$t" >>$tmp.list
+            fi
+        done
+        group=false
+        continue
+
+    elif $xgroup
+    then
+        # arg after -x
+        # Populate $tmp.list with all tests
+        awk '/^[0-9]{3,}/ {print $1}' "${source_iotests}/group" > $tmp.list 2>/dev/null
+        group_list=`sed -n <"$source_iotests/group" -e 's/$/ /' -e "/^[0-9][0-9][0-9].* $r /"'{
+s/ .*//p
+}'`
+        if [ -z "$group_list" ]
+        then
+            echo "Group \"$r\" is empty or not defined?"
+            exit 1
+        fi
+        numsed=0
+        rm -f $tmp.sed
+        for t in $group_list
+        do
+            if [ $numsed -gt 100 ]
+            then
+                sed -f $tmp.sed <$tmp.list >$tmp.tmp
+                mv $tmp.tmp $tmp.list
+                numsed=0
+                rm -f $tmp.sed
+            fi
+            echo "/^$t\$/d" >>$tmp.sed
+            numsed=`expr $numsed + 1`
+        done
+        sed -f $tmp.sed <$tmp.list >$tmp.tmp
+        mv $tmp.tmp $tmp.list
+        xgroup=false
+        continue
+
+    elif $imgopts
+    then
+        IMGOPTS="$r"
+        imgopts=false
+        continue
+    elif $cachemode
+    then
+        CACHEMODE="$r"
+        CACHEMODE_IS_DEFAULT=false
+        cachemode=false
+        continue
+    fi
+
+    xpand=true
+    case "$r"
+    in
+
+        -\? | -h | --help)        # usage
+            echo "Usage: $0 [options] [testlist]"'
+
+common options
+    -v                  verbose
+    -d                  debug
+
+image format options
+    -raw                test raw (default)
+    -bochs              test bochs
+    -cloop              test cloop
+    -parallels          test parallels
+    -qcow               test qcow
+    -qcow2              test qcow2
+    -qed                test qed
+    -vdi                test vdi
+    -vpc                test vpc
+    -vhdx               test vhdx
+    -vmdk               test vmdk
+    -luks               test luks
+
+image protocol options
+    -file               test file (default)
+    -rbd                test rbd
+    -sheepdog           test sheepdog
+    -nbd                test nbd
+    -ssh                test ssh
+    -nfs                test nfs
+    -vxhs               test vxhs
+
+other options
+    -xdiff              graphical mode diff
+    -nocache            use O_DIRECT on backing file
+    -misalign           misalign memory allocations
+    -n                  show me, do not run tests
+    -o options          -o options to pass to qemu-img create/convert
+    -T                  output timestamps
+    -c mode             cache mode
+
+testlist options
+    -g group[,group...]        include tests from these groups
+    -x group[,group...]        exclude tests from these groups
+    NNN                        include test NNN
+    NNN-NNN                    include test range (eg. 012-021)
+'
+            exit 0
+            ;;
+
+        -raw)
+            IMGFMT=raw
+            xpand=false
+            ;;
+
+        -bochs)
+            IMGFMT=bochs
+            IMGFMT_GENERIC=false
+            xpand=false
+            ;;
+
+        -cloop)
+            IMGFMT=cloop
+            IMGFMT_GENERIC=false
+            xpand=false
+            ;;
+
+        -parallels)
+            IMGFMT=parallels
+            IMGFMT_GENERIC=false
+            xpand=false
+            ;;
+
+        -qcow)
+            IMGFMT=qcow
+            xpand=false
+            ;;
+
+        -qcow2)
+            IMGFMT=qcow2
+            xpand=false
+            ;;
+
+        -luks)
+            IMGOPTSSYNTAX=true
+            IMGFMT=luks
+            IMGKEYSECRET=123456
+            xpand=false
+            ;;
+
+        -qed)
+            IMGFMT=qed
+            xpand=false
+            ;;
+
+        -vdi)
+            IMGFMT=vdi
+            xpand=false
+            ;;
+
+        -vmdk)
+            IMGFMT=vmdk
+            xpand=false
+            ;;
+
+        -vpc)
+            IMGFMT=vpc
+            xpand=false
+            ;;
+
+        -vhdx)
+            IMGFMT=vhdx
+            xpand=false
+            ;;
+
+        -file)
+            IMGPROTO=file
+            xpand=false
+            ;;
+
+        -rbd)
+            IMGPROTO=rbd
+            xpand=false
+            ;;
+
+        -sheepdog)
+            IMGPROTO=sheepdog
+            xpand=false
+            ;;
+
+        -nbd)
+            IMGPROTO=nbd
+            xpand=false
+            ;;
+
+        -vxhs)
+            IMGPROTO=vxhs
+            xpand=false
+            ;;
+
+        -ssh)
+            IMGPROTO=ssh
+            xpand=false
+            ;;
+
+        -nfs)
+            IMGPROTO=nfs
+            xpand=false
+            ;;
+
+        -nocache)
+            CACHEMODE="none"
+            CACHEMODE_IS_DEFAULT=false
+            xpand=false
+            ;;
+
+        -misalign)
+            QEMU_IO_OPTIONS="$QEMU_IO_OPTIONS --misalign"
+            xpand=false
+            ;;
+
+        -valgrind)
+            VALGRIND_QEMU='y'
+            xpand=false
+            ;;
+
+        -g)        # -g group ... pick from group file
+            group=true
+            xpand=false
+            ;;
+
+        -xdiff)        # graphical diff mode
+            xpand=false
+
+            if [ ! -z "$DISPLAY" ]
+            then
+                command -v xdiff >/dev/null 2>&1 && diff=xdiff
+                command -v gdiff >/dev/null 2>&1 && diff=gdiff
+                command -v tkdiff >/dev/null 2>&1 && diff=tkdiff
+                command -v xxdiff >/dev/null 2>&1 && diff=xxdiff
+            fi
+            ;;
+
+        -n)        # show me, don't do it
+            showme=true
+            xpand=false
+            ;;
+        -o)
+            imgopts=true
+            xpand=false
+            ;;
+        -c)
+            cachemode=true
+            xpand=false
+            ;;
+        -T)        # turn on timestamp output
+            timestamp=true
+            xpand=false
+            ;;
+
+        -v)
+            verbose=true
+            xpand=false
+            ;;
+        -d)
+            debug=true
+            xpand=false
+            ;;
+        -x)        # -x group ... exclude from group file
+            xgroup=true
+            xpand=false
+            ;;
+        '[0-9][0-9][0-9] [0-9][0-9][0-9][0-9]')
+            echo "No tests?"
+            status=1
+            exit $status
+            ;;
+
+        [0-9]*-[0-9]*)
+            eval `echo $r | sed -e 's/^/start=/' -e 's/-/ end=/'`
+            ;;
+
+        [0-9]*-)
+            eval `echo $r | sed -e 's/^/start=/' -e 's/-//'`
+            end=`echo [0-9][0-9][0-9] [0-9][0-9][0-9][0-9] | sed -e 's/\[0-9]//g' -e 's/  *$//' -e 's/.* //'`
+            if [ -z "$end" ]
+            then
+                echo "No tests in range \"$r\"?"
+                status=1
+                exit $status
+            fi
+            ;;
+
+        *)
+            start=$r
+            end=$r
+            ;;
+
+    esac
+
+    # get rid of leading 0s as can be interpreted as octal
+    start=`echo $start | sed 's/^0*//'`
+    end=`echo $end | sed 's/^0*//'`
+
+    if $xpand
+    then
+        have_test_arg=true
+        awk </dev/null '
+BEGIN        { for (t='$start'; t<='$end'; t++) printf "%03d\n",t }' \
+        | while read id
+        do
+            if grep -s "^$id " "$source_iotests/group" >/dev/null
+            then
+                # in group file ... OK
+                echo $id >>$tmp.list
+            else
+                if [ -f expunged ] && $expunge && egrep "^$id([         ]|\$)" expunged >/dev/null
+                then
+                    # expunged ... will be reported, but not run, later
+                    echo $id >>$tmp.list
+                else
+                    # oops
+                    if [ "$start" == "$end" -a "$id" == "$end" ]
+                    then
+                        echo "$id - unknown test"
+                        exit 1
+                    else
+                        echo "$id - unknown test, ignored"
+                    fi
+                fi
+            fi
+        done || exit 1
+    fi
+
+done
+
+# Set qemu-io cache mode with $CACHEMODE we have
+QEMU_IO_OPTIONS="$QEMU_IO_OPTIONS --cache $CACHEMODE"
+
+QEMU_IO_OPTIONS_NO_FMT="$QEMU_IO_OPTIONS"
+if [ "$IMGOPTSSYNTAX" != "true" ]; then
+    QEMU_IO_OPTIONS="$QEMU_IO_OPTIONS -f $IMGFMT"
+fi
+
+# Set default options for qemu-img create -o if they were not specified
+if [ "$IMGFMT" == "qcow2" ] && ! (echo "$IMGOPTS" | grep "compat=" > /dev/null); then
+    IMGOPTS=$(_optstr_add "$IMGOPTS" "compat=1.1")
+fi
+if [ "$IMGFMT" == "luks" ] && ! (echo "$IMGOPTS" | grep "iter-time=" > /dev/null); then
+    IMGOPTS=$(_optstr_add "$IMGOPTS" "iter-time=10")
+fi
+
+if [ -z "$SAMPLE_IMG_DIR" ]; then
+        SAMPLE_IMG_DIR="$source_iotests/sample_images"
+fi
+
+export TEST_DIR
+export SAMPLE_IMG_DIR
+
+if [ -s $tmp.list ]
+then
+    # found some valid test numbers ... this is good
+    :
+else
+    if $have_test_arg
+    then
+        # had test numbers, but none in group file ... do nothing
+        touch $tmp.list
+    else
+        # no test numbers, do everything from group file
+        sed -n -e '/^[0-9][0-9][0-9]*/s/[         ].*//p' <"$source_iotests/group" >$tmp.list
+    fi
+fi
+
+# should be sort -n, but this did not work for Linux when this
+# was ported from IRIX
+#
+list=`sort $tmp.list`
+rm -f $tmp.list $tmp.tmp $tmp.sed
 
 TIMESTAMP_FILE=check.time-$IMGPROTO-$IMGFMT
 
diff --git a/tests/qemu-iotests/common b/tests/qemu-iotests/common
deleted file mode 100644
index 35e4d0f87b..0000000000
--- a/tests/qemu-iotests/common
+++ /dev/null
@@ -1,501 +0,0 @@
-#!/bin/bash
-#
-# Copyright (C) 2009 Red Hat, Inc.
-# Copyright (c) 2000-2005 Silicon Graphics, Inc.  All Rights Reserved.
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License as
-# published by the Free Software Foundation.
-#
-# This program is distributed in the hope that it would be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program.  If not, see <http://www.gnu.org/licenses/>.
-#
-#
-# common procedures for QA scripts
-#
-
-_full_imgfmt_details()
-{
-    if [ -n "$IMGOPTS" ]; then
-        echo "$IMGFMT ($IMGOPTS)"
-    else
-        echo "$IMGFMT"
-    fi
-}
-
-_full_imgproto_details()
-{
-    echo "$IMGPROTO"
-}
-
-_full_platform_details()
-{
-    os=`uname -s`
-    host=`hostname -s`
-    kernel=`uname -r`
-    platform=`uname -m`
-    echo "$os/$platform $host $kernel"
-}
-
-# $1 = prog to look for
-set_prog_path()
-{
-    p=`command -v $1 2> /dev/null`
-    if [ -n "$p" -a -x "$p" ]; then
-        realpath -- "$(type -p "$p")"
-    else
-        return 1
-    fi
-}
-
-export QEMU_PROG=$(realpath -- "$(type -p "$QEMU_PROG")")
-export QEMU_IMG_PROG=$(realpath -- "$(type -p "$QEMU_IMG_PROG")")
-export QEMU_IO_PROG=$(realpath -- "$(type -p "$QEMU_IO_PROG")")
-export QEMU_NBD_PROG=$(realpath -- "$(type -p "$QEMU_NBD_PROG")")
-if [ -z "$QEMU_VXHS_PROG" ]; then
-  export QEMU_VXHS_PROG="`set_prog_path qnio_server`"
-fi
-
-if [ -z "$TEST_DIR" ]; then
-        TEST_DIR=`pwd`/scratch
-fi
-
-if [ ! -e "$TEST_DIR" ]; then
-        mkdir "$TEST_DIR"
-fi
-
-diff="diff -u"
-verbose=false
-debug=false
-group=false
-xgroup=false
-imgopts=false
-showme=false
-sortme=false
-expunge=true
-have_test_arg=false
-cachemode=false
-
-tmp="${TEST_DIR}"/$$
-rm -f $tmp.list $tmp.tmp $tmp.sed
-
-export IMGFMT=raw
-export IMGFMT_GENERIC=true
-export IMGPROTO=file
-export IMGOPTS=""
-export CACHEMODE="writeback"
-export QEMU_IO_OPTIONS=""
-export QEMU_IO_OPTIONS_NO_FMT=""
-export CACHEMODE_IS_DEFAULT=true
-export QEMU_OPTIONS="-nodefaults -machine accel=qtest"
-export VALGRIND_QEMU=
-export IMGKEYSECRET=
-export IMGOPTSSYNTAX=false
-
-default_machine=$($QEMU_PROG -machine help | sed -n '/(default)/ s/ .*//p')
-default_alias_machine=$($QEMU_PROG -machine help | \
-   sed -n "/(alias of $default_machine)/ { s/ .*//p; q; }")
-if [[ "$default_alias_machine" ]]; then
-    default_machine="$default_alias_machine"
-fi
-
-export QEMU_DEFAULT_MACHINE="$default_machine"
-
-for r
-do
-
-    if $group
-    then
-        # arg after -g
-        group_list=`sed -n <"$source_iotests/group" -e 's/$/ /' -e "/^[0-9][0-9][0-9].* $r /"'{
-s/ .*//p
-}'`
-        if [ -z "$group_list" ]
-        then
-            echo "Group \"$r\" is empty or not defined?"
-            exit 1
-        fi
-        [ ! -s $tmp.list ] && touch $tmp.list
-        for t in $group_list
-        do
-            if grep -s "^$t\$" $tmp.list >/dev/null
-            then
-                :
-            else
-                echo "$t" >>$tmp.list
-            fi
-        done
-        group=false
-        continue
-
-    elif $xgroup
-    then
-        # arg after -x
-        # Populate $tmp.list with all tests
-        awk '/^[0-9]{3,}/ {print $1}' "${source_iotests}/group" > $tmp.list 2>/dev/null
-        group_list=`sed -n <"$source_iotests/group" -e 's/$/ /' -e "/^[0-9][0-9][0-9].* $r /"'{
-s/ .*//p
-}'`
-        if [ -z "$group_list" ]
-        then
-            echo "Group \"$r\" is empty or not defined?"
-            exit 1
-        fi
-        numsed=0
-        rm -f $tmp.sed
-        for t in $group_list
-        do
-            if [ $numsed -gt 100 ]
-            then
-                sed -f $tmp.sed <$tmp.list >$tmp.tmp
-                mv $tmp.tmp $tmp.list
-                numsed=0
-                rm -f $tmp.sed
-            fi
-            echo "/^$t\$/d" >>$tmp.sed
-            numsed=`expr $numsed + 1`
-        done
-        sed -f $tmp.sed <$tmp.list >$tmp.tmp
-        mv $tmp.tmp $tmp.list
-        xgroup=false
-        continue
-
-    elif $imgopts
-    then
-        IMGOPTS="$r"
-        imgopts=false
-        continue
-    elif $cachemode
-    then
-        CACHEMODE="$r"
-        CACHEMODE_IS_DEFAULT=false
-        cachemode=false
-        continue
-    fi
-
-    xpand=true
-    case "$r"
-    in
-
-        -\? | -h | --help)        # usage
-            echo "Usage: $0 [options] [testlist]"'
-
-common options
-    -v                  verbose
-    -d                  debug
-
-image format options
-    -raw                test raw (default)
-    -bochs              test bochs
-    -cloop              test cloop
-    -parallels          test parallels
-    -qcow               test qcow
-    -qcow2              test qcow2
-    -qed                test qed
-    -vdi                test vdi
-    -vpc                test vpc
-    -vhdx               test vhdx
-    -vmdk               test vmdk
-    -luks               test luks
-
-image protocol options
-    -file               test file (default)
-    -rbd                test rbd
-    -sheepdog           test sheepdog
-    -nbd                test nbd
-    -ssh                test ssh
-    -nfs                test nfs
-    -vxhs               test vxhs
-
-other options
-    -xdiff              graphical mode diff
-    -nocache            use O_DIRECT on backing file
-    -misalign           misalign memory allocations
-    -n                  show me, do not run tests
-    -o options          -o options to pass to qemu-img create/convert
-    -T                  output timestamps
-    -c mode             cache mode
-
-testlist options
-    -g group[,group...]        include tests from these groups
-    -x group[,group...]        exclude tests from these groups
-    NNN                        include test NNN
-    NNN-NNN                    include test range (eg. 012-021)
-'
-            exit 0
-            ;;
-
-        -raw)
-            IMGFMT=raw
-            xpand=false
-            ;;
-
-        -bochs)
-            IMGFMT=bochs
-            IMGFMT_GENERIC=false
-            xpand=false
-            ;;
-
-        -cloop)
-            IMGFMT=cloop
-            IMGFMT_GENERIC=false
-            xpand=false
-            ;;
-
-        -parallels)
-            IMGFMT=parallels
-            IMGFMT_GENERIC=false
-            xpand=false
-            ;;
-
-        -qcow)
-            IMGFMT=qcow
-            xpand=false
-            ;;
-
-        -qcow2)
-            IMGFMT=qcow2
-            xpand=false
-            ;;
-
-        -luks)
-            IMGOPTSSYNTAX=true
-            IMGFMT=luks
-            IMGKEYSECRET=123456
-            xpand=false
-            ;;
-
-        -qed)
-            IMGFMT=qed
-            xpand=false
-            ;;
-
-        -vdi)
-            IMGFMT=vdi
-            xpand=false
-            ;;
-
-        -vmdk)
-            IMGFMT=vmdk
-            xpand=false
-            ;;
-
-        -vpc)
-            IMGFMT=vpc
-            xpand=false
-            ;;
-
-        -vhdx)
-            IMGFMT=vhdx
-            xpand=false
-            ;;
-
-        -file)
-            IMGPROTO=file
-            xpand=false
-            ;;
-
-        -rbd)
-            IMGPROTO=rbd
-            xpand=false
-            ;;
-
-        -sheepdog)
-            IMGPROTO=sheepdog
-            xpand=false
-            ;;
-
-        -nbd)
-            IMGPROTO=nbd
-            xpand=false
-            ;;
-
-        -vxhs)
-            IMGPROTO=vxhs
-            xpand=false
-            ;;
-
-        -ssh)
-            IMGPROTO=ssh
-            xpand=false
-            ;;
-
-        -nfs)
-            IMGPROTO=nfs
-            xpand=false
-            ;;
-
-        -nocache)
-            CACHEMODE="none"
-            CACHEMODE_IS_DEFAULT=false
-            xpand=false
-            ;;
-
-        -misalign)
-            QEMU_IO_OPTIONS="$QEMU_IO_OPTIONS --misalign"
-            xpand=false
-            ;;
-
-        -valgrind)
-            VALGRIND_QEMU='y'
-            xpand=false
-            ;;
-
-        -g)        # -g group ... pick from group file
-            group=true
-            xpand=false
-            ;;
-
-        -xdiff)        # graphical diff mode
-            xpand=false
-
-            if [ ! -z "$DISPLAY" ]
-            then
-                command -v xdiff >/dev/null 2>&1 && diff=xdiff
-                command -v gdiff >/dev/null 2>&1 && diff=gdiff
-                command -v tkdiff >/dev/null 2>&1 && diff=tkdiff
-                command -v xxdiff >/dev/null 2>&1 && diff=xxdiff
-            fi
-            ;;
-
-        -n)        # show me, don't do it
-            showme=true
-            xpand=false
-            ;;
-        -o)
-            imgopts=true
-            xpand=false
-            ;;
-        -c)
-            cachemode=true
-            xpand=false
-            ;;
-        -T)        # turn on timestamp output
-            timestamp=true
-            xpand=false
-            ;;
-
-        -v)
-            verbose=true
-            xpand=false
-            ;;
-        -d)
-            debug=true
-            xpand=false
-            ;;
-        -x)        # -x group ... exclude from group file
-            xgroup=true
-            xpand=false
-            ;;
-        '[0-9][0-9][0-9] [0-9][0-9][0-9][0-9]')
-            echo "No tests?"
-            status=1
-            exit $status
-            ;;
-
-        [0-9]*-[0-9]*)
-            eval `echo $r | sed -e 's/^/start=/' -e 's/-/ end=/'`
-            ;;
-
-        [0-9]*-)
-            eval `echo $r | sed -e 's/^/start=/' -e 's/-//'`
-            end=`echo [0-9][0-9][0-9] [0-9][0-9][0-9][0-9] | sed -e 's/\[0-9]//g' -e 's/  *$//' -e 's/.* //'`
-            if [ -z "$end" ]
-            then
-                echo "No tests in range \"$r\"?"
-                status=1
-                exit $status
-            fi
-            ;;
-
-        *)
-            start=$r
-            end=$r
-            ;;
-
-    esac
-
-    # get rid of leading 0s as can be interpreted as octal
-    start=`echo $start | sed 's/^0*//'`
-    end=`echo $end | sed 's/^0*//'`
-
-    if $xpand
-    then
-        have_test_arg=true
-        awk </dev/null '
-BEGIN        { for (t='$start'; t<='$end'; t++) printf "%03d\n",t }' \
-        | while read id
-        do
-            if grep -s "^$id " "$source_iotests/group" >/dev/null
-            then
-                # in group file ... OK
-                echo $id >>$tmp.list
-            else
-                if [ -f expunged ] && $expunge && egrep "^$id([         ]|\$)" expunged >/dev/null
-                then
-                    # expunged ... will be reported, but not run, later
-                    echo $id >>$tmp.list
-                else
-                    # oops
-                    if [ "$start" == "$end" -a "$id" == "$end" ]
-                    then
-                        echo "$id - unknown test"
-                        exit 1
-                    else
-                        echo "$id - unknown test, ignored"
-                    fi
-                fi
-            fi
-        done || exit 1
-    fi
-
-done
-
-# Set qemu-io cache mode with $CACHEMODE we have
-QEMU_IO_OPTIONS="$QEMU_IO_OPTIONS --cache $CACHEMODE"
-
-QEMU_IO_OPTIONS_NO_FMT="$QEMU_IO_OPTIONS"
-if [ "$IMGOPTSSYNTAX" != "true" ]; then
-    QEMU_IO_OPTIONS="$QEMU_IO_OPTIONS -f $IMGFMT"
-fi
-
-# Set default options for qemu-img create -o if they were not specified
-if [ "$IMGFMT" == "qcow2" ] && ! (echo "$IMGOPTS" | grep "compat=" > /dev/null); then
-    IMGOPTS=$(_optstr_add "$IMGOPTS" "compat=1.1")
-fi
-if [ "$IMGFMT" == "luks" ] && ! (echo "$IMGOPTS" | grep "iter-time=" > /dev/null); then
-    IMGOPTS=$(_optstr_add "$IMGOPTS" "iter-time=10")
-fi
-
-if [ -z "$SAMPLE_IMG_DIR" ]; then
-        SAMPLE_IMG_DIR="$source_iotests/sample_images"
-fi
-
-export TEST_DIR
-export SAMPLE_IMG_DIR
-
-if [ -s $tmp.list ]
-then
-    # found some valid test numbers ... this is good
-    :
-else
-    if $have_test_arg
-    then
-        # had test numbers, but none in group file ... do nothing
-        touch $tmp.list
-    else
-        # no test numbers, do everything from group file
-        sed -n -e '/^[0-9][0-9][0-9]*/s/[         ].*//p' <"$source_iotests/group" >$tmp.list
-    fi
-fi
-
-# should be sort -n, but this did not work for Linux when this
-# was ported from IRIX
-#
-list=`sort $tmp.list`
-rm -f $tmp.list $tmp.tmp $tmp.sed
-- 
2.13.3

^ permalink raw reply related	[flat|nested] 34+ messages in thread

* Re: [Qemu-devel] [PATCH 01/12] qemu-iotests: remove dead code
  2017-08-09 21:54 ` [Qemu-devel] [PATCH 01/12] qemu-iotests: remove dead code Paolo Bonzini
@ 2017-08-09 22:18   ` Eric Blake
  2017-08-09 22:43     ` Paolo Bonzini
  2017-08-10  9:53     ` [Qemu-devel] [Qemu-block] " Paolo Bonzini
  0 siblings, 2 replies; 34+ messages in thread
From: Eric Blake @ 2017-08-09 22:18 UTC (permalink / raw)
  To: Paolo Bonzini, qemu-devel; +Cc: kwolf, qemu-block

[-- Attachment #1: Type: text/plain, Size: 1137 bytes --]

On 08/09/2017 04:54 PM, Paolo Bonzini wrote:
> This includes shell function, shell variables, command line options
> (randomize.awk does not exist) and conditions that can never be true
> (./qemu does not exist anymore).

Can we point to a commit id where we stopped making ./qemu?  Is it still
worth supporting a local symlink?

> 
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> ---
>  tests/qemu-iotests/check         | 36 +--------------------
>  tests/qemu-iotests/common        | 23 --------------
>  tests/qemu-iotests/common.config | 26 ---------------
>  tests/qemu-iotests/common.rc     | 68 ----------------------------------------
>  4 files changed, 1 insertion(+), 152 deletions(-)
> 
> -#
> -# - These can be added to $HOST_CONFIG_DIR (witch default to ./config)

Good riddance to the wrong word ('which' was intended)

Other than possibly still wanting ./qemu convenience, this looks like a
reasonable cleanup.

Reviewed-by: Eric Blake <eblake@redhat.com>

-- 
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3266
Virtualization:  qemu.org | libvirt.org


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 619 bytes --]

^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: [Qemu-devel] [PATCH 02/12] qemu-iotests: get rid of AWK_PROG
  2017-08-09 21:55 ` [Qemu-devel] [PATCH 02/12] qemu-iotests: get rid of AWK_PROG Paolo Bonzini
@ 2017-08-09 22:21   ` Eric Blake
  2017-08-09 22:28   ` Philippe Mathieu-Daudé
  1 sibling, 0 replies; 34+ messages in thread
From: Eric Blake @ 2017-08-09 22:21 UTC (permalink / raw)
  To: Paolo Bonzini, qemu-devel; +Cc: kwolf, qemu-block

[-- Attachment #1: Type: text/plain, Size: 478 bytes --]

On 08/09/2017 04:55 PM, Paolo Bonzini wrote:
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> ---
>  tests/qemu-iotests/check         | 4 ++--
>  tests/qemu-iotests/common        | 2 +-
>  tests/qemu-iotests/common.config | 3 ---
>  3 files changed, 3 insertions(+), 6 deletions(-)
> 

Reviewed-by: Eric Blake <eblake@redhat.com>

-- 
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3266
Virtualization:  qemu.org | libvirt.org


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 619 bytes --]

^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: [Qemu-devel] [PATCH 10/12] qemu-iotests: get rid of $iam
  2017-08-09 21:55 ` [Qemu-devel] [PATCH 10/12] qemu-iotests: get rid of $iam Paolo Bonzini
@ 2017-08-09 22:23   ` Philippe Mathieu-Daudé
  0 siblings, 0 replies; 34+ messages in thread
From: Philippe Mathieu-Daudé @ 2017-08-09 22:23 UTC (permalink / raw)
  To: Paolo Bonzini, qemu-devel; +Cc: kwolf, qemu-block

On 08/09/2017 06:55 PM, Paolo Bonzini wrote:
> The variable is almost unused, and one of the two uses is actually
> uninitialized.
> 
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>

Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>

> ---
>   tests/qemu-iotests/check     | 5 +----
>   tests/qemu-iotests/common.rc | 2 +-
>   2 files changed, 2 insertions(+), 5 deletions(-)
> 
> diff --git a/tests/qemu-iotests/check b/tests/qemu-iotests/check
> index e5d1ae3d92..dc60e17e6a 100755
> --- a/tests/qemu-iotests/check
> +++ b/tests/qemu-iotests/check
> @@ -30,12 +30,9 @@ interrupt=true
>   # by default don't output timestamps
>   timestamp=${TIMESTAMP:=false}
>   
> -# generic initialization
> -iam=check
> -
>   _init_error()
>   {
> -    echo "$iam: $1" >&2
> +    echo "check: $1" >&2
>       exit 1
>   }
>   
> diff --git a/tests/qemu-iotests/common.rc b/tests/qemu-iotests/common.rc
> index 7046a83974..d0aa22543e 100644
> --- a/tests/qemu-iotests/common.rc
> +++ b/tests/qemu-iotests/common.rc
> @@ -43,7 +43,7 @@ poke_file()
>   
>   if ! . ./common.config
>       then
> -    echo "$iam: failed to source common.config"
> +    echo "$0: failed to source common.config"
>       exit 1
>   fi
>   
> 

^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: [Qemu-devel] [PATCH 05/12] qemu-iotests: do not include common.rc in "check"
  2017-08-09 21:55 ` [Qemu-devel] [PATCH 05/12] qemu-iotests: do not include common.rc in "check" Paolo Bonzini
@ 2017-08-09 22:26   ` Philippe Mathieu-Daudé
  0 siblings, 0 replies; 34+ messages in thread
From: Philippe Mathieu-Daudé @ 2017-08-09 22:26 UTC (permalink / raw)
  To: Paolo Bonzini, qemu-devel; +Cc: kwolf, qemu-block

On 08/09/2017 06:55 PM, Paolo Bonzini wrote:
> It only provides functions used by the test programs.
> 
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>

Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>

> ---
>   tests/qemu-iotests/check     |  6 ------
>   tests/qemu-iotests/common.rc | 13 +++++--------
>   2 files changed, 5 insertions(+), 14 deletions(-)
> 
> diff --git a/tests/qemu-iotests/check b/tests/qemu-iotests/check
> index 5075029e89..1ef6d0ac3a 100755
> --- a/tests/qemu-iotests/check
> +++ b/tests/qemu-iotests/check
> @@ -113,12 +113,6 @@ then
>       _init_error "failed to source common.config"
>   fi
>   
> -# we need common.rc
> -if ! . "$source_iotests/common.rc"
> -then
> -    _init_error "failed to source common.rc"
> -fi
> -
>   # we need common
>   . "$source_iotests/common"
>   
> diff --git a/tests/qemu-iotests/common.rc b/tests/qemu-iotests/common.rc
> index ef5cdb3385..390aa81224 100644
> --- a/tests/qemu-iotests/common.rc
> +++ b/tests/qemu-iotests/common.rc
> @@ -40,14 +40,11 @@ poke_file()
>       printf "$3" | dd "of=$1" bs=1 "seek=$2" conv=notrunc &>/dev/null
>   }
>   
> -# we need common.config
> -if [ "$iam" != "check" ]
> -then
> -    if ! . ./common.config
> -        then
> -        echo "$iam: failed to source common.config"
> -        exit 1
> -    fi
> +
> +if ! . ./common.config
> +    then
> +    echo "$iam: failed to source common.config"
> +    exit 1
>   fi
>   
>   _fatal()
> 

^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: [Qemu-devel] [PATCH 03/12] qemu-iotests: move "check" code out of common.rc
  2017-08-09 21:55 ` [Qemu-devel] [PATCH 03/12] qemu-iotests: move "check" code out of common.rc Paolo Bonzini
@ 2017-08-09 22:27   ` Philippe Mathieu-Daudé
  0 siblings, 0 replies; 34+ messages in thread
From: Philippe Mathieu-Daudé @ 2017-08-09 22:27 UTC (permalink / raw)
  To: Paolo Bonzini, qemu-devel; +Cc: kwolf, qemu-block

On 08/09/2017 06:55 PM, Paolo Bonzini wrote:
> Some functions in common.rc are never used by the tests.  Move
> them out of that file and into common, which is already included
> only by "check".
> 
> Code that actually *is* common to "check" and tests can be placed in
> common.config.
> 
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>

Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>

> ---
>   tests/qemu-iotests/common        | 30 ++++++++++++++++++++++++++-
>   tests/qemu-iotests/common.config | 12 +++++++++++
>   tests/qemu-iotests/common.rc     | 45 ----------------------------------------
>   3 files changed, 41 insertions(+), 46 deletions(-)
> 
> diff --git a/tests/qemu-iotests/common b/tests/qemu-iotests/common
> index 130f647a4d..50720f080f 100644
> --- a/tests/qemu-iotests/common
> +++ b/tests/qemu-iotests/common
> @@ -19,6 +19,29 @@
>   # common procedures for QA scripts
>   #
>   
> +_full_imgfmt_details()
> +{
> +    if [ -n "$IMGOPTS" ]; then
> +        echo "$IMGFMT ($IMGOPTS)"
> +    else
> +        echo "$IMGFMT"
> +    fi
> +}
> +
> +_full_imgproto_details()
> +{
> +    echo "$IMGPROTO"
> +}
> +
> +_full_platform_details()
> +{
> +    os=`uname -s`
> +    host=`hostname -s`
> +    kernel=`uname -r`
> +    platform=`uname -m`
> +    echo "$os/$platform $host $kernel"
> +}
> +
>   diff="diff -u"
>   verbose=false
>   debug=false
> @@ -404,7 +427,12 @@ if [ "$IMGOPTSSYNTAX" != "true" ]; then
>   fi
>   
>   # Set default options for qemu-img create -o if they were not specified
> -_set_default_imgopts
> +if [ "$IMGFMT" == "qcow2" ] && ! (echo "$IMGOPTS" | grep "compat=" > /dev/null); then
> +    IMGOPTS=$(_optstr_add "$IMGOPTS" "compat=1.1")
> +fi
> +if [ "$IMGFMT" == "luks" ] && ! (echo "$IMGOPTS" | grep "iter-time=" > /dev/null); then
> +    IMGOPTS=$(_optstr_add "$IMGOPTS" "iter-time=10")
> +fi
>   
>   if [ -s $tmp.list ]
>   then
> diff --git a/tests/qemu-iotests/common.config b/tests/qemu-iotests/common.config
> index 0f571d46eb..91da65f3dc 100644
> --- a/tests/qemu-iotests/common.config
> +++ b/tests/qemu-iotests/common.config
> @@ -27,6 +27,9 @@ export PWD=`pwd`
>   
>   export _QEMU_HANDLE=0
>   
> +# make sure we have a standard umask
> +umask 022
> +
>   # $1 = prog to look for, $2* = default pathnames if not found in $PATH
>   set_prog_path()
>   {
> @@ -49,6 +52,15 @@ set_prog_path()
>       return 1
>   }
>   
> +_optstr_add()
> +{
> +    if [ -n "$1" ]; then
> +        echo "$1,$2"
> +    else
> +        echo "$2"
> +    fi
> +}
> +
>   _fatal()
>   {
>       echo "$*"
> diff --git a/tests/qemu-iotests/common.rc b/tests/qemu-iotests/common.rc
> index dd91a2b79a..6f6e03366f 100644
> --- a/tests/qemu-iotests/common.rc
> +++ b/tests/qemu-iotests/common.rc
> @@ -50,9 +50,6 @@ then
>       fi
>   fi
>   
> -# make sure we have a standard umask
> -umask 022
> -
>   if [ "$IMGOPTSSYNTAX" = "true" ]; then
>       DRIVER="driver=$IMGFMT"
>       if [ "$IMGFMT" = "luks" ]; then
> @@ -94,25 +91,6 @@ else
>   fi
>   ORIG_TEST_IMG="$TEST_IMG"
>   
> -_optstr_add()
> -{
> -    if [ -n "$1" ]; then
> -        echo "$1,$2"
> -    else
> -        echo "$2"
> -    fi
> -}
> -
> -_set_default_imgopts()
> -{
> -    if [ "$IMGFMT" == "qcow2" ] && ! (echo "$IMGOPTS" | grep "compat=" > /dev/null); then
> -        IMGOPTS=$(_optstr_add "$IMGOPTS" "compat=1.1")
> -    fi
> -    if [ "$IMGFMT" == "luks" ] && ! (echo "$IMGOPTS" | grep "iter-time=" > /dev/null); then
> -        IMGOPTS=$(_optstr_add "$IMGOPTS" "iter-time=10")
> -    fi
> -}
> -
>   _use_sample_img()
>   {
>       SAMPLE_IMG_FILE="${1%\.bz2}"
> @@ -428,28 +406,5 @@ _require_command()
>       [ -x "$c" ] || _notrun "$1 utility required, skipped this test"
>   }
>   
> -_full_imgfmt_details()
> -{
> -    if [ -n "$IMGOPTS" ]; then
> -        echo "$IMGFMT ($IMGOPTS)"
> -    else
> -        echo "$IMGFMT"
> -    fi
> -}
> -
> -_full_imgproto_details()
> -{
> -    echo "$IMGPROTO"
> -}
> -
> -_full_platform_details()
> -{
> -    os=`uname -s`
> -    host=`hostname -s`
> -    kernel=`uname -r`
> -    platform=`uname -m`
> -    echo "$os/$platform $host $kernel"
> -}
> -
>   # make sure this script returns success
>   true
> 

^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: [Qemu-devel] [PATCH 02/12] qemu-iotests: get rid of AWK_PROG
  2017-08-09 21:55 ` [Qemu-devel] [PATCH 02/12] qemu-iotests: get rid of AWK_PROG Paolo Bonzini
  2017-08-09 22:21   ` Eric Blake
@ 2017-08-09 22:28   ` Philippe Mathieu-Daudé
  1 sibling, 0 replies; 34+ messages in thread
From: Philippe Mathieu-Daudé @ 2017-08-09 22:28 UTC (permalink / raw)
  To: Paolo Bonzini, qemu-devel; +Cc: kwolf, qemu-block

On 08/09/2017 06:55 PM, Paolo Bonzini wrote:
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>

Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>

> ---
>   tests/qemu-iotests/check         | 4 ++--
>   tests/qemu-iotests/common        | 2 +-
>   tests/qemu-iotests/common.config | 3 ---
>   3 files changed, 3 insertions(+), 6 deletions(-)
> 
> diff --git a/tests/qemu-iotests/check b/tests/qemu-iotests/check
> index 01fd5a26e5..5075029e89 100755
> --- a/tests/qemu-iotests/check
> +++ b/tests/qemu-iotests/check
> @@ -128,7 +128,7 @@ tmp="${TEST_DIR}"/$$
>   
>   _wallclock()
>   {
> -    date "+%H %M %S" | $AWK_PROG '{ print $1*3600 + $2*60 + $3 }'
> +    date "+%H %M %S" | awk '{ print $1*3600 + $2*60 + $3 }'
>   }
>   
>   _timestamp()
> @@ -147,7 +147,7 @@ _wrapup()
>           if [ -f $TIMESTAMP_FILE -a -f $tmp.time ]
>           then
>               cat $TIMESTAMP_FILE $tmp.time \
> -            | $AWK_PROG '
> +            | awk '
>           { t[$1] = $2 }
>   END        { if (NR > 0) {
>               for (i in t) print i " " t[i]
> diff --git a/tests/qemu-iotests/common b/tests/qemu-iotests/common
> index 867918895b..130f647a4d 100644
> --- a/tests/qemu-iotests/common
> +++ b/tests/qemu-iotests/common
> @@ -366,7 +366,7 @@ testlist options
>       if $xpand
>       then
>           have_test_arg=true
> -        $AWK_PROG </dev/null '
> +        awk </dev/null '
>   BEGIN        { for (t='$start'; t<='$end'; t++) printf "%03d\n",t }' \
>           | while read id
>           do
> diff --git a/tests/qemu-iotests/common.config b/tests/qemu-iotests/common.config
> index b599c72211..0f571d46eb 100644
> --- a/tests/qemu-iotests/common.config
> +++ b/tests/qemu-iotests/common.config
> @@ -56,9 +56,6 @@ _fatal()
>       exit 1
>   }
>   
> -export AWK_PROG="`set_prog_path awk`"
> -[ "$AWK_PROG" = "" ] && _fatal "awk not found"
> -
>   if [ -z "$QEMU_PROG" ]; then
>       export QEMU_PROG="`set_prog_path qemu`"
>   fi
> 

^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: [Qemu-devel] [PATCH 01/12] qemu-iotests: remove dead code
  2017-08-09 22:18   ` Eric Blake
@ 2017-08-09 22:43     ` Paolo Bonzini
  2017-09-12 10:00       ` Kevin Wolf
  2017-08-10  9:53     ` [Qemu-devel] [Qemu-block] " Paolo Bonzini
  1 sibling, 1 reply; 34+ messages in thread
From: Paolo Bonzini @ 2017-08-09 22:43 UTC (permalink / raw)
  To: Eric Blake; +Cc: qemu-devel, kwolf, qemu-block



----- Original Message -----
> From: "Eric Blake" <eblake@redhat.com>
> To: "Paolo Bonzini" <pbonzini@redhat.com>, qemu-devel@nongnu.org
> Cc: kwolf@redhat.com, qemu-block@nongnu.org
> Sent: Thursday, August 10, 2017 12:18:54 AM
> Subject: Re: [Qemu-devel] [PATCH 01/12] qemu-iotests: remove dead code
> 
> On 08/09/2017 04:54 PM, Paolo Bonzini wrote:
> > This includes shell function, shell variables, command line options
> > (randomize.awk does not exist) and conditions that can never be true
> > (./qemu does not exist anymore).
> 
> Can we point to a commit id where we stopped making ./qemu?

commit 9aed1e036dc0de49d08d713f9e5c4655e94acb56
Author: Anthony Liguori <aliguori@us.ibm.com>
Date:   Mon Aug 29 09:55:36 2011 -0500

    Rename qemu -> qemu-system-i386
    
    This has been discussed before in the past.  The special casing really makes no
    sense anymore.  This seems like a good change to make for 1.0.
    
    Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>

> Is it still worth supporting a local symlink?

Not sure who would have one...

Paolo

^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: [Qemu-devel] [PATCH 08/12] qemu-iotests: fix uninitialized variable
  2017-08-09 21:55 ` [Qemu-devel] [PATCH 08/12] qemu-iotests: fix uninitialized variable Paolo Bonzini
@ 2017-08-10  9:17   ` Markus Armbruster
  0 siblings, 0 replies; 34+ messages in thread
From: Markus Armbruster @ 2017-08-10  9:17 UTC (permalink / raw)
  To: Paolo Bonzini; +Cc: qemu-devel, kwolf, qemu-block

Drive-by comment:

Paolo Bonzini <pbonzini@redhat.com> writes:

> The function is used in "common" but defined only after the file

"This variable"

> is sourced.
>
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>

^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: [Qemu-devel] [PATCH 09/12] qemu-iotests: do not search for binaries in the current directory
  2017-08-09 21:55 ` [Qemu-devel] [PATCH 09/12] qemu-iotests: do not search for binaries in the current directory Paolo Bonzini
@ 2017-08-10  9:18   ` Markus Armbruster
  0 siblings, 0 replies; 34+ messages in thread
From: Markus Armbruster @ 2017-08-10  9:18 UTC (permalink / raw)
  To: Paolo Bonzini; +Cc: qemu-devel, kwolf, qemu-block

Paolo Bonzini <pbonzini@redhat.com> writes:

> Looking in the build root is enough.
>
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>

It's actually *better*.  I hate it when tests pick up random garbage I
have lying around.

^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: [Qemu-devel] [Qemu-block] [PATCH 01/12] qemu-iotests: remove dead code
  2017-08-09 22:18   ` Eric Blake
  2017-08-09 22:43     ` Paolo Bonzini
@ 2017-08-10  9:53     ` Paolo Bonzini
  1 sibling, 0 replies; 34+ messages in thread
From: Paolo Bonzini @ 2017-08-10  9:53 UTC (permalink / raw)
  To: Eric Blake, qemu-devel; +Cc: kwolf, qemu-block

On 10/08/2017 00:18, Eric Blake wrote:
> On 08/09/2017 04:54 PM, Paolo Bonzini wrote:
>> This includes shell function, shell variables, command line options
>> (randomize.awk does not exist) and conditions that can never be true
>> (./qemu does not exist anymore).
> 
> Can we point to a commit id where we stopped making ./qemu?  Is it still
> worth supporting a local symlink?
> 
>>
>> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
>> ---
>>  tests/qemu-iotests/check         | 36 +--------------------
>>  tests/qemu-iotests/common        | 23 --------------
>>  tests/qemu-iotests/common.config | 26 ---------------
>>  tests/qemu-iotests/common.rc     | 68 ----------------------------------------
>>  4 files changed, 1 insertion(+), 152 deletions(-)
>>
>> -#
>> -# - These can be added to $HOST_CONFIG_DIR (witch default to ./config)
> 
> Good riddance to the wrong word ('which' was intended)
> 
> Other than possibly still wanting ./qemu convenience, this looks like a
> reasonable cleanup.

In my reply yesterday, I forgot to note that the other current-directory
searches go away in patch 9 anyway. :)

Paolo

^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: [Qemu-devel] [Qemu-block] [PATCH 00/12] cleanup qemu-iotests
  2017-08-09 21:54 [Qemu-devel] [PATCH 00/12] cleanup qemu-iotests Paolo Bonzini
                   ` (11 preceding siblings ...)
  2017-08-09 21:55 ` [Qemu-devel] [PATCH 12/12] qemu-iotests: merge "check" and "common" Paolo Bonzini
@ 2017-09-11 22:22 ` John Snow
  2017-09-11 22:31   ` Paolo Bonzini
  12 siblings, 1 reply; 34+ messages in thread
From: John Snow @ 2017-09-11 22:22 UTC (permalink / raw)
  To: Paolo Bonzini, qemu-devel; +Cc: kwolf, qemu-block



On 08/09/2017 05:54 PM, Paolo Bonzini wrote:
> The purpose of this series is to separate the "check" sources from
> the tests.  After these patches, common.config is reduced to simple
> shell initialization, and common.rc is only included by the tests.
> 
> Along the way, a lot of dead code is removed too.
> 
> Paolo
> 
> Paolo Bonzini (12):
>   qemu-iotests: remove dead code
>   qemu-iotests: get rid of AWK_PROG
>   qemu-iotests: move "check" code out of common.rc
>   qemu-iotests: limit non-_PROG-suffixed variables to common.rc
>   qemu-iotests: do not include common.rc in "check"
>   qemu-iotests: do not do useless search for QEMU_*_PROG
>   qemu-iotests: disintegrate more parts of common.config
>   qemu-iotests: fix uninitialized variable
>   qemu-iotests: do not search for binaries in the current directory
>   qemu-iotests: get rid of $iam
>   qemu-iotests: include common.env and common.config early
>   qemu-iotests: merge "check" and "common"
> 
>  tests/qemu-iotests/039.out       |  10 +-
>  tests/qemu-iotests/061.out       |   4 +-
>  tests/qemu-iotests/137.out       |   2 +-
>  tests/qemu-iotests/check         | 551 ++++++++++++++++++++++++++++++++++-----
>  tests/qemu-iotests/common        | 459 --------------------------------
>  tests/qemu-iotests/common.config | 205 +--------------
>  tests/qemu-iotests/common.qemu   |   1 +
>  tests/qemu-iotests/common.rc     | 225 ++++++++--------
>  8 files changed, 615 insertions(+), 842 deletions(-)
>  delete mode 100644 tests/qemu-iotests/common
> 

Stale? Patchset is >1 month old now, doesn't look like it got merged.

^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: [Qemu-devel] [Qemu-block] [PATCH 00/12] cleanup qemu-iotests
  2017-09-11 22:22 ` [Qemu-devel] [Qemu-block] [PATCH 00/12] cleanup qemu-iotests John Snow
@ 2017-09-11 22:31   ` Paolo Bonzini
  0 siblings, 0 replies; 34+ messages in thread
From: Paolo Bonzini @ 2017-09-11 22:31 UTC (permalink / raw)
  To: John Snow; +Cc: qemu-devel, kwolf, qemu-block



----- Original Message -----
> From: "John Snow" <jsnow@redhat.com>
> To: "Paolo Bonzini" <pbonzini@redhat.com>, qemu-devel@nongnu.org
> Cc: kwolf@redhat.com, qemu-block@nongnu.org
> Sent: Tuesday, September 12, 2017 12:22:26 AM
> Subject: Re: [Qemu-block] [PATCH 00/12] cleanup qemu-iotests
> 
> 
> 
> On 08/09/2017 05:54 PM, Paolo Bonzini wrote:
> > The purpose of this series is to separate the "check" sources from
> > the tests.  After these patches, common.config is reduced to simple
> > shell initialization, and common.rc is only included by the tests.
> > 
> > Along the way, a lot of dead code is removed too.
> > 
> > Paolo
> > 
> > Paolo Bonzini (12):
> >   qemu-iotests: remove dead code
> >   qemu-iotests: get rid of AWK_PROG
> >   qemu-iotests: move "check" code out of common.rc
> >   qemu-iotests: limit non-_PROG-suffixed variables to common.rc
> >   qemu-iotests: do not include common.rc in "check"
> >   qemu-iotests: do not do useless search for QEMU_*_PROG
> >   qemu-iotests: disintegrate more parts of common.config
> >   qemu-iotests: fix uninitialized variable
> >   qemu-iotests: do not search for binaries in the current directory
> >   qemu-iotests: get rid of $iam
> >   qemu-iotests: include common.env and common.config early
> >   qemu-iotests: merge "check" and "common"
> > 
> >  tests/qemu-iotests/039.out       |  10 +-
> >  tests/qemu-iotests/061.out       |   4 +-
> >  tests/qemu-iotests/137.out       |   2 +-
> >  tests/qemu-iotests/check         | 551
> >  ++++++++++++++++++++++++++++++++++-----
> >  tests/qemu-iotests/common        | 459 --------------------------------
> >  tests/qemu-iotests/common.config | 205 +--------------
> >  tests/qemu-iotests/common.qemu   |   1 +
> >  tests/qemu-iotests/common.rc     | 225 ++++++++--------
> >  8 files changed, 615 insertions(+), 842 deletions(-)
> >  delete mode 100644 tests/qemu-iotests/common
> > 
> 
> Stale? Patchset is >1 month old now, doesn't look like it got merged.

Yup, didn't get reviewed by Kevin either...  I was waiting for that
before sending v2.

Paolo

^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: [Qemu-devel] [PATCH 01/12] qemu-iotests: remove dead code
  2017-08-09 22:43     ` Paolo Bonzini
@ 2017-09-12 10:00       ` Kevin Wolf
  0 siblings, 0 replies; 34+ messages in thread
From: Kevin Wolf @ 2017-09-12 10:00 UTC (permalink / raw)
  To: Paolo Bonzini; +Cc: Eric Blake, qemu-devel, qemu-block

Am 10.08.2017 um 00:43 hat Paolo Bonzini geschrieben:
> 
> 
> ----- Original Message -----
> > From: "Eric Blake" <eblake@redhat.com>
> > To: "Paolo Bonzini" <pbonzini@redhat.com>, qemu-devel@nongnu.org
> > Cc: kwolf@redhat.com, qemu-block@nongnu.org
> > Sent: Thursday, August 10, 2017 12:18:54 AM
> > Subject: Re: [Qemu-devel] [PATCH 01/12] qemu-iotests: remove dead code
> > 
> > On 08/09/2017 04:54 PM, Paolo Bonzini wrote:
> > > This includes shell function, shell variables, command line options
> > > (randomize.awk does not exist) and conditions that can never be true
> > > (./qemu does not exist anymore).
> > 
> > Can we point to a commit id where we stopped making ./qemu?
> 
> commit 9aed1e036dc0de49d08d713f9e5c4655e94acb56
> Author: Anthony Liguori <aliguori@us.ibm.com>
> Date:   Mon Aug 29 09:55:36 2011 -0500
> 
>     Rename qemu -> qemu-system-i386
>     
>     This has been discussed before in the past.  The special casing really makes no
>     sense anymore.  This seems like a good change to make for 1.0.
>     
>     Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>

This is not related to ./qemu in the qemu-iotests directory. It's just
the name of the binary that is created in i386-softmmu/, but that has
never been the working directory for qemu-iotests.

> > Is it still worth supporting a local symlink?
> 
> Not sure who would have one...

I have always been using symlinks in the qemu-iotests directory. And, as
you probably expect now, ./qemu does exist in my setup.

Now, I must admit that I haven't actually made real use of it recently
because the symlinks only point to the binaries that qemu-iotests would
pick up anyway. But when running qemu-iotests against a different qemu
version or installed binaries instead of whatever is in the build tree,
I always found the symlinks more convenient that setting up a bunch of
environment variables.

So maybe supporting them isn't completely useless.

Kevin

^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: [Qemu-devel] [PATCH 04/12] qemu-iotests: limit non-_PROG-suffixed variables to common.rc
  2017-08-09 21:55 ` [Qemu-devel] [PATCH 04/12] qemu-iotests: limit non-_PROG-suffixed variables to common.rc Paolo Bonzini
@ 2017-09-12 10:31   ` Kevin Wolf
  2017-09-12 12:28     ` Paolo Bonzini
  0 siblings, 1 reply; 34+ messages in thread
From: Kevin Wolf @ 2017-09-12 10:31 UTC (permalink / raw)
  To: Paolo Bonzini; +Cc: qemu-devel, qemu-block

Am 09.08.2017 um 23:55 hat Paolo Bonzini geschrieben:
> These are never used by "check", with one exception that does not need
> $QEMU_OPTIONS.  Keep them in common.rc, which will be soon included only
> by the tests.
> 
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>

> diff --git a/tests/qemu-iotests/common b/tests/qemu-iotests/common
> index 50720f080f..f58e56fc40 100644
> --- a/tests/qemu-iotests/common
> +++ b/tests/qemu-iotests/common
> @@ -454,11 +454,3 @@ fi
>  #
>  list=`sort $tmp.list`
>  rm -f $tmp.list $tmp.tmp $tmp.sed
> -
> -[ "$QEMU" = "" ] && _fatal "qemu not found"
> -[ "$QEMU_IMG" = "" ] && _fatal "qemu-img not found"
> -[ "$QEMU_IO" = "" ] && _fatal "qemu-io not found"
> -
> -if [ "$IMGPROTO" = "nbd" ] ; then
> -    [ "$QEMU_NBD" = "" ] && _fatal "qemu-nbd not found"
> -fi

Hm, does this mean that instead of ./check failing when a binary is
missing, we try each test case now and each one fails with the same
error message?

*tries it out*

Okay, it's already broken today because the strings are never empty but
contain the name of the wrapper functions, but it's still bad behaviour.
Instead of just telling me that the binary is missing like it used to
work, I get tons of test case diffs.

Kevin

^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: [Qemu-devel] [PATCH 07/12] qemu-iotests: disintegrate more parts of common.config
  2017-08-09 21:55 ` [Qemu-devel] [PATCH 07/12] qemu-iotests: disintegrate more parts of common.config Paolo Bonzini
@ 2017-09-12 10:40   ` Kevin Wolf
  2017-09-12 12:31     ` Paolo Bonzini
  0 siblings, 1 reply; 34+ messages in thread
From: Kevin Wolf @ 2017-09-12 10:40 UTC (permalink / raw)
  To: Paolo Bonzini; +Cc: qemu-devel, qemu-block

Am 09.08.2017 um 23:55 hat Paolo Bonzini geschrieben:
> Split "check" parts from tests part.
> 
> For the directory setup, the actual computation of directories goes
> in "check", while the sanity checks go in the tests.
> 
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>

Same comment as for patch 1, we may want to keep this working.

Kevin

^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: [Qemu-devel] [PATCH 04/12] qemu-iotests: limit non-_PROG-suffixed variables to common.rc
  2017-09-12 10:31   ` Kevin Wolf
@ 2017-09-12 12:28     ` Paolo Bonzini
  2017-09-12 12:51       ` Kevin Wolf
  0 siblings, 1 reply; 34+ messages in thread
From: Paolo Bonzini @ 2017-09-12 12:28 UTC (permalink / raw)
  To: Kevin Wolf; +Cc: qemu-devel, qemu-block

On 12/09/2017 12:31, Kevin Wolf wrote:
> Hm, does this mean that instead of ./check failing when a binary is
> missing, we try each test case now and each one fails with the same
> error message?
> 
> *tries it out*
> 
> Okay, it's already broken today because the strings are never empty but
> contain the name of the wrapper functions, but it's still bad behaviour.
> Instead of just telling me that the binary is missing like it used to
> work, I get tons of test case diffs.

So the patch is still dead code, isn't it?

Paolo

^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: [Qemu-devel] [PATCH 07/12] qemu-iotests: disintegrate more parts of common.config
  2017-09-12 10:40   ` Kevin Wolf
@ 2017-09-12 12:31     ` Paolo Bonzini
  2017-09-12 12:57       ` Kevin Wolf
  0 siblings, 1 reply; 34+ messages in thread
From: Paolo Bonzini @ 2017-09-12 12:31 UTC (permalink / raw)
  To: Kevin Wolf; +Cc: qemu-devel, qemu-block

On 12/09/2017 12:40, Kevin Wolf wrote:
> Am 09.08.2017 um 23:55 hat Paolo Bonzini geschrieben:
>> Split "check" parts from tests part.
>>
>> For the directory setup, the actual computation of directories goes
>> in "check", while the sanity checks go in the tests.
>>
>> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> 
> Same comment as for patch 1, we may want to keep this working.

Can you explain what is the use case?  For local symlinks I (sort of)
understand it, but not here.  This as far as I understand is code that
never runs.

My preferred alternatives would be one of these:

- add a patch 13 that restores the local symlink feature on top of the
cleaned up code.

- later, rewrite "check" in Python now that it is clear what code is
part of it and what code is part of the tests.

or:

- leave local symlinks broken

- when "check" is rewritten in Python, add a configuration mechanism
based on .ini file syntax that replaces the local symlinks.

What do you think?

Paolo

^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: [Qemu-devel] [PATCH 04/12] qemu-iotests: limit non-_PROG-suffixed variables to common.rc
  2017-09-12 12:28     ` Paolo Bonzini
@ 2017-09-12 12:51       ` Kevin Wolf
  2017-09-12 12:55         ` Paolo Bonzini
  0 siblings, 1 reply; 34+ messages in thread
From: Kevin Wolf @ 2017-09-12 12:51 UTC (permalink / raw)
  To: Paolo Bonzini; +Cc: qemu-devel, qemu-block

Am 12.09.2017 um 14:28 hat Paolo Bonzini geschrieben:
> On 12/09/2017 12:31, Kevin Wolf wrote:
> > Hm, does this mean that instead of ./check failing when a binary is
> > missing, we try each test case now and each one fails with the same
> > error message?
> > 
> > *tries it out*
> > 
> > Okay, it's already broken today because the strings are never empty but
> > contain the name of the wrapper functions, but it's still bad behaviour.
> > Instead of just telling me that the binary is missing like it used to
> > work, I get tons of test case diffs.
> 
> So the patch is still dead code, isn't it?

Yes. But instead of moving it to a place where this ugly failure mode
becomes intentional, we should just fix the check and keep doing it once
at the start of ./check.

Kevin

^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: [Qemu-devel] [PATCH 04/12] qemu-iotests: limit non-_PROG-suffixed variables to common.rc
  2017-09-12 12:51       ` Kevin Wolf
@ 2017-09-12 12:55         ` Paolo Bonzini
  0 siblings, 0 replies; 34+ messages in thread
From: Paolo Bonzini @ 2017-09-12 12:55 UTC (permalink / raw)
  To: Kevin Wolf; +Cc: qemu-devel, qemu-block

On 12/09/2017 14:51, Kevin Wolf wrote:
> Am 12.09.2017 um 14:28 hat Paolo Bonzini geschrieben:
>> On 12/09/2017 12:31, Kevin Wolf wrote:
>>> Hm, does this mean that instead of ./check failing when a binary is
>>> missing, we try each test case now and each one fails with the same
>>> error message?
>>>
>>> *tries it out*
>>>
>>> Okay, it's already broken today because the strings are never empty but
>>> contain the name of the wrapper functions, but it's still bad behaviour.
>>> Instead of just telling me that the binary is missing like it used to
>>> work, I get tons of test case diffs.
>>
>> So the patch is still dead code, isn't it?
> 
> Yes. But instead of moving it to a place where this ugly failure mode
> becomes intentional, we should just fix the check and keep doing it once
> at the start of ./check.

Ok, that is better indeed.

Paolo

^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: [Qemu-devel] [PATCH 07/12] qemu-iotests: disintegrate more parts of common.config
  2017-09-12 12:31     ` Paolo Bonzini
@ 2017-09-12 12:57       ` Kevin Wolf
  2017-09-12 13:02         ` Paolo Bonzini
  0 siblings, 1 reply; 34+ messages in thread
From: Kevin Wolf @ 2017-09-12 12:57 UTC (permalink / raw)
  To: Paolo Bonzini; +Cc: qemu-devel, qemu-block

Am 12.09.2017 um 14:31 hat Paolo Bonzini geschrieben:
> On 12/09/2017 12:40, Kevin Wolf wrote:
> > Am 09.08.2017 um 23:55 hat Paolo Bonzini geschrieben:
> >> Split "check" parts from tests part.
> >>
> >> For the directory setup, the actual computation of directories goes
> >> in "check", while the sanity checks go in the tests.
> >>
> >> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> > 
> > Same comment as for patch 1, we may want to keep this working.
> 
> Can you explain what is the use case?  For local symlinks I (sort of)
> understand it, but not here.  This as far as I understand is code that
> never runs.

Sorry, somehow I replied to the wrong patch...

This was meant as a comment for patch 9 ('do not search for binaries in
the current directory').

> My preferred alternatives would be one of these:
> 
> - add a patch 13 that restores the local symlink feature on top of the
> cleaned up code.
> 
> - later, rewrite "check" in Python now that it is clear what code is
> part of it and what code is part of the tests.

Do you really think that removing and the reintroducing the feature is
easier than just keeping it in the first place?

> or:
> 
> - leave local symlinks broken
> 
> - when "check" is rewritten in Python, add a configuration mechanism
> based on .ini file syntax that replaces the local symlinks.
> 
> What do you think?

I don't mind the solution as long as after the series, it is still
working. I think this means option 1.

Kevin

^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: [Qemu-devel] [PATCH 07/12] qemu-iotests: disintegrate more parts of common.config
  2017-09-12 12:57       ` Kevin Wolf
@ 2017-09-12 13:02         ` Paolo Bonzini
  0 siblings, 0 replies; 34+ messages in thread
From: Paolo Bonzini @ 2017-09-12 13:02 UTC (permalink / raw)
  To: Kevin Wolf; +Cc: qemu-devel, qemu-block

On 12/09/2017 14:57, Kevin Wolf wrote:
> Am 12.09.2017 um 14:31 hat Paolo Bonzini geschrieben:
>> On 12/09/2017 12:40, Kevin Wolf wrote:
>>> Am 09.08.2017 um 23:55 hat Paolo Bonzini geschrieben:
>>>> Split "check" parts from tests part.
>>>>
>>>> For the directory setup, the actual computation of directories goes
>>>> in "check", while the sanity checks go in the tests.
>>>>
>>>> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
>>>
>>> Same comment as for patch 1, we may want to keep this working.
>>
>> Can you explain what is the use case?  For local symlinks I (sort of)
>> understand it, but not here.  This as far as I understand is code that
>> never runs.
> 
> Sorry, somehow I replied to the wrong patch...
> 
> This was meant as a comment for patch 9 ('do not search for binaries in
> the current directory').
> 
>> My preferred alternatives would be one of these:
>>
>> - add a patch 13 that restores the local symlink feature on top of the
>> cleaned up code.
>>
>> - later, rewrite "check" in Python now that it is clear what code is
>> part of it and what code is part of the tests.
> 
> Do you really think that removing and the reintroducing the feature is
> easier than just keeping it in the first place?

Nah, sorry, I was confused -- I thought the feature was in some common.*
file, but it's straight in "check".  I'll get rid of patch 9 and the
'./qemu' hunk of patch 1.

Paolo

^ permalink raw reply	[flat|nested] 34+ messages in thread

end of thread, other threads:[~2017-09-12 13:03 UTC | newest]

Thread overview: 34+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-08-09 21:54 [Qemu-devel] [PATCH 00/12] cleanup qemu-iotests Paolo Bonzini
2017-08-09 21:54 ` [Qemu-devel] [PATCH 01/12] qemu-iotests: remove dead code Paolo Bonzini
2017-08-09 22:18   ` Eric Blake
2017-08-09 22:43     ` Paolo Bonzini
2017-09-12 10:00       ` Kevin Wolf
2017-08-10  9:53     ` [Qemu-devel] [Qemu-block] " Paolo Bonzini
2017-08-09 21:55 ` [Qemu-devel] [PATCH 02/12] qemu-iotests: get rid of AWK_PROG Paolo Bonzini
2017-08-09 22:21   ` Eric Blake
2017-08-09 22:28   ` Philippe Mathieu-Daudé
2017-08-09 21:55 ` [Qemu-devel] [PATCH 03/12] qemu-iotests: move "check" code out of common.rc Paolo Bonzini
2017-08-09 22:27   ` Philippe Mathieu-Daudé
2017-08-09 21:55 ` [Qemu-devel] [PATCH 04/12] qemu-iotests: limit non-_PROG-suffixed variables to common.rc Paolo Bonzini
2017-09-12 10:31   ` Kevin Wolf
2017-09-12 12:28     ` Paolo Bonzini
2017-09-12 12:51       ` Kevin Wolf
2017-09-12 12:55         ` Paolo Bonzini
2017-08-09 21:55 ` [Qemu-devel] [PATCH 05/12] qemu-iotests: do not include common.rc in "check" Paolo Bonzini
2017-08-09 22:26   ` Philippe Mathieu-Daudé
2017-08-09 21:55 ` [Qemu-devel] [PATCH 06/12] qemu-iotests: do not do useless search for QEMU_*_PROG Paolo Bonzini
2017-08-09 21:55 ` [Qemu-devel] [PATCH 07/12] qemu-iotests: disintegrate more parts of common.config Paolo Bonzini
2017-09-12 10:40   ` Kevin Wolf
2017-09-12 12:31     ` Paolo Bonzini
2017-09-12 12:57       ` Kevin Wolf
2017-09-12 13:02         ` Paolo Bonzini
2017-08-09 21:55 ` [Qemu-devel] [PATCH 08/12] qemu-iotests: fix uninitialized variable Paolo Bonzini
2017-08-10  9:17   ` Markus Armbruster
2017-08-09 21:55 ` [Qemu-devel] [PATCH 09/12] qemu-iotests: do not search for binaries in the current directory Paolo Bonzini
2017-08-10  9:18   ` Markus Armbruster
2017-08-09 21:55 ` [Qemu-devel] [PATCH 10/12] qemu-iotests: get rid of $iam Paolo Bonzini
2017-08-09 22:23   ` Philippe Mathieu-Daudé
2017-08-09 21:55 ` [Qemu-devel] [PATCH 11/12] qemu-iotests: include common.env and common.config early Paolo Bonzini
2017-08-09 21:55 ` [Qemu-devel] [PATCH 12/12] qemu-iotests: merge "check" and "common" Paolo Bonzini
2017-09-11 22:22 ` [Qemu-devel] [Qemu-block] [PATCH 00/12] cleanup qemu-iotests John Snow
2017-09-11 22:31   ` Paolo Bonzini

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).