cleanup qemu-iotests
cover cleanup qemu-iotests
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
Signature · 1 line
2.13.3
PATCH 2/12 qemu-iotests: get rid of AWK_PROG
--- tests/qemu-iotests/check | 4 ++-- tests/qemu-iotests/common | 2 +- tests/qemu-iotests/common.config | 3 --- 3 files changed, 3 insertions(+), 6 deletions(-)
tests/qemu-iotests/check +2 -2
@@ -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]
tests/qemu-iotests/common +1 -1
@@ -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
tests/qemu-iotests/common.config +0 -3
@@ -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
Signature · 1 line
2.13.3
PATCH 3/12 qemu-iotests: move "check" code out of common.rc
In reply to Paolo BonziniSome 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.
--- tests/qemu-iotests/common | 30 ++++++++++++++++++++++++++- tests/qemu-iotests/common.config | 12 +++++++++++ tests/qemu-iotests/common.rc | 45 ---------------------------------------- 3 files changed, 41 insertions(+), 46 deletions(-)
tests/qemu-iotests/common +29 -1
@@ -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
tests/qemu-iotests/common.config +12 -0
@@ -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 "$*"
tests/qemu-iotests/common.rc +0 -45
62 lines not on this page · raw message
Signature · 1 line
2.13.3
PATCH 1/12 qemu-iotests: remove dead code
In reply to Paolo BonziniThis 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).
--- 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(-)
tests/qemu-iotests/check +1 -35
@@ -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")]"
tests/qemu-iotests/common +0 -23
@@ -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"
tests/qemu-iotests/common.config +0 -26
@@ -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
tests/qemu-iotests/common.rc +0 -68
79 lines not on this page · raw message
Signature · 1 line
2.13.3
PATCH 5/12 qemu-iotests: do not include common.rc in "check"
In reply to Paolo BonziniIt only provides functions used by the test programs.
--- tests/qemu-iotests/check | 6 ------ tests/qemu-iotests/common.rc | 13 +++++-------- 2 files changed, 5 insertions(+), 14 deletions(-)
tests/qemu-iotests/check +0 -6
@@ -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"
tests/qemu-iotests/common.rc +5 -8
@@ -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()
Signature · 1 line
2.13.3
PATCH 4/12 qemu-iotests: limit non-_PROG-suffixed variables to common.rc
In reply to Paolo BonziniThese 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.
--- 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(-)
tests/qemu-iotests/039.out +5 -5
@@ -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 "$@";
tests/qemu-iotests/061.out +2 -2
@@ -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 "$@";
tests/qemu-iotests/137.out +1 -1
@@ -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 "$@";
tests/qemu-iotests/common +0 -8
@@ -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
tests/qemu-iotests/common.config +2 -73
93 lines not on this page · raw message
tests/qemu-iotests/common.rc +80 -0
86 lines not on this page · raw message
Signature · 1 line
2.13.3
PATCH 6/12 qemu-iotests: do not do useless search for QEMU_*_PROG
In reply to Paolo BonziniWith 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.
--- tests/qemu-iotests/common | 19 ++++++++++++++ tests/qemu-iotests/common.config | 54 ---------------------------------------- 2 files changed, 19 insertions(+), 54 deletions(-)
tests/qemu-iotests/common +19 -0
@@ -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
tests/qemu-iotests/common.config +0 -54
66 lines not on this page · raw message
Signature · 1 line
2.13.3
PATCH 7/12 qemu-iotests: disintegrate more parts of common.config
In reply to Paolo BonziniSplit "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.
--- 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(-)
tests/qemu-iotests/common +24 -0
@@ -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
tests/qemu-iotests/common.config +0 -49
60 lines not on this page · raw message
tests/qemu-iotests/common.qemu +1 -0
@@ -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.
tests/qemu-iotests/common.rc +25 -0
@@ -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}"
Signature · 1 line
2.13.3
PATCH 8/12 qemu-iotests: fix uninitialized variable
In reply to Paolo BonziniThe function is used in "common" but defined only after the file is sourced.
--- tests/qemu-iotests/check | 2 -- tests/qemu-iotests/common | 2 ++ 2 files changed, 2 insertions(+), 2 deletions(-)
tests/qemu-iotests/check +0 -2
@@ -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 }'
tests/qemu-iotests/common +2 -0
@@ -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
Signature · 1 line
2.13.3
PATCH 10/12 qemu-iotests: get rid of $iam
In reply to Paolo BonziniThe variable is almost unused, and one of the two uses is actually uninitialized.
--- tests/qemu-iotests/check | 5 +---- tests/qemu-iotests/common.rc | 2 +- 2 files changed, 2 insertions(+), 5 deletions(-)
tests/qemu-iotests/check +1 -4
@@ -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 }
tests/qemu-iotests/common.rc +1 -1
@@ -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
Signature · 1 line
2.13.3
PATCH 9/12 qemu-iotests: do not search for binaries in the current directory
In reply to Paolo BonziniLooking in the build root is enough.
--- tests/qemu-iotests/check | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
tests/qemu-iotests/check +3 -3
@@ -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
Signature · 1 line
2.13.3
PATCH 11/12 qemu-iotests: include common.env and common.config early
In reply to Paolo BonziniThey are now very small and they do not have external dependencies. We can source them as soon as we have their path.
--- tests/qemu-iotests/check | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-)
tests/qemu-iotests/check +12 -12
@@ -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"
Signature · 1 line
2.13.3
PATCH 12/12 qemu-iotests: merge "check" and "common"
In reply to Paolo Bonzini"check" is full of qemu-iotests--specific details. Separating it from "common" does not make much sense anymore.
--- tests/qemu-iotests/check | 482 +++++++++++++++++++++++++++++++++++++++++++- tests/qemu-iotests/common | 501 ---------------------------------------------- 2 files changed, 480 insertions(+), 503 deletions(-) delete mode 100644 tests/qemu-iotests/common
tests/qemu-iotests/check +480 -2
@@ -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
tests/qemu-iotests/common deleted +0 -501
501 lines not on this page · raw message
Signature · 1 line
2.13.3
Re: [Qemu-devel] [PATCH 01/12] qemu-iotests: remove dead code
In reply to Paolo BonziniQuoted 3 lines · Paolo Bonzini
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?
Review
Quoted 11 lines
Signed-off-by Paolo Bonzini <[email protected]>--- 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(-)(quoted diff) +0
-2-# -# - 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.
Signature · 3 lines
Eric Blake, Principal Software Engineer Red Hat, Inc. +1-919-301-3266 Virtualization: qemu.org | libvirt.org
Re: [Qemu-devel] [PATCH 02/12] qemu-iotests: get rid of AWK_PROG
In reply to Paolo BonziniQuoted 7 lines · Paolo Bonzini
Signed-off-by Paolo Bonzini <[email protected]>--- tests/qemu-iotests/check | 4 ++-- tests/qemu-iotests/common | 2 +- tests/qemu-iotests/common.config | 3 --- 3 files changed, 3 insertions(+), 6 deletions(-)
Signature · 3 lines
Eric Blake, Principal Software Engineer Red Hat, Inc. +1-919-301-3266 Virtualization: qemu.org | libvirt.org
Re: [Qemu-devel] [PATCH 10/12] qemu-iotests: get rid of $iam
In reply to Paolo BonziniQuoted 4 lines · Paolo Bonzini
The variable is almost unused, and one of the two uses is actually uninitialized.
Signed-off-by Paolo Bonzini <[email protected]>
Quoted 37 lines
--- tests/qemu-iotests/check | 5 +---- tests/qemu-iotests/common.rc | 2 +- 2 files changed, 2 insertions(+), 5 deletions(-)tests/qemu-iotests/check +1
-4@@ -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 }tests/qemu-iotests/common.rc +1
-1@@ -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
Re: [Qemu-devel] [PATCH 05/12] qemu-iotests: do not include common.rc in "check"
In reply to Paolo BonziniQuoted 3 lines · Paolo Bonzini
It only provides functions used by the test programs.
Signed-off-by Paolo Bonzini <[email protected]>
Quoted 47 lines
--- tests/qemu-iotests/check | 6 ------ tests/qemu-iotests/common.rc | 13 +++++-------- 2 files changed, 5 insertions(+), 14 deletions(-)tests/qemu-iotests/check +0
-6@@ -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"tests/qemu-iotests/common.rc +5
-8@@ -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()
Re: [Qemu-devel] [PATCH 03/12] qemu-iotests: move "check" code out of common.rc
In reply to Paolo BonziniQuoted 8 lines · Paolo Bonzini
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 <[email protected]>
Quoted 154 lines
--- tests/qemu-iotests/common | 30 ++++++++++++++++++++++++++- tests/qemu-iotests/common.config | 12 +++++++++++ tests/qemu-iotests/common.rc | 45 ---------------------------------------- 3 files changed, 41 insertions(+), 46 deletions(-)tests/qemu-iotests/common +29
-1@@ -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 ] thentests/qemu-iotests/common.config +12
-0@@ -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 "$*"tests/qemu-iotests/common.rc +0
-45@@ -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
Re: [Qemu-devel] [PATCH 02/12] qemu-iotests: get rid of AWK_PROG
In reply to Paolo BonziniQuoted 1 line · Paolo Bonzini
Signed-off-by Paolo Bonzini <[email protected]>
Quoted 56 lines
--- tests/qemu-iotests/check | 4 ++-- tests/qemu-iotests/common | 2 +- tests/qemu-iotests/common.config | 3 --- 3 files changed, 3 insertions(+), 6 deletions(-)tests/qemu-iotests/check +2
-2@@ -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]tests/qemu-iotests/common +1
-1@@ -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 dotests/qemu-iotests/common.config +0
-3@@ -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
Re: [Qemu-devel] [PATCH 01/12] qemu-iotests: remove dead code
In reply to Eric Blake----- Original Message -----
Quoted 6 lines
From: "Eric Blake" <[email protected]>
To: "Paolo Bonzini" <[email protected]>, [email protected]
Cc: [email protected], [email protected]
Sent: Thursday, August 10, 2017 12:18:54 AM
Subject: Re: [Qemu-devel] [PATCH 01/12] qemu-iotests: remove dead code
Quoted 6 lines
Quoted 3 lines · Paolo Bonzini
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 <[email protected]> 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.
Quoted 1 line
Is it still worth supporting a local symlink?
Not sure who would have one...
Paolo
Re: [Qemu-devel] [PATCH 08/12] qemu-iotests: fix uninitialized variable
In reply to Paolo BonziniDrive-by comment:
Quoted 1 line · Paolo Bonzini
The function is used in "common" but defined only after the file
"This variable"
Quoted 3 lines
is sourced.
Signed-off-by Paolo Bonzini <[email protected]>
Re: [Qemu-devel] [PATCH 09/12] qemu-iotests: do not search for binaries in the current directory
In reply to Paolo BonziniQuoted 3 lines · Paolo Bonzini
Looking in the build root is enough.
Signed-off-by Paolo Bonzini <[email protected]>
It's actually *better*. I hate it when tests pick up random garbage I have lying around.
Re: [Qemu-devel] [Qemu-block] [PATCH 01/12] qemu-iotests: remove dead code
In reply to Eric BlakeQuoted 17 lines · Eric Blake
Quoted 3 lines · Paolo Bonzini
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?
Quoted 9 lines
Signed-off-by Paolo Bonzini <[email protected]>--- 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(-)
Quoted 7 lines
Review
Quoted 2 lines
(quoted diff) +0
-2-# -# - 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
Quoted 22 lines · Paolo Bonzini
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 ofAWK_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"
Quoted 11 lines
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.
----- Original Message -----
Quoted 44 lines
From: "John Snow" <[email protected]>
To: "Paolo Bonzini" <[email protected]>, [email protected]
Cc: [email protected], [email protected]
Sent: Tuesday, September 12, 2017 12:22:26 AM
Subject: Re: [Qemu-block] [PATCH 00/12] cleanup qemu-iotestsQuoted 22 lines · Paolo Bonzini
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 ofAWK_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"Quoted 12 lines
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
Quoted 1 line
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
Re: [Qemu-devel] [PATCH 01/12] qemu-iotests: remove dead code
In reply to Paolo BonziniAm 10.08.2017 um 00:43 hat Paolo Bonzini geschrieben:
Quoted 20 lines
----- Original Message -----
Quoted 6 lines
From: "Eric Blake" <[email protected]>
To: "Paolo Bonzini" <[email protected]>, [email protected]
Cc: [email protected], [email protected]
Sent: Thursday, August 10, 2017 12:18:54 AM
Subject: Re: [Qemu-devel] [PATCH 01/12] qemu-iotests: remove dead codeQuoted 6 lines
Quoted 3 lines · Paolo Bonzini
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
9aed1e036dc0de49d08d713f9e5c4655e94acb56Author: Anthony Liguori <[email protected]> Date: Mon Aug 29 09:55:36 2011 -0500
Quoted 6 lines
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 <[email protected]>
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.
Quoted 3 lines
Quoted 1 line
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
Re: [Qemu-devel] [PATCH 04/12] qemu-iotests: limit non-_PROG-suffixed variables to common.rc
In reply to Paolo BonziniAm 09.08.2017 um 23:55 hat Paolo Bonzini geschrieben:
Quoted 12 lines
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 <[email protected]>tests/qemu-iotests/common +0
-0@@ -454,11 +454,3 @@ fi #
tests/qemu-iotests/common fi · line 464
Quoted 10 lines
tests/qemu-iotests/common +0
-8list=`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
Re: [Qemu-devel] [PATCH 07/12] qemu-iotests: disintegrate more parts of common.config
In reply to Paolo BonziniAm 09.08.2017 um 23:55 hat Paolo Bonzini geschrieben:
Quoted 6 lines
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 <[email protected]>
Same comment as for patch 1, we may want to keep this working.
Kevin
Re: [Qemu-devel] [PATCH 04/12] qemu-iotests: limit non-_PROG-suffixed variables to common.rc
In reply to Kevin WolfQuoted 10 lines · Kevin Wolf
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
Re: [Qemu-devel] [PATCH 07/12] qemu-iotests: disintegrate more parts of common.config
In reply to Kevin WolfQuoted 9 lines · Kevin Wolf
Am 09.08.2017 um 23:55 hat Paolo Bonzini geschrieben:
Quoted 6 lines
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 <[email protected]>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
Re: [Qemu-devel] [PATCH 04/12] qemu-iotests: limit non-_PROG-suffixed variables to common.rc
In reply to Paolo BonziniAm 12.09.2017 um 14:28 hat Paolo Bonzini geschrieben:
Quoted 5 lines · Kevin Wolf
Quoted 4 lines
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?
Quoted 8 lines
Quoted 6 lines
*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
Re: [Qemu-devel] [PATCH 04/12] qemu-iotests: limit non-_PROG-suffixed variables to common.rc
Quoted 13 lines · Kevin Wolf
Am 12.09.2017 um 14:28 hat Paolo Bonzini geschrieben:
Quoted 12 lines · Kevin Wolf
Quoted 10 lines
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.
Quoted 5 lines
Quoted 1 line
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
Re: [Qemu-devel] [PATCH 07/12] qemu-iotests: disintegrate more parts of common.config
In reply to Paolo BonziniAm 12.09.2017 um 14:31 hat Paolo Bonzini geschrieben:
Quoted 7 lines · Kevin Wolf
Quoted 6 lines
Am 09.08.2017 um 23:55 hat Paolo Bonzini geschrieben:
Quoted 5 lines
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.
Quoted 7 lines
Quoted 3 lines
Quoted 1 line
Signed-off-by Paolo Bonzini <[email protected]>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').
Quoted 7 lines
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?
Quoted 8 lines
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
Re: [Qemu-devel] [PATCH 07/12] qemu-iotests: disintegrate more parts of common.config
Quoted 23 lines · Kevin Wolf
Am 12.09.2017 um 14:31 hat Paolo Bonzini geschrieben:
Quoted 7 lines · Kevin Wolf
Quoted 6 lines
Am 09.08.2017 um 23:55 hat Paolo Bonzini geschrieben:
Quoted 5 lines
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.
Quoted 7 lines
Quoted 3 lines
Quoted 1 line
Signed-off-by Paolo Bonzini <[email protected]>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').
Quoted 2 lines
My preferred alternatives would be one of these:
Quoted 8 lines
Quoted 5 lines
- 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