From nobody Tue May 14 00:41:25 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1645610237995908.7161626032357; Wed, 23 Feb 2022 01:57:17 -0800 (PST) Received: from localhost ([::1]:40010 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nMoOa-0007Ix-SR for importer@patchew.org; Wed, 23 Feb 2022 04:57:16 -0500 Received: from eggs.gnu.org ([209.51.188.92]:55448) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nMo6p-0003ap-Qf for qemu-devel@nongnu.org; Wed, 23 Feb 2022 04:38:55 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:51696) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nMo6l-0006q9-UO for qemu-devel@nongnu.org; Wed, 23 Feb 2022 04:38:55 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-518-FNWUA7pxNlCsMzTwy-G3TQ-1; Wed, 23 Feb 2022 04:38:47 -0500 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 41CFA824FA8; Wed, 23 Feb 2022 09:38:46 +0000 (UTC) Received: from thuth.com (dhcp-192-232.str.redhat.com [10.33.192.232]) by smtp.corp.redhat.com (Postfix) with ESMTP id 066267610F; Wed, 23 Feb 2022 09:38:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1645609131; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=dgyQtqTwAL59GHF23Oph3vpumf1qkn4ZaADPXufSoDg=; b=ZFKWwzXxmLJdLJvfIqOgmze+KLwK9RZI1nfQc0wFhiHmAL327WR8H3bYlUgOrzKGJiTtNp SxiCxYKpXMnZYL6bfdSKXLo9DCQ7/vZ53jePwK+0Wnup0e92SMOqlTSLoSSs3vWEsCeoOv mg3PCWrvULGV9iD8bo0Hj+7gYI9Qp2g= X-MC-Unique: FNWUA7pxNlCsMzTwy-G3TQ-1 From: Thomas Huth To: qemu-block@nongnu.org, Hanna Reitz , Kevin Wolf Subject: [PATCH v3 1/4] tests/qemu-iotests: Rework the checks and spots using GNU sed Date: Wed, 23 Feb 2022 10:38:37 +0100 Message-Id: <20220223093840.2515281-2-thuth@redhat.com> In-Reply-To: <20220223093840.2515281-1-thuth@redhat.com> References: <20220223093840.2515281-1-thuth@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=thuth@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=thuth@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -28 X-Spam_score: -2.9 X-Spam_bar: -- X-Spam_report: (-2.9 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.082, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paolo Bonzini , qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1645610238803100001 Instead of failing the iotests if GNU sed is not available (or skipping them completely in the check-block.sh script), it would be better to simply skip the bash-based tests that rely on GNU sed, so that the other tests could still be run. Thus we now explicitely use "gsed" (either as direct program or as a wrapper around "sed" if it's the GNU version) in the spots that rely on the GNU sed behavior. Statements that use the "-r" parameter of sed have been switched to use "-E" instead, since this switch is supported by all sed versions on our supported build hosts (most also support "-r", but macOS' sed only supports "-E"). With all these changes in place, we then can also remove the sed checks from the check-block.sh script, so that "make check-block" can now be run on systems without GNU sed, too. Reviewed-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Eric Blake Signed-off-by: Thomas Huth --- tests/check-block.sh | 12 ------ tests/qemu-iotests/271 | 2 +- tests/qemu-iotests/common.filter | 65 ++++++++++++++++---------------- tests/qemu-iotests/common.rc | 45 +++++++++++----------- 4 files changed, 57 insertions(+), 67 deletions(-) diff --git a/tests/check-block.sh b/tests/check-block.sh index 18f7433901..f59496396c 100755 --- a/tests/check-block.sh +++ b/tests/check-block.sh @@ -48,18 +48,6 @@ if LANG=3DC bash --version | grep -q 'GNU bash, version = [123]' ; then skip "bash version too old =3D=3D> Not running the qemu-iotests." fi =20 -if ! (sed --version | grep 'GNU sed') > /dev/null 2>&1 ; then - if ! command -v gsed >/dev/null 2>&1; then - skip "GNU sed not available =3D=3D> Not running the qemu-iotests." - fi -else - # Double-check that we're not using BusyBox' sed which says - # that "This is not GNU sed version 4.0" ... - if sed --version | grep -q 'not GNU sed' ; then - skip "BusyBox sed not supported =3D=3D> Not running the qemu-iotes= ts." - fi -fi - cd tests/qemu-iotests =20 # QEMU_CHECK_BLOCK_AUTO is used to disable some unstable sub-tests diff --git a/tests/qemu-iotests/271 b/tests/qemu-iotests/271 index 2775b4d130..c7c2cadda0 100755 --- a/tests/qemu-iotests/271 +++ b/tests/qemu-iotests/271 @@ -896,7 +896,7 @@ _make_test_img -o extended_l2=3Don 1M # Second and third writes in _concurrent_io() are independent and may fini= sh in # different order. So, filter offset out to match both possible variants. _concurrent_io | $QEMU_IO | _filter_qemu_io | \ - $SED -e 's/\(20480\|40960\)/OFFSET/' + sed -e 's/\(20480\|40960\)/OFFSET/' _concurrent_verify | $QEMU_IO | _filter_qemu_io =20 # success, all done diff --git a/tests/qemu-iotests/common.filter b/tests/qemu-iotests/common.f= ilter index 75cc241580..f6e6b3bd04 100644 --- a/tests/qemu-iotests/common.filter +++ b/tests/qemu-iotests/common.filter @@ -21,44 +21,44 @@ =20 _filter_date() { - $SED -re 's/[0-9]{4}-[0-9]{2}-[0-9]{2} [0-9]{2}:[0-9]{2}:[0-9]{2}/yyyy= -mm-dd hh:mm:ss/' + sed -Ee 's/[0-9]{4}-[0-9]{2}-[0-9]{2} [0-9]{2}:[0-9]{2}:[0-9]{2}/yyyy-= mm-dd hh:mm:ss/' } =20 _filter_vmstate_size() { - $SED -r -e 's/[0-9. ]{5} [KMGT]iB/ SIZE/' \ - -e 's/[0-9. ]{5} B/ SIZE/' + sed -E -e 's/[0-9. ]{5} [KMGT]iB/ SIZE/' \ + -e 's/[0-9. ]{5} B/ SIZE/' } =20 _filter_generated_node_ids() { - $SED -re 's/\#block[0-9]{3,}/NODE_NAME/' + sed -Ee 's/\#block[0-9]{3,}/NODE_NAME/' } =20 _filter_qom_path() { - $SED -e '/Attached to:/s/\device[[0-9]\+\]/device[N]/g' + gsed -e '/Attached to:/s/\device[[0-9]\+\]/device[N]/g' } =20 # replace occurrences of the actual TEST_DIR value with TEST_DIR _filter_testdir() { - $SED -e "s#$TEST_DIR/#TEST_DIR/#g" \ - -e "s#$SOCK_DIR/#SOCK_DIR/#g" \ - -e "s#SOCK_DIR/fuse-#TEST_DIR/#g" + sed -e "s#$TEST_DIR/#TEST_DIR/#g" \ + -e "s#$SOCK_DIR/#SOCK_DIR/#g" \ + -e "s#SOCK_DIR/fuse-#TEST_DIR/#g" } =20 # replace occurrences of the actual IMGFMT value with IMGFMT _filter_imgfmt() { - $SED -e "s#$IMGFMT#IMGFMT#g" + sed -e "s#$IMGFMT#IMGFMT#g" } =20 # Replace error message when the format is not supported and delete # the output lines after the first one _filter_qemu_img_check() { - $SED -e '/allocated.*fragmented.*compressed clusters/d' \ + gsed -e '/allocated.*fragmented.*compressed clusters/d' \ -e 's/qemu-img: This image format does not support checks/No error= s were found on the image./' \ -e '/Image end offset: [0-9]\+/d' } @@ -66,13 +66,14 @@ _filter_qemu_img_check() # Removes \r from messages _filter_win32() { - $SED -e 's/\r//g' + gsed -e 's/\r//g' } =20 # sanitize qemu-io output _filter_qemu_io() { - _filter_win32 | $SED -e "s/[0-9]* ops\; [0-9/:. sec]* ([0-9/.inf]* [EP= TGMKiBbytes]*\/sec and [0-9/.inf]* ops\/sec)/X ops\; XX:XX:XX.X (XXX YYY\/s= ec and XXX ops\/sec)/" \ + _filter_win32 | \ + gsed -e "s/[0-9]* ops\; [0-9/:. sec]* ([0-9/.inf]* [EPTGMKiBbytes]*\/s= ec and [0-9/.inf]* ops\/sec)/X ops\; XX:XX:XX.X (XXX YYY\/sec and XXX ops\/= sec)/" \ -e "s/: line [0-9][0-9]*: *[0-9][0-9]*\( Aborted\| Killed\)/:\1/"= \ -e "s/qemu-io> //g" } @@ -80,7 +81,7 @@ _filter_qemu_io() # replace occurrences of QEMU_PROG with "qemu" _filter_qemu() { - $SED -e "s#\\(^\\|(qemu) \\)$(basename $QEMU_PROG):#\1QEMU_PROG:#" \ + gsed -e "s#\\(^\\|(qemu) \\)$(basename $QEMU_PROG):#\1QEMU_PROG:#" \ -e 's#^QEMU [0-9]\+\.[0-9]\+\.[0-9]\+ monitor#QEMU X.Y.Z monitor#'= \ -e $'s#\r##' # QEMU monitor uses \r\n line endings } @@ -89,7 +90,7 @@ _filter_qemu() _filter_qmp() { _filter_win32 | \ - $SED -e 's#\("\(micro\)\?seconds": \)[0-9]\+#\1 TIMESTAMP#g' \ + gsed -e 's#\("\(micro\)\?seconds": \)[0-9]\+#\1 TIMESTAMP#g' \ -e 's#^{"QMP":.*}$#QMP_VERSION#' \ -e '/^ "QMP": {\s*$/, /^ }\s*$/ c\' \ -e ' QMP_VERSION' @@ -98,32 +99,32 @@ _filter_qmp() # readline makes HMP command strings so long that git complains _filter_hmp() { - $SED -e $'s/^\\((qemu) \\)\\?.*\e\\[D/\\1/g' \ + gsed -e $'s/^\\((qemu) \\)\\?.*\e\\[D/\\1/g' \ -e $'s/\e\\[K//g' } =20 # replace block job offset _filter_block_job_offset() { - $SED -e 's/, "offset": [0-9]\+,/, "offset": OFFSET,/' + gsed -e 's/, "offset": [0-9]\+,/, "offset": OFFSET,/' } =20 # replace block job len _filter_block_job_len() { - $SED -e 's/, "len": [0-9]\+,/, "len": LEN,/g' + gsed -e 's/, "len": [0-9]\+,/, "len": LEN,/g' } =20 # replace actual image size (depends on the host filesystem) _filter_actual_image_size() { - $SED -s 's/\("actual-size":\s*\)[0-9]\+/\1SIZE/g' + gsed -s 's/\("actual-size":\s*\)[0-9]\+/\1SIZE/g' } =20 # Filename filters for qemu-img create _filter_img_create_filenames() { - $SED \ + sed \ -e "s#$REMOTE_TEST_DIR#TEST_DIR#g" \ -e "s#$IMGPROTO:$TEST_DIR#TEST_DIR#g" \ -e "s#$TEST_DIR#TEST_DIR#g" \ @@ -141,7 +142,7 @@ _do_filter_img_create() # precedes ", fmt=3D") and the options part ($options, which starts # with "fmt=3D") # (And just echo everything before the first "^Formatting") - readarray formatting_line < <($SED -e 's/, fmt=3D/\n/') + readarray formatting_line < <(gsed -e 's/, fmt=3D/\n/') =20 filename_part=3D${formatting_line[0]} unset formatting_line[0] @@ -168,11 +169,11 @@ _do_filter_img_create() options=3D$( echo "$options" \ | tr '\n' '\0' \ - | $SED -e 's/ \([a-z0-9_.-]*\)=3D/\n\1=3D/g' \ + | gsed -e 's/ \([a-z0-9_.-]*\)=3D/\n\1=3D/g' \ | grep -a -e '^fmt' -e '^size' -e '^backing' -e '^preallocation' \ -e '^encryption' "${grep_data_file[@]}" \ | _filter_img_create_filenames \ - | $SED \ + | sed \ -e 's/^\(fmt\)/0-\1/' \ -e 's/^\(size\)/1-\1/' \ -e 's/^\(backing\)/2-\1/' \ @@ -180,9 +181,9 @@ _do_filter_img_create() -e 's/^\(encryption\)/4-\1/' \ -e 's/^\(preallocation\)/8-\1/' \ | LC_ALL=3DC sort \ - | $SED -e 's/^[0-9]-//' \ + | sed -e 's/^[0-9]-//' \ | tr '\n\0' ' \n' \ - | $SED -e 's/^ *$//' -e 's/ *$//' + | sed -e 's/^ *$//' -e 's/ *$//' ) =20 if [ -n "$options" ]; then @@ -208,7 +209,7 @@ _filter_img_create() =20 _filter_img_create_size() { - $SED -e "s# size=3D[0-9]\\+# size=3DSIZE#g" + gsed -e "s# size=3D[0-9]\\+# size=3DSIZE#g" } =20 _filter_img_info() @@ -222,7 +223,7 @@ _filter_img_info() =20 discard=3D0 regex_json_spec_start=3D'^ *"format-specific": \{' - $SED -e "s#$REMOTE_TEST_DIR#TEST_DIR#g" \ + gsed -e "s#$REMOTE_TEST_DIR#TEST_DIR#g" \ -e "s#$IMGPROTO:$TEST_DIR#TEST_DIR#g" \ -e "s#$TEST_DIR#TEST_DIR#g" \ -e "s#$SOCK_DIR#SOCK_DIR#g" \ @@ -284,7 +285,7 @@ _filter_qemu_img_map() data_file_filter=3D(-e "s#$data_file_pattern#\\1#") fi =20 - $SED -e 's/\([0-9a-fx]* *[0-9a-fx]* *\)[0-9a-fx]* */\1/g' \ + sed -e 's/\([0-9a-fx]* *[0-9a-fx]* *\)[0-9a-fx]* */\1/g' \ -e 's/"offset": [0-9]\+/"offset": OFFSET/g' \ -e 's/Mapped to *//' \ "${data_file_filter[@]}" \ @@ -298,7 +299,7 @@ _filter_nbd() # receive callbacks sometimes, making them unreliable. # # Filter out the TCP port number since this changes between runs. - $SED -e '/nbd\/.*\.c:/d' \ + sed -e '/nbd\/.*\.c:/d' \ -e 's#127\.0\.0\.1:[0-9]*#127.0.0.1:PORT#g' \ -e "s#?socket=3D$SOCK_DIR#?socket=3DSOCK_DIR#g" \ -e 's#\(foo\|PORT/\?\|.sock\): Failed to .*$#\1#' @@ -335,14 +336,14 @@ sys.stdout.write(result)' =20 _filter_authz_check_tls() { - $SED -e 's/TLS x509 authz check for .* is denied/TLS x509 authz check = for DISTINGUISHED-NAME is denied/' + sed -e 's/TLS x509 authz check for .* is denied/TLS x509 authz check f= or DISTINGUISHED-NAME is denied/' } =20 _filter_qcow2_compression_type_bit() { - $SED -e 's/\(incompatible_features\s\+\)\[3\(, \)\?/\1[/' \ - -e 's/\(incompatible_features.*\), 3\]/\1]/' \ - -e 's/\(incompatible_features.*\), 3\(,.*\)/\1\2/' + gsed -e 's/\(incompatible_features\s\+\)\[3\(, \)\?/\1[/' \ + -e 's/\(incompatible_features.*\), 3\]/\1]/' \ + -e 's/\(incompatible_features.*\), 3\(,.*\)/\1\2/' } =20 # make sure this script returns success diff --git a/tests/qemu-iotests/common.rc b/tests/qemu-iotests/common.rc index 9885030b43..3bfd94c2e0 100644 --- a/tests/qemu-iotests/common.rc +++ b/tests/qemu-iotests/common.rc @@ -17,17 +17,28 @@ # along with this program. If not, see . # =20 -SED=3D -for sed in sed gsed; do - ($sed --version | grep 'GNU sed') > /dev/null 2>&1 - if [ "$?" -eq 0 ]; then - SED=3D$sed - break - fi -done -if [ -z "$SED" ]; then - echo "$0: GNU sed not found" - exit 1 +# bail out, setting up .notrun file +_notrun() +{ + echo "$*" >"$OUTPUT_DIR/$seq.notrun" + echo "$seq not run: $*" + status=3D0 + exit +} + +if ! command -v gsed >/dev/null 2>&1; then + if sed --version 2>&1 | grep -v 'not GNU sed' | grep 'GNU sed' > /dev/= null; + then + gsed() + { + sed "$@" + } + else + gsed() + { + _notrun "GNU sed not available" + } + fi fi =20 dd() @@ -722,16 +733,6 @@ _img_info() done } =20 -# bail out, setting up .notrun file -# -_notrun() -{ - echo "$*" >"$OUTPUT_DIR/$seq.notrun" - echo "$seq not run: $*" - status=3D0 - exit -} - # bail out, setting up .casenotrun file # The function _casenotrun() is used as a notifier. It is the # caller's responsibility to make skipped a particular test. @@ -920,7 +921,7 @@ _require_working_luks() IMGFMT=3D'luks' _rm_test_img "$file" =20 if [ $status !=3D 0 ]; then - reason=3D$(echo "$output" | grep "$file:" | $SED -e "s#.*$file: *#= #") + reason=3D$(echo "$output" | grep "$file:" | sed -e "s#.*$file: *##= ") if [ -z "$reason" ]; then reason=3D"Failed to create a LUKS image" fi --=20 2.27.0 From nobody Tue May 14 00:41:25 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1645611144623716.6400970927609; Wed, 23 Feb 2022 02:12:24 -0800 (PST) Received: from localhost ([::1]:41012 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nModD-0002Gg-HJ for importer@patchew.org; Wed, 23 Feb 2022 05:12:23 -0500 Received: from eggs.gnu.org ([209.51.188.92]:55366) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nMo6o-0003Xa-21 for qemu-devel@nongnu.org; Wed, 23 Feb 2022 04:38:54 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:52624) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nMo6l-0006pn-8Z for qemu-devel@nongnu.org; Wed, 23 Feb 2022 04:38:52 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-495-OE63LHwHN8GA1F1niBK0tg-1; Wed, 23 Feb 2022 04:38:48 -0500 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id A037C824FA7; Wed, 23 Feb 2022 09:38:47 +0000 (UTC) Received: from thuth.com (dhcp-192-232.str.redhat.com [10.33.192.232]) by smtp.corp.redhat.com (Postfix) with ESMTP id 899057A3EE; Wed, 23 Feb 2022 09:38:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1645609129; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=+M0BmWF8bea2l7F8zRQrObS6TxZzlrMNsawAIKkn0g8=; b=AR6ebKPqonGPmFO42H3410z52DF2oKmTkwuJJJEkKdlUAhgp+drkTpT6QijF9TQWh+IcOJ pBKVi+PYxK+t7yi284lY7MZjznzDSS+8YuG5Zdi589OucDL1Pj0lr2jSzeS5ZsnrLIrJf+ JMxNyjfvBgV9rvnOviGALGrq3DQ7pmE= X-MC-Unique: OE63LHwHN8GA1F1niBK0tg-1 From: Thomas Huth To: qemu-block@nongnu.org, Hanna Reitz , Kevin Wolf Subject: [PATCH v3 2/4] tests/qemu-iotests/meson.build: Improve the indentation Date: Wed, 23 Feb 2022 10:38:38 +0100 Message-Id: <20220223093840.2515281-3-thuth@redhat.com> In-Reply-To: <20220223093840.2515281-1-thuth@redhat.com> References: <20220223093840.2515281-1-thuth@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=thuth@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=thuth@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -28 X-Spam_score: -2.9 X-Spam_bar: -- X-Spam_report: (-2.9 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.082, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paolo Bonzini , qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1645611146772100001 By using subdir_done(), we can get rid of one level of indentation in this file. This will make it easier to add more conditions to skip the iotests in future patches. Reviewed-by: Hanna Reitz Reviewed-by: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Thomas Huth --- tests/qemu-iotests/meson.build | 61 ++++++++++++++++++---------------- 1 file changed, 32 insertions(+), 29 deletions(-) diff --git a/tests/qemu-iotests/meson.build b/tests/qemu-iotests/meson.build index 9747bb68a5..92f09251a6 100644 --- a/tests/qemu-iotests/meson.build +++ b/tests/qemu-iotests/meson.build @@ -1,30 +1,33 @@ -if have_tools and targetos !=3D 'windows' and not get_option('gprof') - qemu_iotests_binaries =3D [qemu_img, qemu_io, qemu_nbd, qsd] - qemu_iotests_env =3D {'PYTHON': python.full_path()} - qemu_iotests_formats =3D { - 'qcow2': 'quick', - 'raw': 'slow', - 'qed': 'thorough', - 'vmdk': 'thorough', - 'vpc': 'thorough' - } - - foreach k, v : emulators - if k.startswith('qemu-system-') - qemu_iotests_binaries +=3D v - endif - endforeach - foreach format, speed: qemu_iotests_formats - if speed =3D=3D 'quick' - suites =3D 'block' - else - suites =3D ['block-' + speed, speed] - endif - test('qemu-iotests ' + format, sh, args: [files('../check-block.sh'), = format], - depends: qemu_iotests_binaries, env: qemu_iotests_env, - protocol: 'tap', - suite: suites, - timeout: 0, - is_parallel: false) - endforeach +if not have_tools or targetos =3D=3D 'windows' or get_option('gprof') + subdir_done() endif + +qemu_iotests_binaries =3D [qemu_img, qemu_io, qemu_nbd, qsd] +qemu_iotests_env =3D {'PYTHON': python.full_path()} +qemu_iotests_formats =3D { + 'qcow2': 'quick', + 'raw': 'slow', + 'qed': 'thorough', + 'vmdk': 'thorough', + 'vpc': 'thorough' +} + +foreach k, v : emulators + if k.startswith('qemu-system-') + qemu_iotests_binaries +=3D v + endif +endforeach + +foreach format, speed: qemu_iotests_formats + if speed =3D=3D 'quick' + suites =3D 'block' + else + suites =3D ['block-' + speed, speed] + endif + test('qemu-iotests ' + format, sh, args: [files('../check-block.sh'), fo= rmat], + depends: qemu_iotests_binaries, env: qemu_iotests_env, + protocol: 'tap', + suite: suites, + timeout: 0, + is_parallel: false) +endforeach --=20 2.27.0 From nobody Tue May 14 00:41:25 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1645611245282348.78641942218746; Wed, 23 Feb 2022 02:14:05 -0800 (PST) Received: from localhost ([::1]:45466 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nMoep-0005RF-Uv for importer@patchew.org; Wed, 23 Feb 2022 05:14:03 -0500 Received: from eggs.gnu.org ([209.51.188.92]:55438) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nMo6p-0003aI-1W for qemu-devel@nongnu.org; Wed, 23 Feb 2022 04:38:55 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:25133) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nMo6m-0006qH-2q for qemu-devel@nongnu.org; Wed, 23 Feb 2022 04:38:54 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-460-JyiMgKDeMLOBJmVfNewvjw-1; Wed, 23 Feb 2022 04:38:49 -0500 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 0AE441091DA2; Wed, 23 Feb 2022 09:38:49 +0000 (UTC) Received: from thuth.com (dhcp-192-232.str.redhat.com [10.33.192.232]) by smtp.corp.redhat.com (Postfix) with ESMTP id E78937610F; Wed, 23 Feb 2022 09:38:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1645609131; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=CcHd9pVKdoKEPO8W6j0oOilwiCIhJpkEUTcnEJb0VKE=; b=NCD9aCYYG3egUAxKS0yiUYi0gKQWnC1MJJUoAXNFEKaCVhZdgjJxxTySKkVz/ID6SkWlEO ytcLzJhhrP1lanfajEYq+nAKat5Ci1eeDKb53UWroOxfj+3WNNBCcRVASQ2O9+QeTTc+fV 3N733c/dVPrYnC8fs7ekasi/dOzMnL4= X-MC-Unique: JyiMgKDeMLOBJmVfNewvjw-1 From: Thomas Huth To: qemu-block@nongnu.org, Hanna Reitz , Kevin Wolf Subject: [PATCH v3 3/4] tests/qemu-iotests: Move the bash and sanitizer checks to meson.build Date: Wed, 23 Feb 2022 10:38:39 +0100 Message-Id: <20220223093840.2515281-4-thuth@redhat.com> In-Reply-To: <20220223093840.2515281-1-thuth@redhat.com> References: <20220223093840.2515281-1-thuth@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=thuth@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=thuth@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -28 X-Spam_score: -2.9 X-Spam_bar: -- X-Spam_report: (-2.9 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.082, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paolo Bonzini , qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1645611247658100002 Content-Type: text/plain; charset="utf-8" We want to get rid of check-block.sh in the long run, so let's move the checks for the bash version and sanitizers from check-block.sh into the meson.build file instead. Signed-off-by: Thomas Huth Reviewed-by: Hanna Reitz --- tests/check-block.sh | 26 -------------------------- tests/qemu-iotests/meson.build | 14 ++++++++++++++ 2 files changed, 14 insertions(+), 26 deletions(-) diff --git a/tests/check-block.sh b/tests/check-block.sh index f59496396c..5de2c1ba0b 100755 --- a/tests/check-block.sh +++ b/tests/check-block.sh @@ -18,36 +18,10 @@ skip() { exit 0 } =20 -# Disable tests with any sanitizer except for specific ones -SANITIZE_FLAGS=3D$( grep "CFLAGS.*-fsanitize" config-host.mak 2>/dev/null ) -ALLOWED_SANITIZE_FLAGS=3D"safe-stack cfi-icall" -#Remove all occurrencies of allowed Sanitize flags -for j in ${ALLOWED_SANITIZE_FLAGS}; do - TMP_FLAGS=3D${SANITIZE_FLAGS} - SANITIZE_FLAGS=3D"" - for i in ${TMP_FLAGS}; do - if ! echo ${i} | grep -q "${j}" 2>/dev/null; then - SANITIZE_FLAGS=3D"${SANITIZE_FLAGS} ${i}" - fi - done -done -if echo ${SANITIZE_FLAGS} | grep -q "\-fsanitize" 2>/dev/null; then - # Have a sanitize flag that is not allowed, stop - skip "Sanitizers are enabled =3D=3D> Not running the qemu-iotests." -fi - if [ -z "$(find . -name 'qemu-system-*' -print)" ]; then skip "No qemu-system binary available =3D=3D> Not running the qemu-iot= ests." fi =20 -if ! command -v bash >/dev/null 2>&1 ; then - skip "bash not available =3D=3D> Not running the qemu-iotests." -fi - -if LANG=3DC bash --version | grep -q 'GNU bash, version [123]' ; then - skip "bash version too old =3D=3D> Not running the qemu-iotests." -fi - cd tests/qemu-iotests =20 # QEMU_CHECK_BLOCK_AUTO is used to disable some unstable sub-tests diff --git a/tests/qemu-iotests/meson.build b/tests/qemu-iotests/meson.build index 92f09251a6..323a4acb6a 100644 --- a/tests/qemu-iotests/meson.build +++ b/tests/qemu-iotests/meson.build @@ -2,6 +2,20 @@ if not have_tools or targetos =3D=3D 'windows' or get_opti= on('gprof') subdir_done() endif =20 +foreach cflag: config_host['QEMU_CFLAGS'].split() + if cflag.startswith('-fsanitize') and \ + not cflag.contains('safe-stack') and not cflag.contains('cfi-icall') + message('Sanitizers are enabled =3D=3D> Disabled the qemu-iotests.') + subdir_done() + endif +endforeach + +bash =3D find_program('bash', required: false, version: '>=3D 4.0') +if not bash.found() + message('bash >=3D v4.0 not available =3D=3D> Disabled the qemu-iotests.= ') + subdir_done() +endif + qemu_iotests_binaries =3D [qemu_img, qemu_io, qemu_nbd, qsd] qemu_iotests_env =3D {'PYTHON': python.full_path()} qemu_iotests_formats =3D { --=20 2.27.0 From nobody Tue May 14 00:41:25 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1645611245626827.9718317695387; Wed, 23 Feb 2022 02:14:05 -0800 (PST) Received: from localhost ([::1]:45422 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nMoep-0005PG-FH for importer@patchew.org; Wed, 23 Feb 2022 05:14:03 -0500 Received: from eggs.gnu.org ([209.51.188.92]:55588) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nMo73-0003hz-Sm for qemu-devel@nongnu.org; Wed, 23 Feb 2022 04:39:13 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:41428) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nMo6n-0006rE-9q for qemu-devel@nongnu.org; Wed, 23 Feb 2022 04:39:09 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-631-ZWPtOoTcPMGMbMpK-HfdNA-1; Wed, 23 Feb 2022 04:38:51 -0500 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 698D71854E21; Wed, 23 Feb 2022 09:38:50 +0000 (UTC) Received: from thuth.com (dhcp-192-232.str.redhat.com [10.33.192.232]) by smtp.corp.redhat.com (Postfix) with ESMTP id 51F647610F; Wed, 23 Feb 2022 09:38:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1645609132; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=S8ew1PBtrjnnwvDGKmcp6L/l+r15vz6y4Mrs4U+PNhM=; b=LE2M7IfLOvaIbVCWaw6q1gy9OvTq3HOaxi/OFxk35vPLtpTVAHuvR9RMMY5crByjgh1uvZ XpWB156a4hrd8/Jvv5H723kjRUy4WFBKkFtbqzjISrHdq639SCijbzWyNF/75atTUfQRcj zzqeWCiDVQCk6ZeRQnmw8jdm8tnPSj8= X-MC-Unique: ZWPtOoTcPMGMbMpK-HfdNA-1 From: Thomas Huth To: qemu-block@nongnu.org, Hanna Reitz , Kevin Wolf Subject: [PATCH v3 4/4] tests: Do not treat the iotests as separate meson test target anymore Date: Wed, 23 Feb 2022 10:38:40 +0100 Message-Id: <20220223093840.2515281-5-thuth@redhat.com> In-Reply-To: <20220223093840.2515281-1-thuth@redhat.com> References: <20220223093840.2515281-1-thuth@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=thuth@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=thuth@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -21 X-Spam_score: -2.2 X-Spam_bar: -- X-Spam_report: (-2.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.082, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paolo Bonzini , qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1645611249444100006 Content-Type: text/plain; charset="utf-8" If there is a failing iotest, the output is currently not logged to the console anymore. To get this working again, we need to run the meson test runner with --print-errorlogs (and without --verbose). We could update the "meson test" call in tests/Makefile.include, but actually it's nicer and easier if we simply do not treat the iotests as separate test target anymore and integrate them along with the other test suites. Signed-off-by: Thomas Huth --- meson.build | 6 +++--- scripts/mtest2make.py | 4 ---- tests/Makefile.include | 9 +-------- 3 files changed, 4 insertions(+), 15 deletions(-) diff --git a/meson.build b/meson.build index 8df40bfac4..556479c785 100644 --- a/meson.build +++ b/meson.build @@ -3,9 +3,9 @@ project('qemu', ['c'], meson_version: '>=3D0.59.3', 'b_staticpic=3Dfalse', 'stdsplit=3Dfalse'], version: files('VERSION')) =20 -add_test_setup('quick', exclude_suites: ['block', 'slow', 'thorough'], is_= default: true) -add_test_setup('slow', exclude_suites: ['block', 'thorough'], env: ['G_TES= T_SLOW=3D1', 'SPEED=3Dslow']) -add_test_setup('thorough', exclude_suites: ['block'], env: ['G_TEST_SLOW= =3D1', 'SPEED=3Dthorough']) +add_test_setup('quick', exclude_suites: ['slow', 'thorough'], is_default: = true) +add_test_setup('slow', exclude_suites: ['thorough'], env: ['G_TEST_SLOW=3D= 1', 'SPEED=3Dslow']) +add_test_setup('thorough', env: ['G_TEST_SLOW=3D1', 'SPEED=3Dthorough']) =20 not_found =3D dependency('', required: false) keyval =3D import('keyval') diff --git a/scripts/mtest2make.py b/scripts/mtest2make.py index 4d542e8aaa..304634b71e 100644 --- a/scripts/mtest2make.py +++ b/scripts/mtest2make.py @@ -101,10 +101,6 @@ def emit_suite(name, suite, prefix): testsuites =3D defaultdict(Suite) for test in introspect['tests']: process_tests(test, targets, testsuites) -# HACK: check-block is a separate target so that it runs with --verbose; -# only write the dependencies -emit_suite_deps('block', testsuites['block'], 'check') -del testsuites['block'] emit_prolog(testsuites, 'check') for name, suite in testsuites.items(): emit_suite(name, suite, 'check') diff --git a/tests/Makefile.include b/tests/Makefile.include index e7153c8e91..b89018cdcc 100644 --- a/tests/Makefile.include +++ b/tests/Makefile.include @@ -147,16 +147,9 @@ check-acceptance: check-acceptance-deprecated-warning = | check-avocado =20 # Consolidated targets =20 -.PHONY: check-block check check-clean get-vm-images +.PHONY: check check-clean get-vm-images check: =20 -ifneq ($(.check-block.deps),) -check: check-block -check-block: run-ninja - $(if $(MAKE.n),,+)$(MESON) test $(MTESTARGS) $(.mtestargs) --verbose \ - --logbase iotestslog $(call .speed.$(SPEED), block block-slow block-thor= ough) -endif - check-build: run-ninja =20 check-clean: --=20 2.27.0