From patchwork Thu Apr 1 13:28:14 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Max Reitz X-Patchwork-Id: 12178071 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 97D27C433B4 for ; Thu, 1 Apr 2021 13:32:09 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 4A2FC61247 for ; Thu, 1 Apr 2021 13:32:09 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 4A2FC61247 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:54158 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lRxQe-0004Bb-Av for qemu-devel@archiver.kernel.org; Thu, 01 Apr 2021 09:32:08 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:40846) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lRxNC-0001L6-Hd for qemu-devel@nongnu.org; Thu, 01 Apr 2021 09:28:34 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:20986) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lRxNA-0004Eo-U0 for qemu-devel@nongnu.org; Thu, 01 Apr 2021 09:28:34 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1617283708; 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=xQZf1XUH9nv0RydRhZJIYRzVUDUZVMB6PjhxnjL9WrI=; b=el/nzS04XoMSSn6Rc0NvojL9bGRuDRW2PThKX+7hhly+c1ZBx6myhcaJ3IrADh/Xeb3p0h 9ofvC6Rcd5iRq36nJb/XW4josks/emVAI0op5isLmMdjwjrL4/XtB3GJG2h0CHENITtHB6 PpgkgSbLcKYuJQ3Zgg6J/u27xCxRy9Q= 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-142-YOLHvh16PzeW4uurVnJ9Vg-1; Thu, 01 Apr 2021 09:28:27 -0400 X-MC-Unique: YOLHvh16PzeW4uurVnJ9Vg-1 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 43C7D108BD0A; Thu, 1 Apr 2021 13:28:26 +0000 (UTC) Received: from localhost (ovpn-114-60.ams2.redhat.com [10.36.114.60]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 960771001281; Thu, 1 Apr 2021 13:28:22 +0000 (UTC) From: Max Reitz To: qemu-block@nongnu.org Subject: [PATCH 1/2] iotests/common.qemu: Allow using the QSD Date: Thu, 1 Apr 2021 15:28:14 +0200 Message-Id: <20210401132815.139575-2-mreitz@redhat.com> In-Reply-To: <20210401132815.139575-1-mreitz@redhat.com> References: <20210401132815.139575-1-mreitz@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 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 Received-SPF: pass client-ip=170.10.133.124; envelope-from=mreitz@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, 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_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham 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 , Vladimir Sementsov-Ogievskiy , qemu-devel@nongnu.org, Stefan Hajnoczi , Max Reitz Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" 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 0fc52d20d7..ca8bb43c63 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 stderr. # If this variable is empty, stderr will be redirected to stdout. +# $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 instance. # @@ -300,18 +302,31 @@ _launch_qemu() local fifo_out= local fifo_in= + if [[ $qsd = 'y' ]]; then + mon_arg='--monitor' + else + mon_arg='-mon' + fi + if (shopt -s nocasematch; [[ "${qemu_comm_method}" == "monitor" ]]) then - comm="-monitor stdio" + comm=(--chardev stdio,id=pipe + $mon_arg pipe,mode=readline) else local qemu_comm_method="qmp" if [ "$qmp_pretty" = "y" ]; then - comm="-monitor none -qmp-pretty stdio" + comm=(--chardev stdio,id=pipe + $mon_arg pipe,mode=control,pretty=on) else - comm="-monitor none -qmp stdio" + comm=(--chardev stdio,id=pipe + $mon_arg pipe,mode=control,pretty=off) fi fi + if [[ $qsd != 'y' ]]; then + comm=(-monitor none "${comm[@]}") + fi + fifo_out=${QEMU_FIFO_OUT}_${_QEMU_HANDLE} fifo_in=${QEMU_FIFO_IN}_${_QEMU_HANDLE} mkfifo "${fifo_out}" @@ -322,15 +337,23 @@ _launch_qemu() object_options="--object secret,id=keysec0,data=$IMGKEYSECRET" fi + if [[ $qsd = 'y' ]]; then + cmd=$QSD + args=() + else + cmd=$QEMU + args=(-nographic -serial none) + fi + args+=(${object_options} "${comm[@]}") + args+=("$@") + + # Just set both QEMU_NEED_PID and QSD_NEED_PID, it can't hurt. if [ -z "$keep_stderr" ]; then - QEMU_NEED_PID='y'\ - ${QEMU} ${object_options} -nographic -serial none ${comm} "${@}" >"${fifo_out}" \ - 2>&1 \ - <"${fifo_in}" & + QEMU_NEED_PID='y' QSD_NEED_PID='y' $cmd "${args[@]}" \ + >"$fifo_out" 2>&1 <"$fifo_in" & elif [ "$keep_stderr" = "y" ]; then - QEMU_NEED_PID='y'\ - ${QEMU} ${object_options} -nographic -serial none ${comm} "${@}" >"${fifo_out}" \ - <"${fifo_in}" & + QEMU_NEED_PID='y' QSD_NEED_PID='y' $cmd "${args[@]}" \ + >"$fifo_out" <"$fifo_in" & else exit 1 fi @@ -360,6 +383,16 @@ _launch_qemu() silent=yes _timed_wait_for ${_QEMU_HANDLE} "^}" fi fi + + if [[ $qsd = 'y' ]]; then + # Wait for PID file, then move it to where qemu would put it + pidfile="$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=${_QEMU_HANDLE} let _QEMU_HANDLE++ } From patchwork Thu Apr 1 13:28:15 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Max Reitz X-Patchwork-Id: 12178073 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B7775C433ED for ; Thu, 1 Apr 2021 13:33:04 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 513B461248 for ; Thu, 1 Apr 2021 13:33:04 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 513B461248 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:56452 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lRxRX-0005CK-8a for qemu-devel@archiver.kernel.org; Thu, 01 Apr 2021 09:33:03 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:40856) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lRxND-0001Mb-Df for qemu-devel@nongnu.org; Thu, 01 Apr 2021 09:28:35 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:54828) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lRxNA-0004F0-Uq for qemu-devel@nongnu.org; Thu, 01 Apr 2021 09:28:35 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1617283711; 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=ji3bqdOEmcQvLs4vMQdyc1J8FYafSezblmrQofvaCuc=; b=WGbSsPUowARjljGaIPwkiDudMXvoKIe8ozV9AvAaY0jpMpAygs01DYj/d0fsXSBSSFi5jt e3ZsWpWptXitW0WuMAZyj1LYadqA56eiuClKcMWkoJBPWI4ybkLLkVuw+L28UoKk/2nnbu emusKlb2vnib09vtP+SkYSbur7JeBZ4= 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-101-TfvknapTMpKuyVx_qEMHhA-1; Thu, 01 Apr 2021 09:28:29 -0400 X-MC-Unique: TfvknapTMpKuyVx_qEMHhA-1 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 76C71190D342; Thu, 1 Apr 2021 13:28:28 +0000 (UTC) Received: from localhost (ovpn-114-60.ams2.redhat.com [10.36.114.60]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 0D6A31001281; Thu, 1 Apr 2021 13:28:27 +0000 (UTC) From: Max Reitz To: qemu-block@nongnu.org Subject: [PATCH 2/2] iotests/qsd-jobs: Use common.qemu for the QSD Date: Thu, 1 Apr 2021 15:28:15 +0200 Message-Id: <20210401132815.139575-3-mreitz@redhat.com> In-Reply-To: <20210401132815.139575-1-mreitz@redhat.com> References: <20210401132815.139575-1-mreitz@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 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 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: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, 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_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham 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 , Vladimir Sementsov-Ogievskiy , qemu-devel@nongnu.org, Stefan Hajnoczi , Max Reitz Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" Using common.qemu allows us to wait for specific replies, so we can for example wait for events. This allows starting the active commit job and then wait for it to be ready before quitting the QSD, so we the output is always the same. (Strictly speaking, this is only necessary for the first test in qsd-jobs, but we might as well make the second one use common.qemu's infrastructure, too.) Reported-by: Peter Maydell Signed-off-by: Max Reitz Reviewed-by: Vladimir Sementsov-Ogievskiy --- tests/qemu-iotests/tests/qsd-jobs | 55 ++++++++++++++++++++------- tests/qemu-iotests/tests/qsd-jobs.out | 10 ++++- 2 files changed, 49 insertions(+), 16 deletions(-) diff --git a/tests/qemu-iotests/tests/qsd-jobs b/tests/qemu-iotests/tests/qsd-jobs index 972b6b3898..af7f886f15 100755 --- a/tests/qemu-iotests/tests/qsd-jobs +++ b/tests/qemu-iotests/tests/qsd-jobs @@ -38,6 +38,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15 cd .. . ./common.rc . ./common.filter +. ./common.qemu _supported_fmt qcow2 _supported_proto generic @@ -52,32 +53,58 @@ echo "=== Job still present at shutdown ===" echo # Just make sure that this doesn't crash -$QSD --chardev stdio,id=stdio --monitor chardev=stdio \ +qsd=y _launch_qemu \ --blockdev node-name=file0,driver=file,filename="$TEST_IMG" \ - --blockdev node-name=fmt0,driver=qcow2,file=file0 <