From nobody Wed Nov 19 10:07:53 2025 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 ARC-Seal: i=1; a=rsa-sha256; t=1615392798; cv=none; d=zohomail.com; s=zohoarc; b=T+M2OVEJApn9r9NdAV8HVaHUp2g87ydLZ+rT3MhnRkqNjo4Ft6Km9x159RZ5RHCs9IX+osdEUe3fnpJsz59sVohrxUSysXoYWzZsL2YN1Yzoila2yhvgVX5MMKtagy8lVvcyo1vw/0SV98C61/6Smf0XwIui9M/dbgQAMTix9R4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1615392798; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=WE4WcvIFHhkJweCB6XjXXqbnzA+3tvmVRvG0rsUu4uc=; b=JBGJU5kJsBpCcgDCAfHCu7Ex4+Us+o0krfOPIRSXkr+NagIF/dzZ/ukWMHbvlJVF3cex/tgKS8UxQNcGFL4x3Aj7K+pG4S9yA32QqKoRVigQNapkqMk7EGsA9j76RIeay9afmq+cvMwCWk6wITlom/9Pwl+15gG270d6u6hsjdw= ARC-Authentication-Results: i=1; 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 header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1615392798461169.34281144189003; Wed, 10 Mar 2021 08:13:18 -0800 (PST) Received: from localhost ([::1]:50958 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lK1SU-00088P-KU for importer@patchew.org; Wed, 10 Mar 2021 11:13:14 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:34226) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lK1F7-0003Q0-74 for qemu-devel@nongnu.org; Wed, 10 Mar 2021 10:59:25 -0500 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:59036) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1lK1F3-00026b-9n for qemu-devel@nongnu.org; Wed, 10 Mar 2021 10:59:24 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-577-p3WAt37dMGe0Y-_lw0w-Kw-1; Wed, 10 Mar 2021 10:59:16 -0500 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id C019E80433A; Wed, 10 Mar 2021 15:59:15 +0000 (UTC) Received: from localhost (ovpn-115-159.ams2.redhat.com [10.36.115.159]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 61CD76A047; Wed, 10 Mar 2021 15:59:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1615391960; 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=WE4WcvIFHhkJweCB6XjXXqbnzA+3tvmVRvG0rsUu4uc=; b=LLSx+4VVHqpGSfj8r9KbS3J1CXItZ2GEXiUGeku79MWoTlNqMIhXt4bDNJKths8qgUQL4f f4PLWmvx0rvqjzXxUzwqP6uwlqG7nSme8fcN2FL3sIN5RViaSglfzgvDiC02A5kf9rR3cH qbcj7VIjf7HbxF7HYi4qrmUvp/5oeyo= X-MC-Unique: p3WAt37dMGe0Y-_lw0w-Kw-1 From: Max Reitz To: qemu-block@nongnu.org Subject: [PATCH 3/4] iotests/common.qemu: Allow using the QSD Date: Wed, 10 Mar 2021 16:59:05 +0100 Message-Id: <20210310155906.147478-4-mreitz@redhat.com> In-Reply-To: <20210310155906.147478-1-mreitz@redhat.com> References: <20210310155906.147478-1-mreitz@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=mreitz@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=216.205.24.124; envelope-from=mreitz@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -29 X-Spam_score: -3.0 X-Spam_bar: --- X-Spam_report: (-3.0 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.243, 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_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , qemu-devel@nongnu.org, Max Reitz Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" For block things, we often do not need to run all of qemu, so allow using the qemu-storage-daemon instead. Signed-off-by: Max Reitz --- tests/qemu-iotests/common.qemu | 53 +++++++++++++++++++++++++++------- 1 file changed, 43 insertions(+), 10 deletions(-) diff --git a/tests/qemu-iotests/common.qemu b/tests/qemu-iotests/common.qemu index 56c1ea1bac..8003ed3586 100644 --- a/tests/qemu-iotests/common.qemu +++ b/tests/qemu-iotests/common.qemu @@ -291,6 +291,8 @@ _wait_event() # $qmp_pretty: Set this variable to 'y' to enable QMP pretty printing. # $keep_stderr: Set this variable to 'y' to keep QEMU's stderr output on s= tderr. # If this variable is empty, stderr will be redirected to st= dout. +# $qsd: Set this variable to 'y' to use the QSD instead of QEMU. +# stdout and stderr are never redirected when using the QSD. # Returns: # $QEMU_HANDLE: set to a handle value to communicate with this QEMU instan= ce. # @@ -300,18 +302,31 @@ _launch_qemu() local fifo_out=3D local fifo_in=3D =20 + if [[ $qsd =3D 'y' ]]; then + mon_arg=3D'--monitor' + else + mon_arg=3D'-mon' + fi + if (shopt -s nocasematch; [[ "${qemu_comm_method}" =3D=3D "monitor" ]]) then - comm=3D"-monitor stdio" + comm=3D(--chardev stdio,id=3Dpipe + $mon_arg pipe,mode=3Dreadline) else local qemu_comm_method=3D"qmp" if [ "$qmp_pretty" =3D "y" ]; then - comm=3D"-monitor none -qmp-pretty stdio" + comm=3D(--chardev stdio,id=3Dpipe + $mon_arg pipe,mode=3Dcontrol,pretty=3Don) else - comm=3D"-monitor none -qmp stdio" + comm=3D(--chardev stdio,id=3Dpipe + $mon_arg pipe,mode=3Dcontrol,pretty=3Doff) fi fi =20 + if [[ $qsd !=3D 'y' ]]; then + comm=3D(-monitor none "${comm[@]}") + fi + fifo_out=3D${QEMU_FIFO_OUT}_${_QEMU_HANDLE} fifo_in=3D${QEMU_FIFO_IN}_${_QEMU_HANDLE} mkfifo "${fifo_out}" @@ -322,15 +337,23 @@ _launch_qemu() object_options=3D"--object secret,id=3Dkeysec0,data=3D$IMGKEYSECRE= T" fi =20 + if [[ $qsd =3D 'y' ]]; then + cmd=3D$QSD + args=3D() + else + cmd=3D$QEMU + args=3D(-nographic -serial none) + fi + args+=3D(${object_options} "${comm[@]}") + args+=3D("$@") + + # Just set both QEMU_NEED_PID and QSD_NEED_PID, it can't hurt. if [ -z "$keep_stderr" ]; then - QEMU_NEED_PID=3D'y'\ - ${QEMU} ${object_options} -nographic -serial none ${comm} "${@}" >= "${fifo_out}" \ - 2>&1 \ - <"${fifo_in}" & + QEMU_NEED_PID=3D'y' QSD_NEED_PID=3D'y' $cmd "${args[@]}" \ + >"$fifo_out" 2>&1 <"$fifo_in" & elif [ "$keep_stderr" =3D "y" ]; then - QEMU_NEED_PID=3D'y'\ - ${QEMU} ${object_options} -nographic -serial none ${comm} "${@}" >= "${fifo_out}" \ - <"${fifo_in}" & + QEMU_NEED_PID=3D'y' QSD_NEED_PID=3D'y' $cmd "${args[@]}" \ + >"$fifo_out" <"$fifo_in" & else exit 1 fi @@ -360,6 +383,16 @@ _launch_qemu() silent=3Dyes _timed_wait_for ${_QEMU_HANDLE} "^}" fi fi + + if [[ $qsd =3D 'y' ]]; then + # Wait for PID file, then move it to where qemu would put it + pidfile=3D"$QEMU_TEST_DIR/qemu-storage-daemon.pid" + while [[ ! -f $pidfile ]]; do + sleep 0.5 + done + mv "$pidfile" "$QEMU_TEST_DIR/qemu-${_QEMU_HANDLE}.pid" + fi + QEMU_HANDLE=3D${_QEMU_HANDLE} let _QEMU_HANDLE++ } --=20 2.29.2