From nobody Thu May 2 18:58:07 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 ARC-Seal: i=1; a=rsa-sha256; t=1616768809; cv=none; d=zohomail.com; s=zohoarc; b=dwlF8dE3GYgTuo4QyR6djE5eK8WrVfnRvCxeb+wWfdLFbPn/gZ07L63naJjpAWmHGtxASjwtPAJM5g4x+U2kjmRTfCyOX17s165oX+ljzbmHfHN4rYcUYnv945Q3PVLsBAdcejyVcAmoxpQ0vG+OdYVq+8gWfexDyzMUVF9RwJA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1616768809; h=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=sy7BnXpvFvOYWJ2dLQm2mMqmZUakPZXII5Bsc1E4lrM=; b=Q1pfJTRF15bvR0HSTKActHijO/u7jht+6CE8pb2ZeJYscXPSEcnP/cFsTrluhuowwBHetnkzVWrIQrsrcDb40G8+vsUbvXJP9Uv5LyeOFdspQNwZC4GxE6/VVkllv3C/V51f2l8xkCFcpjfR6GaY53A7h8Ev7b6k47ImsVzDIuU= 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 1616768809027282.8242113982757; Fri, 26 Mar 2021 07:26:49 -0700 (PDT) Received: from localhost ([::1]:56522 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lPnQG-0004m4-0c for importer@patchew.org; Fri, 26 Mar 2021 10:26:48 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:55140) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lPnNg-00020F-5n; Fri, 26 Mar 2021 10:24:09 -0400 Received: from mail-wr1-x435.google.com ([2a00:1450:4864:20::435]:41730) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lPnNd-0000h2-VE; Fri, 26 Mar 2021 10:24:07 -0400 Received: by mail-wr1-x435.google.com with SMTP id b9so5808962wrt.8; Fri, 26 Mar 2021 07:24:04 -0700 (PDT) Received: from avogadro.lan ([2001:b07:6468:f312:c8dd:75d4:99ab:290a]) by smtp.gmail.com with ESMTPSA id m5sm13084517wrq.15.2021.03.26.07.24.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 26 Mar 2021 07:24:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=sy7BnXpvFvOYWJ2dLQm2mMqmZUakPZXII5Bsc1E4lrM=; b=F1q+T86IzIroj2ii1m/XfIcIZqgGGlxQzBZQ3CcqG/pN0TNmHksYUAlpQBVlMEGol0 v0ZKKytPAaaOuNTFnUMHvRFuw/nOsHk/Do47jhjt7qSQZ3ntHtaGxeuJyOs8yvP5ahj0 lnDCmK2nIiL7dj/a0VXkphoH6k9PhXngHfdmLe/UYXckllTDBxorPnA7wc9hglEZu9lR tTrH/NEAiA+cTCzIR/okpnMq5aufTiCTgAFvfNsalSDcDFvVZxPauRM98aNEfOT+e7L3 242p5EkkqTlY+qwM4MW/xjlE8sVhak9/B1aUUGiDk1wGP7WwkzqUOTU8pyQX1wNAdKps ld5w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=sy7BnXpvFvOYWJ2dLQm2mMqmZUakPZXII5Bsc1E4lrM=; b=VwX7Y1v5YHjbi36eah8CThSqydGjPZrKUAoYxWI2frgEvUqvwS0XPEKwuj8W1TBxKF HYK8UNv9aLYofppg2qTtmOmIKDg+CbYkBOMbBy/Jk5QiMLAkG+5g4NrCouT3KRmHc+Ha elnVrP4X5tStWFtTOXDjlohpdewoltvCPBBjzjIuP08B5ql5JspcQbdM7r32nRa0lJ9b KBdT9FdPGkBT/pBz6vPM6CrmM17JHFGoo9daTnv4j76RopL/FDGRCKE99GIH1JAzvXBj 26vW0ARSlCr3BktOyWjG5sE0R6in+FQ19pMbrRPul5gHBC+TdBOTo2KR6ilm9wM84NRh 9BYA== X-Gm-Message-State: AOAM532MpnYwDLEV3X7e0MC7Y9SHtEECfxtR+iiMBtyrrGEn6sw8IV0A GtSxex/8L4kB7EvqVKFqLh6oJXzJ7Bw= X-Google-Smtp-Source: ABdhPJxcyd4+oY2eACmwRcPxCqpnlmQjz03KowZ5vRP0C0fAaHPQGqVsXCHGzcgchFFpeiK7P2D9Iw== X-Received: by 2002:adf:dd47:: with SMTP id u7mr14913984wrm.13.1616768643763; Fri, 26 Mar 2021 07:24:03 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PATCH v3 1/5] qemu-iotests: do not buffer the test output Date: Fri, 26 Mar 2021 15:23:55 +0100 Message-Id: <20210326142359.431127-2-pbonzini@redhat.com> X-Mailer: git-send-email 2.30.1 In-Reply-To: <20210326142359.431127-1-pbonzini@redhat.com> References: <20210326142359.431127-1-pbonzini@redhat.com> MIME-Version: 1.0 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=2a00:1450:4864:20::435; envelope-from=paolo.bonzini@gmail.com; helo=mail-wr1-x435.google.com X-Spam_score_int: 5 X-Spam_score: 0.5 X-Spam_bar: / X-Spam_report: (0.5 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.249, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.25, PDS_OTHER_BAD_TLD=1.999, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no 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: eesposit@redhat.com, vsementsov@virtuozzo.com, qemu-block@nongnu.org, mreitz@redhat.com 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" Instead of buffering the test output into a StringIO, patch it on the fly by wrapping sys.stdout's write method. This can be done unconditionally, even if using -d, which makes execute_unittest a bit simpler. Signed-off-by: Paolo Bonzini Reviewed-by: Vladimir Sementsov-Ogievskiy Tested-by: Emanuele Giuseppe Esposito Message-Id: <20210323181928.311862-2-pbonzini@redhat.com> --- tests/qemu-iotests/iotests.py | 70 ++++++++++++++++++++--------------- 1 file changed, 41 insertions(+), 29 deletions(-) diff --git a/tests/qemu-iotests/iotests.py b/tests/qemu-iotests/iotests.py index 5af0182895..ccf3747ede 100644 --- a/tests/qemu-iotests/iotests.py +++ b/tests/qemu-iotests/iotests.py @@ -20,7 +20,6 @@ import bz2 from collections import OrderedDict import faulthandler -import io import json import logging import os @@ -32,7 +31,7 @@ import sys import time from typing import (Any, Callable, Dict, Iterable, - List, Optional, Sequence, Tuple, TypeVar) + List, Optional, Sequence, TextIO, Tuple, Type, TypeVar) import unittest =20 from contextlib import contextmanager @@ -1271,37 +1270,50 @@ def func_wrapper(*args, **kwargs): return func(*args, **kwargs) return func_wrapper =20 +# We need to filter out the time taken from the output so that +# qemu-iotest can reliably diff the results against master output, +# and hide skipped tests from the reference output. + +class ReproducibleTestResult(unittest.TextTestResult): + def addSkip(self, test, reason): + # Same as TextTestResult, but print dot instead of "s" + unittest.TestResult.addSkip(self, test, reason) + if self.showAll: + self.stream.writeln("skipped {0!r}".format(reason)) + elif self.dots: + self.stream.write(".") + self.stream.flush() + +class ReproducibleStreamWrapper: + def __init__(self, stream: TextIO): + self.stream =3D stream + + def __getattr__(self, attr): + if attr in ('stream', '__getstate__'): + raise AttributeError(attr) + return getattr(self.stream, attr) + + def write(self, arg=3DNone): + arg =3D re.sub(r'Ran (\d+) tests? in [\d.]+s', r'Ran \1 tests', ar= g) + arg =3D re.sub(r' \(skipped=3D\d+\)', r'', arg) + self.stream.write(arg) + +class ReproducibleTestRunner(unittest.TextTestRunner): + def __init__(self, stream: Optional[TextIO] =3D None, + resultclass: Type[unittest.TestResult] =3D ReproducibleTestRe= sult, + **kwargs: Any) -> None: + rstream =3D ReproducibleStreamWrapper(stream or sys.stdout) + super().__init__(stream=3Drstream, # type: ignore + descriptions=3DTrue, + resultclass=3Dresultclass, + **kwargs) + def execute_unittest(debug=3DFalse): """Executes unittests within the calling module.""" =20 verbosity =3D 2 if debug else 1 - - if debug: - output =3D sys.stdout - else: - # We need to filter out the time taken from the output so that - # qemu-iotest can reliably diff the results against master output. - output =3D io.StringIO() - - runner =3D unittest.TextTestRunner(stream=3Doutput, descriptions=3DTru= e, - verbosity=3Dverbosity) - try: - # unittest.main() will use sys.exit(); so expect a SystemExit - # exception - unittest.main(testRunner=3Drunner) - finally: - # We need to filter out the time taken from the output so that - # qemu-iotest can reliably diff the results against master output. - if not debug: - out =3D output.getvalue() - out =3D re.sub(r'Ran (\d+) tests? in [\d.]+s', r'Ran \1 tests'= , out) - - # Hide skipped tests from the reference output - out =3D re.sub(r'OK \(skipped=3D\d+\)', 'OK', out) - out_first_line, out_rest =3D out.split('\n', 1) - out =3D out_first_line.replace('s', '.') + '\n' + out_rest - - sys.stderr.write(out) + runner =3D unittest.ReproducibleTestRunner(verbosity=3Dverbosity) + unittest.main(testRunner=3Drunner) =20 def execute_setup_common(supported_fmts: Sequence[str] =3D (), supported_platforms: Sequence[str] =3D (), --=20 2.30.1 From nobody Thu May 2 18:58:07 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 ARC-Seal: i=1; a=rsa-sha256; t=1616768883; cv=none; d=zohomail.com; s=zohoarc; b=F4eZmv2OMB9KNFon0L7wbYwpsQ7AbAkfeI80qsGW9XuBqy90BF1BB/7i7Xpt/88w/IjC4IEzSBDXWL0/MjylKSyHwRGF0ayZsqUiOSkW+aDUKilVNo7Xs93U9nAnCgwLBcu4e/jvM5ff8r4P0yGz/oIbSxN8UFEJ/iAoqV+oTeg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1616768883; h=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=gvbSNeIZd5IJGTxW7zM4dCB0Uzkztx8q2xU47Lg0Gzs=; b=fHyQgwSvn60dUGVFHF4tfTin/ri6Yl3YKH71NX5c0AoiKzi5yJ9QGwO+a7RrlliNzGTUYcyw1RDhnH3ZVOVzEj6SA+NRm9bNpGNGKHTsKl3e3RkqB8PhxF47OyJ7W+TfIkA0uwKMbsr8mGGSOE9jqZyGiShRXSb/kWR9UF98CS4= 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 1616768883945799.8065883882907; Fri, 26 Mar 2021 07:28:03 -0700 (PDT) Received: from localhost ([::1]:33078 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lPnRS-0006hG-S5 for importer@patchew.org; Fri, 26 Mar 2021 10:28:02 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:55146) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lPnNg-00021P-Hw; Fri, 26 Mar 2021 10:24:09 -0400 Received: from mail-wr1-x42d.google.com ([2a00:1450:4864:20::42d]:40626) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lPnNe-0000hP-3z; Fri, 26 Mar 2021 10:24:08 -0400 Received: by mail-wr1-x42d.google.com with SMTP id v11so5810992wro.7; Fri, 26 Mar 2021 07:24:05 -0700 (PDT) Received: from avogadro.lan ([2001:b07:6468:f312:c8dd:75d4:99ab:290a]) by smtp.gmail.com with ESMTPSA id m5sm13084517wrq.15.2021.03.26.07.24.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 26 Mar 2021 07:24:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=gvbSNeIZd5IJGTxW7zM4dCB0Uzkztx8q2xU47Lg0Gzs=; b=ipEq7m9RubysDGvjerYNh8NP3XcFk9c1r+gG0AZcnfZXb1snf6I68ARJlxWcV7bVQS krmgFXEq3A3gXyEQgmiY0I1WBwparweyO1qNshxV2N+LQ2Sn4nS0CSNm0N4yKQKLGHGW RPZ4uUX/zd2wInUBlQZLSIy+AvbM27TmfZSaGJWCnQpcMotUzdGBtP2o5SvTFrVUyz3m 3yDL9qVoEiJj1fW411oSmdN9Q3zoY3AyzRMP8kRm2cviF1dG77aj9JC/yocuhZ2kCAC+ yhE6eal5x/7WVKMl53UPcr8D5PWftOxmYAfo2qRvLiCyoDG0hbWJqjfNDtk5wB5kqqU6 6XRQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=gvbSNeIZd5IJGTxW7zM4dCB0Uzkztx8q2xU47Lg0Gzs=; b=gEUCYaI4bsp/EUazB+Dto1Bx6bbOB/WCYmhduN/dFY/p7nwUbXPxx9JkoEXLrfoLj5 zFPzRGV/LCCbAE4w4OstmuKQEuY1yfDexIKrl8n9VbIq/Rr9Nejsp+6gaJbW3oczCIpf VW23WCVaAYPs0mmL/P2LCWXXntX71X1EEotscdIqYaluPqgkfkGW7QX/5hrqmocWGG13 yvl/m5ghq7UMhcdFfez3yCmWTmgA62S6dLa+acl1BX5N3m3D1XNS4+2UJWpvbT8hXF9h wHrDfb6Tj8G6pXwTtKEgbC7cmfaL6yl+k4T7kqkUVDgDSAAG+IEaTNAvOHJlakGbFRnB RXyQ== X-Gm-Message-State: AOAM532Z9DHQJhy+NDG6pqDsyqj4TXZKG5wUq8WlLJY6ykLVNxseLuhD qdTwwq9hHw9NAyBYuxkfNbrNB5Zc34o= X-Google-Smtp-Source: ABdhPJwAqm2LKQjyYweiU3Yf8pG2BCmsOemyV8sd2HXU/q0OYPkG+4bm6AlJbNkQVbzGE/kUPADwKw== X-Received: by 2002:a5d:6404:: with SMTP id z4mr15202101wru.109.1616768644523; Fri, 26 Mar 2021 07:24:04 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PATCH v3 2/5] qemu-iotests: allow passing unittest.main arguments to the test scripts Date: Fri, 26 Mar 2021 15:23:56 +0100 Message-Id: <20210326142359.431127-3-pbonzini@redhat.com> X-Mailer: git-send-email 2.30.1 In-Reply-To: <20210326142359.431127-1-pbonzini@redhat.com> References: <20210326142359.431127-1-pbonzini@redhat.com> MIME-Version: 1.0 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=2a00:1450:4864:20::42d; envelope-from=paolo.bonzini@gmail.com; helo=mail-wr1-x42d.google.com X-Spam_score_int: -14 X-Spam_score: -1.5 X-Spam_bar: - X-Spam_report: (-1.5 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.249, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.25, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no 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: eesposit@redhat.com, vsementsov@virtuozzo.com, qemu-block@nongnu.org, mreitz@redhat.com 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" Python test scripts that use unittest consist of multiple tests. unittest.main allows selecting which tests to run, but currently this is not possible because the iotests wrapper ignores sys.argv. unittest.main command line options also allow the user to pick the desired options for verbosity, failfast mode, etc. While "-d" is currently translated to "-v", it also enables extra debug output, and other options are not available at all. These command line options only work if the unittest.main testRunner argument is a type, rather than a TestRunner instance. Therefore, pass the class name and "verbosity" argument to unittest.main, and adjust for the different default warnings between TextTestRunner and unittest.main. Signed-off-by: Paolo Bonzini Reviewed-by: Vladimir Sementsov-Ogievskiy Tested-by: Emanuele Giuseppe Esposito Message-Id: <20210323181928.311862-3-pbonzini@redhat.com> --- tests/qemu-iotests/iotests.py | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/tests/qemu-iotests/iotests.py b/tests/qemu-iotests/iotests.py index ccf3747ede..5ead94229f 100644 --- a/tests/qemu-iotests/iotests.py +++ b/tests/qemu-iotests/iotests.py @@ -1308,12 +1308,16 @@ def __init__(self, stream: Optional[TextIO] =3D Non= e, resultclass=3Dresultclass, **kwargs) =20 -def execute_unittest(debug=3DFalse): +def execute_unittest(argv: List[str], debug: bool =3D False) -> None: """Executes unittests within the calling module.""" =20 - verbosity =3D 2 if debug else 1 - runner =3D unittest.ReproducibleTestRunner(verbosity=3Dverbosity) - unittest.main(testRunner=3Drunner) + # Some tests have warnings, especially ResourceWarnings for unclosed + # files and sockets. Ignore them for now to ensure reproducibility of + # the test output. + unittest.main(argv=3Dargv, + testRunner=3DReproducibleTestRunner, + verbosity=3D2 if debug else 1, + warnings=3DNone if sys.warnoptions else 'ignore') =20 def execute_setup_common(supported_fmts: Sequence[str] =3D (), supported_platforms: Sequence[str] =3D (), @@ -1350,7 +1354,7 @@ def execute_test(*args, test_function=3DNone, **kwarg= s): =20 debug =3D execute_setup_common(*args, **kwargs) if not test_function: - execute_unittest(debug) + execute_unittest(sys.argv, debug) else: test_function() =20 --=20 2.30.1 From nobody Thu May 2 18:58:07 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 ARC-Seal: i=1; a=rsa-sha256; t=1616768830; cv=none; d=zohomail.com; s=zohoarc; b=KuQagsioOgSJG7Ns1pSBrD9ldCoccm9jr1PGGO2LSt0S1ZoA/2t5yvJosxQ4+DwscuUFNen10vNOy+ryMeizdshiE4QRJSUvf1ObSdM6gHljhyVavgSPTJPMK+EQ+NZOzdSfbQaYMKHb8hIKMk2HHZakpA7g0cMTdl/B/6h34rc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1616768830; h=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=jsUgwlZXJuyBPDp8GpUlu0IW/hCCv8e/Mr49HtzzOyc=; b=B3dKgZztGDiapnk23u77XLKFbXPNc6T+B9DKOLUbAfzuIcJ7OrGVgtBQzbUr363f7UtopM5XhLhHVaUCUg8aCrldFy9ubjj7vkwryyV/eeQmYC2X1OA+Ci56kWWHhSNYLvZz9pC4g0+K9q6Mt/TacCATwiYKqRaxo3BB+MamQQg= 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 1616768830223950.9879660759761; Fri, 26 Mar 2021 07:27:10 -0700 (PDT) Received: from localhost ([::1]:58250 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lPnQb-0005SN-5c for importer@patchew.org; Fri, 26 Mar 2021 10:27:09 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:55174) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lPnNh-00021s-Ul; Fri, 26 Mar 2021 10:24:13 -0400 Received: from mail-wr1-x42f.google.com ([2a00:1450:4864:20::42f]:43843) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lPnNf-0000iQ-41; Fri, 26 Mar 2021 10:24:09 -0400 Received: by mail-wr1-x42f.google.com with SMTP id x7so5806204wrw.10; Fri, 26 Mar 2021 07:24:06 -0700 (PDT) Received: from avogadro.lan ([2001:b07:6468:f312:c8dd:75d4:99ab:290a]) by smtp.gmail.com with ESMTPSA id m5sm13084517wrq.15.2021.03.26.07.24.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 26 Mar 2021 07:24:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=jsUgwlZXJuyBPDp8GpUlu0IW/hCCv8e/Mr49HtzzOyc=; b=p+YHTywunEDyOqqHA6xH2dpX2doAM+oIaGVjBYpX9eIDPxaPvyY6qYIZB5+WFzvQ0v NiWiBjslBS8PHkCX7zhrPho+dt2JjGlHkm9FlmD9Lf3V4AS5lbbUWxIRIK3yagj6kBOl z4gy4TScrq1Cj7ThPlCjbZUjEABf0oLf5m+Ko/Zxo9YG2ARHhh2P/x1MjPIO5GvoTB9d xW9AITQmul1jsicgJYFH3Gj1Nphbh6Q1KS1V6KdJ9gLpGia6qnRDuU9+HJCfZF6HDYnm IhIIqm1Cjw46Gsmkgk8Na74lCkdQG4MmTujua44+6zkOlUnBID3eGxg5MHFYCsGtzvXX ld2Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=jsUgwlZXJuyBPDp8GpUlu0IW/hCCv8e/Mr49HtzzOyc=; b=kUUCOgUT9/9l+NN6/rwM4G1ZSWRxkUR9+Pw9NWwEn5DvLuMc+qhqW5uCAZtdOWFXe+ fbSMHp6DTT6cFdfVz5mfmrFTNbWL2t6CS9/tVg+THJ1jAkBKmpHtUEBBsh+qX25I2DOW jCVkJtfxD0aOU4mkyP5YpWfLUTW2ygFe5Nd0KEAhxGcrcTv4N6bVn0JkkS2BLiNdgtlU M+hug5nIs1TcV/8Ia507GKFcRIHqDJngCInmdcGPMgIdBn2bPHkiFZTZov0pxkuy08tw HufIySJ8+xPGNxlvTRbsJpVFH+xb0nqXoBufzETZGThoK9Z2Caxyg9az5asb2jM7Vf/v lFUA== X-Gm-Message-State: AOAM532wJaZ59chZa3iIjr+/CrjLs/RfCIU9YsWJVHw67Zp1RFEuC+TB PtgsQuN3H/dai7ljuO9/95+Ui+DCTwY= X-Google-Smtp-Source: ABdhPJx0RSik8IEFDuCyZuXir/8IaBI+VaNRJPDKusuE/ABHphiZaU0/ZUBy+RmOfEP8hJlzTs22yQ== X-Received: by 2002:a5d:4bce:: with SMTP id l14mr14926057wrt.99.1616768645354; Fri, 26 Mar 2021 07:24:05 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PATCH v3 3/5] qemu-iotests: move command line and environment handling from TestRunner to TestEnv Date: Fri, 26 Mar 2021 15:23:57 +0100 Message-Id: <20210326142359.431127-4-pbonzini@redhat.com> X-Mailer: git-send-email 2.30.1 In-Reply-To: <20210326142359.431127-1-pbonzini@redhat.com> References: <20210326142359.431127-1-pbonzini@redhat.com> MIME-Version: 1.0 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=2a00:1450:4864:20::42f; envelope-from=paolo.bonzini@gmail.com; helo=mail-wr1-x42f.google.com X-Spam_score_int: -14 X-Spam_score: -1.5 X-Spam_bar: - X-Spam_report: (-1.5 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.249, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.25, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no 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: eesposit@redhat.com, vsementsov@virtuozzo.com, qemu-block@nongnu.org, mreitz@redhat.com 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" In the next patch, "check" will learn how to execute a test script without going through TestRunner. To enable this, keep only the text output and subprocess handling in the TestRunner; move into TestEnv the logic to prepare for running a subprocess. Reviewed-by: Vladimir Sementsov-Ogievskiy Signed-off-by: Paolo Bonzini Tested-by: Emanuele Giuseppe Esposito Message-Id: <20210323181928.311862-4-pbonzini@redhat.com> --- tests/qemu-iotests/testenv.py | 17 ++++++++++++++++- tests/qemu-iotests/testrunner.py | 14 +------------- 2 files changed, 17 insertions(+), 14 deletions(-) diff --git a/tests/qemu-iotests/testenv.py b/tests/qemu-iotests/testenv.py index 6d27712617..fca3a609e0 100644 --- a/tests/qemu-iotests/testenv.py +++ b/tests/qemu-iotests/testenv.py @@ -25,7 +25,7 @@ import random import subprocess import glob -from typing import Dict, Any, Optional, ContextManager +from typing import List, Dict, Any, Optional, ContextManager =20 =20 def isxfile(path: str) -> bool: @@ -74,6 +74,21 @@ class TestEnv(ContextManager['TestEnv']): 'CACHEMODE_IS_DEFAULT', 'IMGFMT_GENERIC', 'IMGOPTSSYN= TAX', 'IMGKEYSECRET', 'QEMU_DEFAULT_MACHINE', 'MALLOC_PERTU= RB_'] =20 + def prepare_subprocess(self, args: List[str]) -> Dict[str, str]: + if self.debug: + args.append('-d') + + with open(args[0], encoding=3D"utf-8") as f: + try: + if f.readline().rstrip() =3D=3D '#!/usr/bin/env python3': + args.insert(0, self.python) + except UnicodeDecodeError: # binary test? for future. + pass + + os_env =3D os.environ.copy() + os_env.update(self.get_env()) + return os_env + def get_env(self) -> Dict[str, str]: env =3D {} for v in self.env_variables: diff --git a/tests/qemu-iotests/testrunner.py b/tests/qemu-iotests/testrunn= er.py index 1fc61fcaa3..519924dc81 100644 --- a/tests/qemu-iotests/testrunner.py +++ b/tests/qemu-iotests/testrunner.py @@ -129,7 +129,6 @@ class TestRunner(ContextManager['TestRunner']): def __init__(self, env: TestEnv, makecheck: bool =3D False, color: str =3D 'auto') -> None: self.env =3D env - self.test_run_env =3D self.env.get_env() self.makecheck =3D makecheck self.last_elapsed =3D LastElapsedTime('.last-elapsed-cache', env) =20 @@ -243,18 +242,7 @@ def do_run_test(self, test: str) -> TestResult: silent_unlink(p) =20 args =3D [str(f_test.resolve())] - if self.env.debug: - args.append('-d') - - with f_test.open(encoding=3D"utf-8") as f: - try: - if f.readline().rstrip() =3D=3D '#!/usr/bin/env python3': - args.insert(0, self.env.python) - except UnicodeDecodeError: # binary test? for future. - pass - - env =3D os.environ.copy() - env.update(self.test_run_env) + env =3D self.env.prepare_subprocess(args) =20 t0 =3D time.time() with f_bad.open('w', encoding=3D"utf-8") as f: --=20 2.30.1 From nobody Thu May 2 18:58:07 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 ARC-Seal: i=1; a=rsa-sha256; t=1616768915; cv=none; d=zohomail.com; s=zohoarc; b=jCDOPgTkUFBvQUMuotRUNXLqgNSiTPc4cOTb1yWmN8oVk63irs687nZrdXoGwrMUcUJXWzVuxqApwajen/8IyZwN7YYl2fZd144uCU3GKBCm3PuAl/S2tCORc5hT/RQqrEmBpUstIKtCZNBoWg9EoZb3sLAxB/4UaeKQGQz/In4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1616768915; h=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=ry8amss7iWhBMOaCfIPTZByXJU/zbqjNZn+N1JV98jo=; b=N9MF0dybMi1vGSGnapfx/ZJBqwGT0BmCSVnTXV+ML0KSgYyzHoDV+4uVfukrTFxxKte5BGEDKzpppJELKRz6ckkmtPybzat7HA01UOrMGYk9JUJdtM49Ph/5levDb5osYTF1IoQaMovGUBwKrUACn5c2UqFG+7P0qCKdjpvyMB0= 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 1616768915860788.5551194429796; Fri, 26 Mar 2021 07:28:35 -0700 (PDT) Received: from localhost ([::1]:35758 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lPnRy-0007nl-RJ for importer@patchew.org; Fri, 26 Mar 2021 10:28:34 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:55172) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lPnNh-00021r-UE; Fri, 26 Mar 2021 10:24:13 -0400 Received: from mail-wr1-x432.google.com ([2a00:1450:4864:20::432]:34626) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lPnNg-0000jA-8K; Fri, 26 Mar 2021 10:24:09 -0400 Received: by mail-wr1-x432.google.com with SMTP id j7so5859892wrd.1; Fri, 26 Mar 2021 07:24:07 -0700 (PDT) Received: from avogadro.lan ([2001:b07:6468:f312:c8dd:75d4:99ab:290a]) by smtp.gmail.com with ESMTPSA id m5sm13084517wrq.15.2021.03.26.07.24.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 26 Mar 2021 07:24:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=ry8amss7iWhBMOaCfIPTZByXJU/zbqjNZn+N1JV98jo=; b=BOU5v7g1E6zvtC3UKKCQGzr7j9MFfIc+5jjn6bgf4V9be9PbrMXRBPr9g89e/R4pjV Hjvlcm+sOYMN/3nK2Sb4wWFUN0DBtDmAmgO/TfvAN9FA7JJyRAz8Sb9IiYoqsgAqfB+x htFIHjQJdVFqt3WiqGXfUxy1snX0Cpb3KkRrXYGenHama54Y9H1jfMPfy5cF2KEWSW0v nF7mGULAns7Wh52f3pKbFI16ADqxCgkeatZh0CFWA24uyrxFMKNsTVqVTcqVoSlN6iPn utNgNnmiDaoA2L1tcTXsROfiFrV8odogZTdpwAdddYqBucpZxFYQfxCoenUFO8l9w/41 BbFw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=ry8amss7iWhBMOaCfIPTZByXJU/zbqjNZn+N1JV98jo=; b=tgJl4cmfOz0CORDByAbNlFG30sSznBMVdBy27SG2zDD4B3bdCb0onqjN7VVEt//4cE 9IBE940vSzvpb/cdsB9+yETenxHGLfxDXE59fnknKdS15fn8F6aBsoeKcPlJNG7Bb0TB rLXgWO2StSpJ99XopavC3AGQvrHVOMxwr5TaLB92mvLRsTUsyAFzGSgyK4pk+MME+4tR ixJoE4LSiAz4s9OVY9uOGD5VrQSKBuItP6HOskBBUJW8PcrtfJ8W1SRynoZXKZViSi5t MUhm4dD3gEO+ZAFUj6jIl6re5RiXbKZUTxLq66aDnfVvu2RhIwmlCCVBbtJKntU4hudK 297g== X-Gm-Message-State: AOAM530m8bQGBdh+Pu1CB+jd/JzqOaO3dg3SDnRQva+IgFbJiPsL+WkC E2tbTu1njk0+6Z6pzsalo7mOmzkRqfk= X-Google-Smtp-Source: ABdhPJyCxjMgTzW8uI+d7CHMmOlvwQKbro5VPbDHPMc2sfNcBn3wzqdfvHeUfvhBLVfjvLYLT8zNOA== X-Received: by 2002:a5d:4b43:: with SMTP id w3mr6635977wrs.406.1616768646228; Fri, 26 Mar 2021 07:24:06 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PATCH v3 4/5] qemu-iotests: let "check" spawn an arbitrary test command Date: Fri, 26 Mar 2021 15:23:58 +0100 Message-Id: <20210326142359.431127-5-pbonzini@redhat.com> X-Mailer: git-send-email 2.30.1 In-Reply-To: <20210326142359.431127-1-pbonzini@redhat.com> References: <20210326142359.431127-1-pbonzini@redhat.com> MIME-Version: 1.0 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=2a00:1450:4864:20::432; envelope-from=paolo.bonzini@gmail.com; helo=mail-wr1-x432.google.com X-Spam_score_int: -14 X-Spam_score: -1.5 X-Spam_bar: - X-Spam_report: (-1.5 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.249, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.25, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no 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: eesposit@redhat.com, vsementsov@virtuozzo.com, qemu-block@nongnu.org, mreitz@redhat.com 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" Right now there is no easy way for "check" to print a reproducer command. Because such a reproducer command line would be huge, we can instead teach check to start a command of our choice. This can be for example a Python unit test with arguments to only run a specific subtest. Move the trailing empty line to print_env(), since it always looks better and one caller was not adding it. Signed-off-by: Paolo Bonzini Reviewed-by: Vladimir Sementsov-Ogievskiy Tested-by: Emanuele Giuseppe Esposito Message-Id: <20210323181928.311862-5-pbonzini@redhat.com> --- tests/qemu-iotests/check | 18 +++++++++++++++++- tests/qemu-iotests/testenv.py | 3 ++- tests/qemu-iotests/testrunner.py | 1 - 3 files changed, 19 insertions(+), 3 deletions(-) diff --git a/tests/qemu-iotests/check b/tests/qemu-iotests/check index d1c87ceaf1..df9fd733ff 100755 --- a/tests/qemu-iotests/check +++ b/tests/qemu-iotests/check @@ -19,6 +19,9 @@ import os import sys import argparse +import shutil +from pathlib import Path + from findtests import TestFinder from testenv import TestEnv from testrunner import TestRunner @@ -101,7 +104,7 @@ def make_argparser() -> argparse.ArgumentParser: 'rerun failed ./check command, starting from the ' 'middle of the process.') g_sel.add_argument('tests', metavar=3D'TEST_FILES', nargs=3D'*', - help=3D'tests to run') + help=3D'tests to run, or "--" followed by a command= ') =20 return p =20 @@ -114,6 +117,19 @@ if __name__ =3D=3D '__main__': imgopts=3Dargs.imgopts, misalign=3Dargs.misalign, debug=3Dargs.debug, valgrind=3Dargs.valgrind) =20 + if len(sys.argv) > 1 and sys.argv[-len(args.tests)-1] =3D=3D '--': + if not args.tests: + sys.exit("missing command after '--'") + cmd =3D args.tests + env.print_env() + exec_path =3D Path(shutil.which(cmd[0])) + if exec_path is None: + sys.exit('command not found: ' + cmd[0]) + cmd[0] =3D exec_path.resolve() + full_env =3D env.prepare_subprocess(cmd) + os.chdir(Path(exec_path).parent) + os.execve(cmd[0], cmd, full_env) + testfinder =3D TestFinder(test_dir=3Denv.source_iotests) =20 groups =3D args.groups.split(',') if args.groups else None diff --git a/tests/qemu-iotests/testenv.py b/tests/qemu-iotests/testenv.py index fca3a609e0..cd0e39b789 100644 --- a/tests/qemu-iotests/testenv.py +++ b/tests/qemu-iotests/testenv.py @@ -284,7 +284,8 @@ def print_env(self) -> None: PLATFORM -- {platform} TEST_DIR -- {TEST_DIR} SOCK_DIR -- {SOCK_DIR} -SOCKET_SCM_HELPER -- {SOCKET_SCM_HELPER}""" +SOCKET_SCM_HELPER -- {SOCKET_SCM_HELPER} +""" =20 args =3D collections.defaultdict(str, self.get_env()) =20 diff --git a/tests/qemu-iotests/testrunner.py b/tests/qemu-iotests/testrunn= er.py index 519924dc81..2f56ac545d 100644 --- a/tests/qemu-iotests/testrunner.py +++ b/tests/qemu-iotests/testrunner.py @@ -316,7 +316,6 @@ def run_tests(self, tests: List[str]) -> bool: =20 if not self.makecheck: self.env.print_env() - print() =20 test_field_width =3D max(len(os.path.basename(t)) for t in tests) = + 2 =20 --=20 2.30.1 From nobody Thu May 2 18:58:07 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 ARC-Seal: i=1; a=rsa-sha256; t=1616769013; cv=none; d=zohomail.com; s=zohoarc; b=RaGSk2DevdBKdYOCbCrZaIL//SwygNOC/0Cy/zvpGpI843vq/ZC9kadM9YmOFYrXrEBDS3M+1fZ2s21G07YjCggtOI0xhM6AauRegWljwBJHXSaMZsTMCiciBDHR31lkQwTzgUqhEW7yCkv/5CkC+2uh6bqy7/G93CiaRto9JEQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1616769013; h=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=zDikArT0wZanXm76Q8OQWC249jp12J87tlgt7b4t7y0=; b=Bwr+WyEytr9ZZhv4b9jznqnDLM9iRqaQzwy4Cz/nyIH5NsK9tO1JrATsBZNc18ByC4oWuez4wtP1FwY5S8jJ/KXzi5jp0vNrdYJcYfyxc0nrYM5zzsai1fDZMmBJTbBmd1RR7mceloiusS3swB3LiadiGTvv/4Opm83Dlcf27wM= 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 1616769013206409.7409472558703; Fri, 26 Mar 2021 07:30:13 -0700 (PDT) Received: from localhost ([::1]:40234 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lPnTY-0001AW-35 for importer@patchew.org; Fri, 26 Mar 2021 10:30:12 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:55176) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lPnNj-00021x-MI; Fri, 26 Mar 2021 10:24:13 -0400 Received: from mail-wr1-x42b.google.com ([2a00:1450:4864:20::42b]:36733) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lPnNg-0000jN-JM; Fri, 26 Mar 2021 10:24:09 -0400 Received: by mail-wr1-x42b.google.com with SMTP id k8so5847036wrc.3; Fri, 26 Mar 2021 07:24:07 -0700 (PDT) Received: from avogadro.lan ([2001:b07:6468:f312:c8dd:75d4:99ab:290a]) by smtp.gmail.com with ESMTPSA id m5sm13084517wrq.15.2021.03.26.07.24.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 26 Mar 2021 07:24:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=zDikArT0wZanXm76Q8OQWC249jp12J87tlgt7b4t7y0=; b=bB+jwPaIPSy2Xkklr+fBWqOfFcKZAOndJO2SlV6JcKYuRh4phTLxKPWGXqAvWddGON TlQMQd34zXUvAxtFmgeeZrmloRKN3vznvnaLCReSlJ5i2L9kQSovLfXETjgmfxVchaKa sK4JGPHy/coNCU5wZXGb53FzD5o0nRxhcVT71027y3mihjZzF377Z6WO9lYspPOSYytx 8rAqj6KMl4M5wFwZH6xkDU/8DLcREYEc8TJg9a0H+IIj736A3mm6aSqRKEOp1UmMLFn1 uXyMGCutiUj7B0j1lLHWARkHKA/mn4O/PvA+9C1sjNT3a2/bOCmuQgeadDOo4QWHR8dF TNRg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=zDikArT0wZanXm76Q8OQWC249jp12J87tlgt7b4t7y0=; b=PlZhEKqfdLHrUsbBspoWRpEq1C8sOVMAJfnnWL7NlZliB5hKAG+trICJWydW8oGDbf x7PmoRX0FWLH9K/aq3zghaAmw0+zRv4TU/cZP94BMZmkoWEU49bgrV7Hxymw78z0INpA s/4ryNRxtBapFhJfpfqdfz7NpF8F+Hmr+qn/JctmwuCoXyOER4tgZuqPAtuXQe6fq7Nn 590F/y8lN0U8yJUOOmtR91e+WX7SZf5dhleo5/2MKlp4bVTwMRoj/kbgcsBTKQZ+WeRy wzh4x6EuxKoUfonZ359oZ4ujLhO16XcoAYXOM6n8pRqAXlJ05jvXceMFQr+aDF9YpbDR jvPw== X-Gm-Message-State: AOAM531lBzlRGPVcX7XM3JvUubkRmF0X1Mx+Dk040J+PPg+5Ywu+2Ra4 X943j29WLTLOxSr08jXz2/lfsAChs5w= X-Google-Smtp-Source: ABdhPJx5ueBh2P/+2YcvBHoD3wmyXdcdkWN0RyXJFw7FW0Tny411jWUMQkmCwKT/l/cEGEXy4Nngqw== X-Received: by 2002:a5d:534e:: with SMTP id t14mr14518537wrv.202.1616768646957; Fri, 26 Mar 2021 07:24:06 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PATCH v3 5/5] qemu-iotests: fix case of SOCK_DIR already in the environment Date: Fri, 26 Mar 2021 15:23:59 +0100 Message-Id: <20210326142359.431127-6-pbonzini@redhat.com> X-Mailer: git-send-email 2.30.1 In-Reply-To: <20210326142359.431127-1-pbonzini@redhat.com> References: <20210326142359.431127-1-pbonzini@redhat.com> MIME-Version: 1.0 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=2a00:1450:4864:20::42b; envelope-from=paolo.bonzini@gmail.com; helo=mail-wr1-x42b.google.com X-Spam_score_int: -14 X-Spam_score: -1.5 X-Spam_bar: - X-Spam_report: (-1.5 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.249, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.25, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no 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: eesposit@redhat.com, vsementsov@virtuozzo.com, qemu-block@nongnu.org, mreitz@redhat.com 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" Due to a typo, in this case the SOCK_DIR was not being created. Reviewed-by: Vladimir Sementsov-Ogievskiy Signed-off-by: Paolo Bonzini Tested-by: Emanuele Giuseppe Esposito Message-Id: <20210323181928.311862-6-pbonzini@redhat.com> --- tests/qemu-iotests/testenv.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/qemu-iotests/testenv.py b/tests/qemu-iotests/testenv.py index cd0e39b789..0c3fe75636 100644 --- a/tests/qemu-iotests/testenv.py +++ b/tests/qemu-iotests/testenv.py @@ -120,7 +120,7 @@ def init_directories(self) -> None: try: self.sock_dir =3D os.environ['SOCK_DIR'] self.tmp_sock_dir =3D False - Path(self.test_dir).mkdir(parents=3DTrue, exist_ok=3DTrue) + Path(self.sock_dir).mkdir(parents=3DTrue, exist_ok=3DTrue) except KeyError: self.sock_dir =3D tempfile.mkdtemp() self.tmp_sock_dir =3D True --=20 2.30.1