From patchwork Fri Aug 28 23:21:48 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nir Soffer X-Patchwork-Id: 11743813 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id CC5DA13B6 for ; Fri, 28 Aug 2020 23:22:49 +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 A069A20838 for ; Fri, 28 Aug 2020 23:22:49 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="sThXLve0" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org A069A20838 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:60276 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kBnho-0002ow-Md for patchwork-qemu-devel@patchwork.kernel.org; Fri, 28 Aug 2020 19:22:48 -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) 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) 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) 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 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+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" 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 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 class FilePath(FilePaths): From patchwork Fri Aug 28 23:21:49 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nir Soffer X-Patchwork-Id: 11743815 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 158DF14E5 for ; Fri, 28 Aug 2020 23:24:00 +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 DD68220838 for ; Fri, 28 Aug 2020 23:23:59 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="B1PSKMEq" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org DD68220838 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:35386 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kBnix-0004DO-4H for patchwork-qemu-devel@patchwork.kernel.org; Fri, 28 Aug 2020 19:23:59 -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) 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) 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) 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 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+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" 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): 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. - 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=iotests.sock_dir) as (sock,): - 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=test_dir): self.paths = [] From patchwork Fri Aug 28 23:21:50 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nir Soffer X-Patchwork-Id: 11743817 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 976D113B6 for ; Fri, 28 Aug 2020 23:25:10 +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 6AD4320838 for ; Fri, 28 Aug 2020 23:25:10 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="su84LV7F" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 6AD4320838 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:38534 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kBnk5-0005Zo-JQ for patchwork-qemu-devel@patchwork.kernel.org; Fri, 28 Aug 2020 19:25:09 -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) 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) 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) 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 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+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" 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=soc_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=['qcow2', 'qed', 'raw'], 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) as \ - [migration_sock_path, nbd_sock_path], \ + iotests.FilePaths('migration.sock', 'nbd.sock', base_dir=iotests.sock_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/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='bitmap', failure=None): 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: mode = "Mode {:s}; Bitmap Sync {:s}".format(msync_mode, bsync_mode) @@ -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: log("\n=== API failure tests ===\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: Example usage: - 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... # 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: - with FilePaths(['a.sock'], base_dir=iotests.sock_dir) as (sock,): + with FilePaths('a.sock', base_dir=iotests.sock_dir) as (sock,): """ - def __init__(self, names, base_dir=test_dir): + def __init__(self, *names, base_dir=test_dir): self.paths = [] 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=test_dir): - super(FilePath, self).__init__([name], base_dir) + super(FilePath, self).__init__(name, base_dir=base_dir) def __enter__(self): return self.paths[0] From patchwork Fri Aug 28 23:21:51 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nir Soffer X-Patchwork-Id: 11743819 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 90B7713B6 for ; Fri, 28 Aug 2020 23:26:23 +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 64B4120838 for ; Fri, 28 Aug 2020 23:26:23 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="hzdJrdbw" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 64B4120838 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:42180 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kBnlG-0007CL-Eq for patchwork-qemu-devel@patchwork.kernel.org; Fri, 28 Aug 2020 19:26:22 -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) 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) 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) 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 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+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" 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=['qcow2', 'qed', 'raw'], 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=iotests.sock_dir) \ + iotests.FilePath('migration.sock', 'nbd.sock', base_dir=iotests.sock_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=['generic']) 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=iotests.sock_dir) as nbd_sock_path, \ iotests.VM() as vm: img_size = '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 = [("0xd5", "0x108000", "32k"), # Right-end of partial-left [1] 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=iotests.sock_dir) as nbd_sock_path, \ iotests.VM() as vm: 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='bitmap', failure=None): 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: log("\n=== API failure tests ===\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) -class FilePaths: +class FilePath: """ Context manager generating multiple file names. The generated files are removed when exiting the context. Example usage: - 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... # 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: - with FilePaths('a.sock', base_dir=iotests.sock_dir) as (sock,): + with FilePath('a.sock', base_dir=iotests.sock_dir) as sock: + + For convenience, calling with one argument yields a single file instead of + a tuple with one item. """ def __init__(self, *names, base_dir=test_dir): @@ -472,7 +475,10 @@ class FilePaths: self.paths.append(os.path.join(base_dir, file_pattern(name))) def __enter__(self): - return self.paths + if len(self.paths) == 1: + return self.paths[0] + else: + return self.paths def __exit__(self, exc_type, exc_val, exc_tb): for path in self.paths: @@ -482,15 +488,6 @@ class FilePaths: pass return False -class FilePath(FilePaths): - """ - FilePath is a specialization of FilePaths that takes a single filename. - """ - def __init__(self, name, base_dir=test_dir): - super(FilePath, self).__init__(name, base_dir=base_dir) - - def __enter__(self): - return self.paths[0] def file_path_remover(): for path in reversed(file_path_remover.paths): From patchwork Fri Aug 28 23:21:52 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nir Soffer X-Patchwork-Id: 11743821 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 8179613B6 for ; Fri, 28 Aug 2020 23:27:13 +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 5674C20838 for ; Fri, 28 Aug 2020 23:27:13 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="uw0tuyls" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 5674C20838 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:44262 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kBnm4-00083h-Iv for patchwork-qemu-devel@patchwork.kernel.org; Fri, 28 Aug 2020 19:27:12 -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) 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) 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) 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 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+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" 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: """ def __init__(self, *names, base_dir=test_dir): - self.paths = [] - for name in names: - self.paths.append(os.path.join(base_dir, file_pattern(name))) + self.paths = [os.path.join(base_dir, file_pattern(name)) + for name in names] def __enter__(self): if len(self.paths) == 1: