From nobody Sat May 18 11:46:48 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=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1598656990; cv=none; d=zohomail.com; s=zohoarc; b=lDopYzjqRuthoULlxTlgHn77b5om8p8KW17QMcgQfpn4rBLpFB9OzVZ6djuzXXrTimU6ouI5BXtlg4gK7eL/+4TdHw11XzutlPXapZCO2JlTaPUYPoaiVJHW3yCvEiGSy34OIeobLyZrFUgvffAmZbllXh9J1mIkRlUlAj8RoKw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1598656990; 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=LGDBKWC08oc7KjFCWYV40h60UwUROAE9zpPW6K9PPWM=; b=SJPHFUq3Hxx3uGSXRzyioWZOcuho7o10yFeCFHgh/3JZkKpPRcX8c3J1o334jMLEjlKF5ry4Wc4+G549ADzowUCmvImX0On7zPmbyvZKbQayEl+ENOnnZdEwbrEaOiTq3SydxdsyG4eSjJmZ5WGU66/jwplETVLS47LhmKookmA= 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 1598656990510803.9942361641109; Fri, 28 Aug 2020 16:23:10 -0700 (PDT) Received: from localhost ([::1]:60276 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kBni9-0002ow-Ji for importer@patchew.org; Fri, 28 Aug 2020 19:23:09 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:54758) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kBnh3-0001cV-ME; Fri, 28 Aug 2020 19:22:01 -0400 Received: from mail-ej1-x644.google.com ([2a00:1450:4864:20::644]:32962) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kBnh2-0006JM-6Y; Fri, 28 Aug 2020 19:22:01 -0400 Received: by mail-ej1-x644.google.com with SMTP id a21so1271947ejp.0; Fri, 28 Aug 2020 16:21:59 -0700 (PDT) Received: from localhost.localdomain (109-186-204-55.bb.netvision.net.il. [109.186.204.55]) by smtp.gmail.com with ESMTPSA id j21sm523436eja.109.2020.08.28.16.21.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 28 Aug 2020 16:21:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=LGDBKWC08oc7KjFCWYV40h60UwUROAE9zpPW6K9PPWM=; b=sThXLve0gHWuAnVPWSG9o+PuBba9m7C7kbw0hc+O37Br/z4GEqv4XgGInAm+SZ64uS HorBCg01u141eTxI7ij24wGUXHlgWqwetp67udBSUYpL630Ea0rPvvKkjDtAOUAEK9u7 r+Ms293bv3PfpZPT9db42vtdYcbJjCrhajWMty4nuBBhBY263JptzgpHkhV7UITAWjBF u3+e6ohUPIP5RQQ9Mw2iMigq75hP0ROIsvQMMH8GAMpSuOuzXqnzw/esj4/PArhepOEz h0rkgbfy2B06YaEHApxjQFIu8VEN96KHyG7vpONw1czPJ56oCD0I2lW0mtuAIq531hEG Jzzg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=LGDBKWC08oc7KjFCWYV40h60UwUROAE9zpPW6K9PPWM=; b=HFY9JvpCKAU4UnVOlxs9M8NGAtKK0gkBbGxR8l2N4UC4avyHZKrBI9jsvvuJqgze0f ha/Q8RyY/G0X/lS+Ns4wYXg53lt8SkMgxoKHhunhYgjt27eIx2Y2FrP0QMMmoyxxrMSw 3WDKUk4Llbfeq9rcEEBrlMuPqFRxx3VkE+5hsKKeF4PBFetyB31xTx+Id4tbSz+5YY3J YZABY/fv7ejzIkChrJwXdlUjO5Uj7hAwwdUJQD/heWMhW1CN1EXM4R4QXw946nOa9D+m hO5BZ9KR8Us/VjBvr1r5kcetSlkKXd2XzKCBZITyTA1EMYyRkN9nsD7sZJowNA4aZcTV WZfw== X-Gm-Message-State: AOAM533us+9K2fh+Ch8K9BQkXr2rM3uKvSROIWcUiso7H5yaev2DTBBA 7eRNIWumvBiVFjpJ4qucdb2Cl9tyKfdhYTn0 X-Google-Smtp-Source: ABdhPJyYqngonIu/Ibcvlj8WIIPNDeky7d+0btmqqDjd0bENZciN3E9Mkvw2AW5FZ905YklBMf2qnQ== X-Received: by 2002:a17:906:bb0e:: with SMTP id jz14mr1118079ejb.525.1598656918180; Fri, 28 Aug 2020 16:21:58 -0700 (PDT) From: Nir Soffer X-Google-Original-From: Nir Soffer To: qemu-devel@nongnu.org Subject: [PATCH v3 1/5] qemu-iotests: Fix FilePaths cleanup Date: Sat, 29 Aug 2020 02:21:48 +0300 Message-Id: <20200828232152.205833-2-nsoffer@redhat.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200828232152.205833-1-nsoffer@redhat.com> References: <20200828232152.205833-1-nsoffer@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::644; envelope-from=nirsof@gmail.com; helo=mail-ej1-x644.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, 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 , qemu-block@nongnu.org, John Snow , Max Reitz , Nir Soffer 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" If os.remove() fails to remove one of the paths, for example if the file was removed by the test, the cleanup loop would exit silently, without removing the rest of the files. Fixes: de263986b5dc Signed-off-by: Nir Soffer Reviewed-by: Max Reitz --- tests/qemu-iotests/iotests.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/qemu-iotests/iotests.py b/tests/qemu-iotests/iotests.py index e197c73ca5..2fd5c916fa 100644 --- a/tests/qemu-iotests/iotests.py +++ b/tests/qemu-iotests/iotests.py @@ -468,11 +468,11 @@ class FilePaths: return self.paths =20 def __exit__(self, exc_type, exc_val, exc_tb): - try: - for path in self.paths: + for path in self.paths: + try: os.remove(path) - except OSError: - pass + except OSError: + pass return False =20 class FilePath(FilePaths): --=20 2.26.2 From nobody Sat May 18 11:46:48 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=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1598657049; cv=none; d=zohomail.com; s=zohoarc; b=BgnHFqikfAwP4hnoZNq4RCOzPiLS44lEKnEOIpGMYwvDSQVQGpc2t/1mwB5QAiVLzbxNzDuoj8EdoRFtTB58XbSOht9l4X3cUfVQ3PKgk8ZG+6QSBuq84bJ7vtO4fqmB14WkgcASwZ/P9CQtaU9TAPUl+wo9HWIwAddC0G+AYqI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1598657049; 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=CUWOPdxbZMjjlgVu2jD4P/2CDhJJfs5x+yzzwsdv4cs=; b=MktbiSoQx7I/YPnoEpDvrVa5nSJAVPzcBLPGVu1wVN9o4pmxJE+v1jEDC9E4iOzntExC2vZvAMFF602W0GRy67Re1q6fMQ8Cba3O35sf0QjFWDVbZmTGvyal6eLFtITpJQ4sQLjdIkW4TeIYiKpXxElaqmE9fZnnyfrafF2U/Nw= 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 1598657049101904.291918606042; Fri, 28 Aug 2020 16:24:09 -0700 (PDT) Received: from localhost ([::1]:35386 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kBnj6-0004DO-Bx for importer@patchew.org; Fri, 28 Aug 2020 19:24:08 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:54770) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kBnh5-0001eV-F8; Fri, 28 Aug 2020 19:22:03 -0400 Received: from mail-ej1-x644.google.com ([2a00:1450:4864:20::644]:44584) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kBnh3-0006Jb-Ro; Fri, 28 Aug 2020 19:22:03 -0400 Received: by mail-ej1-x644.google.com with SMTP id bo3so1187560ejb.11; Fri, 28 Aug 2020 16:22:01 -0700 (PDT) Received: from localhost.localdomain (109-186-204-55.bb.netvision.net.il. [109.186.204.55]) by smtp.gmail.com with ESMTPSA id j21sm523436eja.109.2020.08.28.16.21.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 28 Aug 2020 16:21:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=CUWOPdxbZMjjlgVu2jD4P/2CDhJJfs5x+yzzwsdv4cs=; b=B1PSKMEqygi70lKdyXxj86DvB9a9WQs2Q//zCBuuiR5VmqCJTI9TVjJnatAn1fc4vH iWYYyNG4tMYGJ2a7yW61DO8QFltW9i62FYfrsemQ6c2jcNPASrQSE0q7EFuzJfSLxuqD spbb02itWJ3G/HK65eJyinASjhldAz7imABrWJzJoUtaUp9weZ+rUwchtP1yH0fIomfy iHDz38svTSJZonup+nRv2JeNdxe3a2XIn4QsJN5XdB2I7M6X+bsfbNZclfWjcFFHSSL7 6ASf2wTOwl/ekre3T4rU1RhvWbaq3xUA3pIUWMuXZ2RFHfphzA3c8ZAXrYExvy8hTYVx vq6w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=CUWOPdxbZMjjlgVu2jD4P/2CDhJJfs5x+yzzwsdv4cs=; b=aHli+A53YpJMg1b+y0jPOTZbb+YIcf8xv4965iMe09CYw1I6DfrGm168lwnroi7CWk TP3o1xVn/+dqdJa3P8Tho8/gXdMz7wD319O1K+k20V4ZYKpFr6T8yiTMBbIk8CELhLZf 4g/AFOiiqBMAGtuOyEgEZtc4NsqyfOULzn0lc6ZannOEc6TfTlCJdt756uJFM+g6CxSf d+Smyera40GyQcl1s2VMkKkU6LIf+eedO/oX/s9U/W3alpdo0+rWilJhZUWhvktY84da +F3gOI0wEckcrthdcAWuviMl2ozT2B5f3rI48d083lSdn4WhqvvSfunFyfHMo3WZkGhl fLDw== X-Gm-Message-State: AOAM533VEA8MtNPSqlWdugGZzysANFIQP3/Sj6Xh22w2gcdGD80peiiq 1QUa1+3glzwwC8SV4YhNrrapP41W735lSwt+ X-Google-Smtp-Source: ABdhPJybNi27GC3NxlTE0TlH+wXn19BkSmRFX5nFvm690bvRJ3b0CxJY1ilxRDclR41OftgOXB1jlg== X-Received: by 2002:a17:907:262e:: with SMTP id aq14mr1162575ejc.79.1598656919934; Fri, 28 Aug 2020 16:21:59 -0700 (PDT) From: Nir Soffer X-Google-Original-From: Nir Soffer To: qemu-devel@nongnu.org Subject: [PATCH v3 2/5] qemu-iotests: Fix FilePaths docstring Date: Sat, 29 Aug 2020 02:21:49 +0300 Message-Id: <20200828232152.205833-3-nsoffer@redhat.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200828232152.205833-1-nsoffer@redhat.com> References: <20200828232152.205833-1-nsoffer@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::644; envelope-from=nirsof@gmail.com; helo=mail-ej1-x644.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, 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 , qemu-block@nongnu.org, John Snow , Max Reitz , Nir Soffer 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" When this class was extracted from FilePath, the docstring was not updated for generating multiple files, and the example usage was referencing unrelated file. While fixing the docstring, add example for creating sockets, which should use iotests.sock_dir instead of the default base_dir. Fixes: de263986b5dc Signed-off-by: Nir Soffer --- tests/qemu-iotests/iotests.py | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/tests/qemu-iotests/iotests.py b/tests/qemu-iotests/iotests.py index 2fd5c916fa..4abfe63662 100644 --- a/tests/qemu-iotests/iotests.py +++ b/tests/qemu-iotests/iotests.py @@ -450,14 +450,21 @@ def file_pattern(name): =20 class FilePaths: """ - FilePaths is an auto-generated filename that cleans itself up. + Context manager generating multiple file names. The generated files are + removed when exiting the context. =20 - Use this context manager to generate filenames and ensure that the file - gets deleted:: + Example usage: + + with FilePaths(['a.img', 'b.img']) as (img_a, img_b): + # Use img_a and img_b here... + + # a.img and b.img are automatically removed here. + + By default images are created in iotests.test_dir. To create socket use + iotests.sock_dir: + + with FilePaths(['a.sock'], base_dir=3Diotests.sock_dir) as (sock,): =20 - with FilePaths(['test.img']) as img_path: - qemu_img('create', img_path, '1G') - # migration_sock_path is automatically deleted """ def __init__(self, names, base_dir=3Dtest_dir): self.paths =3D [] --=20 2.26.2 From nobody Sat May 18 11:46:48 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=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1598657126; cv=none; d=zohomail.com; s=zohoarc; b=lISWZeBmgTmoIOT63sMvMTgKSWKGIAghtOWONcjHsPsJcQQ0l8x0yQa7MrvUd4WT9ehyyvXY8XMRLnJSRq7Q90z+ZGt7Vg1Jx4LmQOw2n0FZp3kfBGkeraLQWMHA9WaTMXvLjhwPmo/AmqvCXg7VvU2EAy32jlOdlmvsKeblaLc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1598657126; 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=lJC7yqn+aYrJFGPSXOQj9C6bCyzL+YLObXLu10CJu2E=; b=jrIlYj8NW5ijQsZY2BdwMzDX+Ms3FTOUfiCtuoIodVNyZxDn++4cutH8rMPqaQ3mR0httMQCgzpFTcZQtaSHkWVkvRkM8l7AZwwerq7wbL/NvEaY2onrujRnBdu8pwCKusViSVMl6qktW3dVIqo7Yade79jTtFImwO8gg39Zw8I= 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 15986571259000.6332919614607135; Fri, 28 Aug 2020 16:25:25 -0700 (PDT) Received: from localhost ([::1]:38534 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kBnkI-0005Zo-1d for importer@patchew.org; Fri, 28 Aug 2020 19:25:22 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:54786) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kBnh7-0001iu-Eu; Fri, 28 Aug 2020 19:22:05 -0400 Received: from mail-ej1-x644.google.com ([2a00:1450:4864:20::644]:36942) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kBnh5-0006Jm-L6; Fri, 28 Aug 2020 19:22:05 -0400 Received: by mail-ej1-x644.google.com with SMTP id e23so1236447ejb.4; Fri, 28 Aug 2020 16:22:02 -0700 (PDT) Received: from localhost.localdomain (109-186-204-55.bb.netvision.net.il. [109.186.204.55]) by smtp.gmail.com with ESMTPSA id j21sm523436eja.109.2020.08.28.16.22.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 28 Aug 2020 16:22:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=lJC7yqn+aYrJFGPSXOQj9C6bCyzL+YLObXLu10CJu2E=; b=su84LV7FrdSKS48qJv2WmNLin8ZufKiPUyyoDfSWX/fDrIJXAk+NTlLBfOHePm0Z+l TS39fgkb8GUFp5p4JdrM7Mnv18L6rW5Z+nECrCwSMnRJbRG2jIrA/pgeEX/oOoXWyqTK khJHsMhu1QCcQAtgXJuX2H/63mu0TtqDRWe+a0MLcnLJla9JQp1Mi4uh9Gp0S4Swzpvq s9w2jutwPbGJccPDEKcJAAR8qITRvFnyi1uVdJ7hID0HwHODqZFAPjNbDZnwGWZ+0W1U 7X6NgdQos1aqKVilFM6ANLUpVXlZrCZi5bnenHTriKpAbzJYNQhHU2lcO/FvKyM1bOz2 ujsA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=lJC7yqn+aYrJFGPSXOQj9C6bCyzL+YLObXLu10CJu2E=; b=jRb4gh0Bioc+npRP0qu3NdMLXoP+8gF4eDYdI2xZw/s7XN7Bp/zyWmfPLtl85MyDCs Gb/4O6jVz8U3M6ewhFQRMGuOZgpeg618DM0WAnxktlqjLnEg8ci9yLbqT9vSR6IHtmqm ZBxjlfkbtt3a03NOEeCSROh9b6HYjXqyPRr3gIUvWteOUtaPjzHUx4NaM2tr7p0gWKsO h+Q44IRvoj+GVYNBvatci6T4shuDKOXHBDMpzJB72AO6n99zJxafFlccumFjs/JbGqOs pEu9hSlgySPQc7FOtlZnnbRf4qE4KN575icGzih6ho1Yq9+6iT2zrRSjMicp4OSd78rE AaTQ== X-Gm-Message-State: AOAM53091z33z8fqfKmtscHEn/MmipuCbuoupMKUWjVXMfOvUfvwFLGg oqlg7Dt2qlMZTU4uKr+BzZnIvceSkuExEgEx X-Google-Smtp-Source: ABdhPJx4XJONk+930Fjs84XWBG3u3JLQM+pUYFNhVfR1YtxkhoV7558nqVqcEVRUEGm7gvsWO+RQmg== X-Received: by 2002:a17:906:289a:: with SMTP id o26mr1086286ejd.309.1598656921636; Fri, 28 Aug 2020 16:22:01 -0700 (PDT) From: Nir Soffer X-Google-Original-From: Nir Soffer To: qemu-devel@nongnu.org Subject: [PATCH v3 3/5] qemu-iotests: Support varargs syntax in FilePaths Date: Sat, 29 Aug 2020 02:21:50 +0300 Message-Id: <20200828232152.205833-4-nsoffer@redhat.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200828232152.205833-1-nsoffer@redhat.com> References: <20200828232152.205833-1-nsoffer@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::644; envelope-from=nirsof@gmail.com; helo=mail-ej1-x644.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, 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 , qemu-block@nongnu.org, John Snow , Max Reitz , Nir Soffer 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" Accept variable number of names instead of a sequence: with FilePaths("a", "b", "c") as (a, b, c): The disadvantage is that base_dir must be used as kwarg: with FilePaths("a", "b", base_dir=3Dsoc_dir) as (sock1, sock2): But this is more clear and calling optional argument as positional arguments is bad idea anyway. Signed-off-by: Nir Soffer Reviewed-by: Max Reitz --- tests/qemu-iotests/194 | 4 ++-- tests/qemu-iotests/257 | 10 ++++------ tests/qemu-iotests/iotests.py | 8 ++++---- 3 files changed, 10 insertions(+), 12 deletions(-) diff --git a/tests/qemu-iotests/194 b/tests/qemu-iotests/194 index da7c4265ec..08389f474e 100755 --- a/tests/qemu-iotests/194 +++ b/tests/qemu-iotests/194 @@ -26,8 +26,8 @@ iotests.script_initialize(supported_fmts=3D['qcow2', 'qed= ', 'raw'], =20 with iotests.FilePath('source.img') as source_img_path, \ iotests.FilePath('dest.img') as dest_img_path, \ - iotests.FilePaths(['migration.sock', 'nbd.sock'], iotests.sock_dir) a= s \ - [migration_sock_path, nbd_sock_path], \ + iotests.FilePaths('migration.sock', 'nbd.sock', base_dir=3Diotests.so= ck_dir) \ + as (migration_sock_path, nbd_sock_path), \ iotests.VM('source') as source_vm, \ iotests.VM('dest') as dest_vm: =20 diff --git a/tests/qemu-iotests/257 b/tests/qemu-iotests/257 index e1e6077219..a9aa65bbe3 100755 --- a/tests/qemu-iotests/257 +++ b/tests/qemu-iotests/257 @@ -275,10 +275,9 @@ def test_bitmap_sync(bsync_mode, msync_mode=3D'bitmap'= , failure=3DNone): an incomplete backup. Testing limitations prevent testing competing writes. """ - with iotests.FilePaths(['img', 'bsync1', 'bsync2', - 'fbackup0', 'fbackup1', 'fbackup2']) as \ - (img_path, bsync1, bsync2, - fbackup0, fbackup1, fbackup2), \ + with iotests.FilePaths( + 'img', 'bsync1', 'bsync2', 'fbackup0', 'fbackup1', 'fbackup2')= as \ + (img_path, bsync1, bsync2, fbackup0, fbackup1, fbackup2), \ iotests.VM() as vm: =20 mode =3D "Mode {:s}; Bitmap Sync {:s}".format(msync_mode, bsync_mo= de) @@ -441,8 +440,7 @@ def test_backup_api(): """ Test malformed and prohibited invocations of the backup API. """ - with iotests.FilePaths(['img', 'bsync1']) as \ - (img_path, backup_path), \ + with iotests.FilePaths('img', 'bsync1') as (img_path, backup_path), \ iotests.VM() as vm: =20 log("\n=3D=3D=3D API failure tests =3D=3D=3D\n") diff --git a/tests/qemu-iotests/iotests.py b/tests/qemu-iotests/iotests.py index 4abfe63662..0d22ad5b03 100644 --- a/tests/qemu-iotests/iotests.py +++ b/tests/qemu-iotests/iotests.py @@ -455,7 +455,7 @@ class FilePaths: =20 Example usage: =20 - with FilePaths(['a.img', 'b.img']) as (img_a, img_b): + with FilePaths('a.img', 'b.img') as (img_a, img_b): # Use img_a and img_b here... =20 # a.img and b.img are automatically removed here. @@ -463,10 +463,10 @@ class FilePaths: By default images are created in iotests.test_dir. To create socket use iotests.sock_dir: =20 - with FilePaths(['a.sock'], base_dir=3Diotests.sock_dir) as (sock,): + with FilePaths('a.sock', base_dir=3Diotests.sock_dir) as (sock,): =20 """ - def __init__(self, names, base_dir=3Dtest_dir): + def __init__(self, *names, base_dir=3Dtest_dir): self.paths =3D [] for name in names: self.paths.append(os.path.join(base_dir, file_pattern(name))) @@ -487,7 +487,7 @@ class FilePath(FilePaths): FilePath is a specialization of FilePaths that takes a single filename. """ def __init__(self, name, base_dir=3Dtest_dir): - super(FilePath, self).__init__([name], base_dir) + super(FilePath, self).__init__(name, base_dir=3Dbase_dir) =20 def __enter__(self): return self.paths[0] --=20 2.26.2 From nobody Sat May 18 11:46:48 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=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1598657192; cv=none; d=zohomail.com; s=zohoarc; b=CNeWaXDYIOhpHzorGWr6gV4QfSu5+mlptzQgpG8cEtL0lzjrRGV5CVNZEgsrrFpI12eWyNX4raejwHTmMjicV3XMQ3WVJDWfwsvFkbhrbDRIGLFKJ+1lJfFReKkYeix0O5WbpEXQkxpYXg557UYduelS5g/Ph9UfkPK7Q2xtbXY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1598657192; 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=DfQdOmDWDR7CywBxhlqnr+z6I//LZ+YDpkFuKYbiMMg=; b=TrDi99viOdeOw54E5MEZXv8gGEOLs0BtP2Rrte/fPmrTpc7yoOLmjy8J6gOQxDs+dY0ka0/7ppuEmhSuL/G0b/E6SePIK5csVr3wh6WJF2IQj1goZbdbWIQ7Yz+280DRCMhgWkggfPzCA1FzdAjIiQojLvs1CZWbO8iv72tsjaY= 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 1598657192002405.2081866950564; Fri, 28 Aug 2020 16:26:32 -0700 (PDT) Received: from localhost ([::1]:42180 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kBnlP-0007CL-A2 for importer@patchew.org; Fri, 28 Aug 2020 19:26:31 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:54796) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kBnh9-0001l2-Ni; Fri, 28 Aug 2020 19:22:07 -0400 Received: from mail-ej1-x643.google.com ([2a00:1450:4864:20::643]:44584) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kBnh7-0006Jw-90; Fri, 28 Aug 2020 19:22:07 -0400 Received: by mail-ej1-x643.google.com with SMTP id bo3so1187646ejb.11; Fri, 28 Aug 2020 16:22:04 -0700 (PDT) Received: from localhost.localdomain (109-186-204-55.bb.netvision.net.il. [109.186.204.55]) by smtp.gmail.com with ESMTPSA id j21sm523436eja.109.2020.08.28.16.22.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 28 Aug 2020 16:22:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=DfQdOmDWDR7CywBxhlqnr+z6I//LZ+YDpkFuKYbiMMg=; b=hzdJrdbwFVdaWVTrr6/Lyj9cgSgOLt52i0nlTOLvRTax6vxct9AmcSMmXsiGGE0jtH KTQW/11HuDEHda87vecNanVgo77hBbd1/xI1WP/L3bVoSMtdWApMBHL5Vv2PcOg37x/B GgG9l0c1vnwjulYDIDvlW9T1KGatM/hNiWoL3vpd7TxGoQ3qIP+EBa2N+tJb4ieQIrZt 4bDT4A5OYzXoqIzdR9JpNxBlO+EY6kl+//YgnEKtrL0wdogOWzDbMhVgJEYt8tYSnGaf M/KbuXyy1I6LWIx5Sk/tX8Gt0qC9xligjZ4rCQ2nF8ZERb6/AT8G9mEIp3g8sQu+mFDP rdxw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=DfQdOmDWDR7CywBxhlqnr+z6I//LZ+YDpkFuKYbiMMg=; b=rA5j+XpVlJpjVdJMQVuMPrpfAeleHpRzyjhhXnAmSpMIFbAGtSCOU45xnEqmOcrQqq NuDS8gDJNDoWCGTrS2NbQD7ilKKiCoHgVv8zY5oVVS731pr2OAnncHD5TnFKXClHDyQ/ /iPwLZX9ixkp0VloFkB0w2/KvJOVzHn7e7xlX3XlEKSZ3re1LKbdUloLjt3HhVuErtEc nSNrIMqw9ns2XvOMOV8hCyHrQXjOQ6SLJLgk/OYela9jBPFzFg1Duvqe+Y6wzwXiwBW0 2fT5WeAItDOBmqsx+WEmsfnx3Ybco3ytVvMIm6hZJvz2rx0Ll4wQdF1dW0vEp+dDuwGY Gvgw== X-Gm-Message-State: AOAM530wJDwQ5YcXWW0AB+GjnzKNFHp4f1r37WfgCG7rl40d2/62NZj1 N7O/wDsTP5k4Id8eYukKvXhtghlZX4dAaLcJ X-Google-Smtp-Source: ABdhPJzb/ddDrn0EPX9Vzpd41i2wf97PIV72zM5s+jkYrQu31U7ecJZj4SqKMuOSjpMOllJHymJyig== X-Received: by 2002:a17:907:94c3:: with SMTP id dn3mr1115216ejc.186.1598656923193; Fri, 28 Aug 2020 16:22:03 -0700 (PDT) From: Nir Soffer X-Google-Original-From: Nir Soffer To: qemu-devel@nongnu.org Subject: [PATCH v3 4/5] qemu-iotests: Merge FilePaths and FilePath Date: Sat, 29 Aug 2020 02:21:51 +0300 Message-Id: <20200828232152.205833-5-nsoffer@redhat.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200828232152.205833-1-nsoffer@redhat.com> References: <20200828232152.205833-1-nsoffer@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::643; envelope-from=nirsof@gmail.com; helo=mail-ej1-x643.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, 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 , qemu-block@nongnu.org, John Snow , Max Reitz , Nir Soffer 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" FilePath creates now one temporary file: with FilePath("a") as a: Or more: with FilePath("a", "b", "c") as (a, b, c): This is also the behavior of the file_path() helper, used by some of the tests. Now we have only 2 helpers for creating temporary files instead of 3. Signed-off-by: Nir Soffer Reviewed-by: Max Reitz --- tests/qemu-iotests/194 | 2 +- tests/qemu-iotests/208 | 2 +- tests/qemu-iotests/222 | 2 +- tests/qemu-iotests/257 | 4 ++-- tests/qemu-iotests/iotests.py | 23 ++++++++++------------- 5 files changed, 15 insertions(+), 18 deletions(-) diff --git a/tests/qemu-iotests/194 b/tests/qemu-iotests/194 index 08389f474e..7a4863ab18 100755 --- a/tests/qemu-iotests/194 +++ b/tests/qemu-iotests/194 @@ -26,7 +26,7 @@ iotests.script_initialize(supported_fmts=3D['qcow2', 'qed= ', 'raw'], =20 with iotests.FilePath('source.img') as source_img_path, \ iotests.FilePath('dest.img') as dest_img_path, \ - iotests.FilePaths('migration.sock', 'nbd.sock', base_dir=3Diotests.so= ck_dir) \ + iotests.FilePath('migration.sock', 'nbd.sock', base_dir=3Diotests.soc= k_dir) \ as (migration_sock_path, nbd_sock_path), \ iotests.VM('source') as source_vm, \ iotests.VM('dest') as dest_vm: diff --git a/tests/qemu-iotests/208 b/tests/qemu-iotests/208 index 6cb642f821..54aa4be273 100755 --- a/tests/qemu-iotests/208 +++ b/tests/qemu-iotests/208 @@ -26,7 +26,7 @@ iotests.script_initialize(supported_fmts=3D['generic']) =20 with iotests.FilePath('disk.img') as disk_img_path, \ iotests.FilePath('disk-snapshot.img') as disk_snapshot_img_path, \ - iotests.FilePath('nbd.sock', iotests.sock_dir) as nbd_sock_path, \ + iotests.FilePath('nbd.sock', base_dir=3Diotests.sock_dir) as nbd_sock= _path, \ iotests.VM() as vm: =20 img_size =3D '10M' diff --git a/tests/qemu-iotests/222 b/tests/qemu-iotests/222 index 6602f6b4ba..14d67c875b 100755 --- a/tests/qemu-iotests/222 +++ b/tests/qemu-iotests/222 @@ -49,7 +49,7 @@ remainder =3D [("0xd5", "0x108000", "32k"), # Right-end = of partial-left [1] =20 with iotests.FilePath('base.img') as base_img_path, \ iotests.FilePath('fleece.img') as fleece_img_path, \ - iotests.FilePath('nbd.sock', iotests.sock_dir) as nbd_sock_path, \ + iotests.FilePath('nbd.sock', base_dir=3Diotests.sock_dir) as nbd_sock= _path, \ iotests.VM() as vm: =20 log('--- Setting up images ---') diff --git a/tests/qemu-iotests/257 b/tests/qemu-iotests/257 index a9aa65bbe3..c80e06ae28 100755 --- a/tests/qemu-iotests/257 +++ b/tests/qemu-iotests/257 @@ -275,7 +275,7 @@ def test_bitmap_sync(bsync_mode, msync_mode=3D'bitmap',= failure=3DNone): an incomplete backup. Testing limitations prevent testing competing writes. """ - with iotests.FilePaths( + with iotests.FilePath( 'img', 'bsync1', 'bsync2', 'fbackup0', 'fbackup1', 'fbackup2')= as \ (img_path, bsync1, bsync2, fbackup0, fbackup1, fbackup2), \ iotests.VM() as vm: @@ -440,7 +440,7 @@ def test_backup_api(): """ Test malformed and prohibited invocations of the backup API. """ - with iotests.FilePaths('img', 'bsync1') as (img_path, backup_path), \ + with iotests.FilePath('img', 'bsync1') as (img_path, backup_path), \ iotests.VM() as vm: =20 log("\n=3D=3D=3D API failure tests =3D=3D=3D\n") diff --git a/tests/qemu-iotests/iotests.py b/tests/qemu-iotests/iotests.py index 0d22ad5b03..7a233330c9 100644 --- a/tests/qemu-iotests/iotests.py +++ b/tests/qemu-iotests/iotests.py @@ -448,14 +448,14 @@ class Timeout: def file_pattern(name): return "{0}-{1}".format(os.getpid(), name) =20 -class FilePaths: +class FilePath: """ Context manager generating multiple file names. The generated files are removed when exiting the context. =20 Example usage: =20 - with FilePaths('a.img', 'b.img') as (img_a, img_b): + with FilePath('a.img', 'b.img') as (img_a, img_b): # Use img_a and img_b here... =20 # a.img and b.img are automatically removed here. @@ -463,7 +463,10 @@ class FilePaths: By default images are created in iotests.test_dir. To create socket use iotests.sock_dir: =20 - with FilePaths('a.sock', base_dir=3Diotests.sock_dir) as (sock,): + with FilePath('a.sock', base_dir=3Diotests.sock_dir) as sock: + + For convenience, calling with one argument yields a single file instea= d of + a tuple with one item. =20 """ def __init__(self, *names, base_dir=3Dtest_dir): @@ -472,7 +475,10 @@ class FilePaths: self.paths.append(os.path.join(base_dir, file_pattern(name))) =20 def __enter__(self): - return self.paths + if len(self.paths) =3D=3D 1: + return self.paths[0] + else: + return self.paths =20 def __exit__(self, exc_type, exc_val, exc_tb): for path in self.paths: @@ -482,15 +488,6 @@ class FilePaths: pass return False =20 -class FilePath(FilePaths): - """ - FilePath is a specialization of FilePaths that takes a single filename. - """ - def __init__(self, name, base_dir=3Dtest_dir): - super(FilePath, self).__init__(name, base_dir=3Dbase_dir) - - def __enter__(self): - return self.paths[0] =20 def file_path_remover(): for path in reversed(file_path_remover.paths): --=20 2.26.2 From nobody Sat May 18 11:46:48 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=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1598657242; cv=none; d=zohomail.com; s=zohoarc; b=Mf64Lxrtn//byZPQRdrvpWZsXpSymzHpmyhsAUWIOFMH+daO1C15zb2hdMTiG6uMF2dEq9otwdyuBNtrWd2KoH1RWPsX5fk+vUmdiMuiC7103zOnKu8MLIY8sXR3ISssZgPRRsHWLuPJV+4y4z0Ro6GW24rdniJdyUOsu95ewTM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1598657242; 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=bg//xUODCPLE5mBh/l+245X3L+l4EDTj7jXGaXaVBqc=; b=O+U1dTY+nIHqanUmPhUgl+m0FvtmSNv3sS6uqb9wGpRkd+PHtmp96u2yjKM16/aa2LKUAUal2B8AcL3Kl8Di49mKhjj2j6XKEy0wpCVlVodfjTMTfnCLETXbIJtcuyr7UyEqQHIw05LIH3NPZZJmd0t+tsXuT7S+u3N0yobBEAY= 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 1598657242246687.7286677424657; Fri, 28 Aug 2020 16:27:22 -0700 (PDT) Received: from localhost ([::1]:44262 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kBnmD-00083h-In for importer@patchew.org; Fri, 28 Aug 2020 19:27:21 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:54810) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kBnhB-0001oU-Dt; Fri, 28 Aug 2020 19:22:10 -0400 Received: from mail-ej1-x632.google.com ([2a00:1450:4864:20::632]:32862) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kBnh9-0006KA-OA; Fri, 28 Aug 2020 19:22:09 -0400 Received: by mail-ej1-x632.google.com with SMTP id a21so1272154ejp.0; Fri, 28 Aug 2020 16:22:06 -0700 (PDT) Received: from localhost.localdomain (109-186-204-55.bb.netvision.net.il. [109.186.204.55]) by smtp.gmail.com with ESMTPSA id j21sm523436eja.109.2020.08.28.16.22.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 28 Aug 2020 16:22:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=bg//xUODCPLE5mBh/l+245X3L+l4EDTj7jXGaXaVBqc=; b=uw0tuyls5LKFhVy5n4JG2LyLVEUjLDL42NQh39Bb5+ppd2zFUTNb0ZkMCVD4Up+p+t 5jQNZ641nNA7AOY4CD6cQ58rYfvI8+PzvPOpI+Htd8eShvXGgCFSnfIt+1rWpHbA6b+/ RVZXcQ18mzOwuyXm3M8D2w7+iVH9ZIzg+i1eMERFIdaQmH3V3M3LmWChcBVzvmiL8atz UpqW89i37HpxZ2uzrTUnVgwvQGQXeCHc8MCQ2FtQjXWaKOYQ9vEE/yMVLJBEBDE9i/Fx ths/GgDGLileYm8Wzs9qZF1Tru0e589Y0lGD2UD+pj/OjaNkwjbQnavbUbtxbFfd1wW3 lgwA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=bg//xUODCPLE5mBh/l+245X3L+l4EDTj7jXGaXaVBqc=; b=fk/OBIo1NdiuedW7iJa7QTI//jZM3ugevByIGBR6iGL7dSSQZaYRsaWQn84WnDcg5I e3S1FQL5ZF1TYj2ebJnvD26vNQaW78GSaKaKZOew3g5XXJTy2ZJ9zoOQfmtczXzoaGnr eSdM6KMbaaGfNrVmkglaFwGBvdyDods0BgWox7TH3jJrCLX+Xm7DHZ8fcXrJPMNwQWMV nhIXbVALp6mLym/tq3mOwzkkSSVXs1e8hpQXWpb+XJaf15a7N+r/tLo2QxYsNHlW4DGa 9mGukZk8ei/LY1F4sCp6BjQfen7a1lUWcjXqEWaMqV8vdubzJSE8B2IbAR+K9g+DFR4i ykHw== X-Gm-Message-State: AOAM530RsFc9MQ1YYFIM5VngPj0nOLmdn0dvQq/RSUuHF0ZkQZ2CxEiH /tkuHUvKyNQhILIDB292xbZPlZPa010hz+/G X-Google-Smtp-Source: ABdhPJz0JY0QwFrlT8xSKdN63O92/vBrDdqm9df/ZhHaVUxlLfm254eO+W0Y4tBx26juBYEmOzt+lQ== X-Received: by 2002:a17:907:9487:: with SMTP id dm7mr1184180ejc.114.1598656924782; Fri, 28 Aug 2020 16:22:04 -0700 (PDT) From: Nir Soffer X-Google-Original-From: Nir Soffer To: qemu-devel@nongnu.org Subject: [PATCH v3 5/5] qemu-iotests: Simplify FilePath __init__ Date: Sat, 29 Aug 2020 02:21:52 +0300 Message-Id: <20200828232152.205833-6-nsoffer@redhat.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200828232152.205833-1-nsoffer@redhat.com> References: <20200828232152.205833-1-nsoffer@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::632; envelope-from=nirsof@gmail.com; helo=mail-ej1-x632.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, 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 , qemu-block@nongnu.org, John Snow , Max Reitz , Nir Soffer 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" Use list comprehension instead of append loop. Signed-off-by: Nir Soffer Reviewed-by: Max Reitz --- tests/qemu-iotests/iotests.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/tests/qemu-iotests/iotests.py b/tests/qemu-iotests/iotests.py index 7a233330c9..cd0abf37e5 100644 --- a/tests/qemu-iotests/iotests.py +++ b/tests/qemu-iotests/iotests.py @@ -470,9 +470,8 @@ class FilePath: =20 """ def __init__(self, *names, base_dir=3Dtest_dir): - self.paths =3D [] - for name in names: - self.paths.append(os.path.join(base_dir, file_pattern(name))) + self.paths =3D [os.path.join(base_dir, file_pattern(name)) + for name in names] =20 def __enter__(self): if len(self.paths) =3D=3D 1: --=20 2.26.2