From nobody Sat May 18 14:54:09 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=1597967763; cv=none; d=zohomail.com; s=zohoarc; b=RuiCupNzq+BMk9u7VkbxYCCcoXwX+6Lsk9eaN85CnxTaUbO2oREUYucBof3tDjojNO+2IVkBJuQ//Im2NpX9gneIwYiS9+77a5yymJuQIBW50OCSs4yZBBHZAbL5c35N8tMDB4v+RcrQPHwwNpqJJ0l0vrJZHA6yoSNlu1jgPL4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1597967763; 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=dEMPiCqe9PefxpWTTe3SJ7uQAbS0drp2NTOLNfe8U44=; b=BeY9GgdCAZuOvFNXPAcVFlE5VMlx8od4BbwzTLnx3nl7S87K6qo4985I9Q5DjyftOuea9/wLlGZV8EbPUm8VEwVBCp349mO25Hu5W3UJ5shmC5bGiJfgfu2Oc3e9MkYUB8Wvp5ALBDB4jp4sHoGENS8IlhGiLm8/FUPyQW3M1fs= 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 1597967763033635.0166283976729; Thu, 20 Aug 2020 16:56:03 -0700 (PDT) Received: from localhost ([::1]:60904 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1k8uPZ-00020i-Iz for importer@patchew.org; Thu, 20 Aug 2020 19:56:01 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:45966) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k8uOC-0000H2-G2; Thu, 20 Aug 2020 19:54:36 -0400 Received: from mail-wr1-x443.google.com ([2a00:1450:4864:20::443]:40736) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1k8uOA-00070m-L4; Thu, 20 Aug 2020 19:54:36 -0400 Received: by mail-wr1-x443.google.com with SMTP id l2so339337wrc.7; Thu, 20 Aug 2020 16:54:34 -0700 (PDT) Received: from localhost.localdomain (109-186-18-89.bb.netvision.net.il. [109.186.18.89]) by smtp.gmail.com with ESMTPSA id o128sm556506wmo.39.2020.08.20.16.54.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 20 Aug 2020 16:54:31 -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=dEMPiCqe9PefxpWTTe3SJ7uQAbS0drp2NTOLNfe8U44=; b=kQM2m0OYVuLBN6jSDlqJlSz6hPWcob2zyci9GLLCFUKYBdgmAWHr4wpkxt0V3fRuKn kiiDGhmJcZJPUL4kvhz0YtcmGsRrFHVvxcIv1CuQUM0jE1WGWTnqvHKxHoB/7LOZVrk4 P87pelL9m3Vs7lTXcJ52yx43BADmwAecKHs+C30NGqQgRuWVrshHv4D/9WZiBZRGXHF6 eEVpcV9lx7+a6An7F47Fjt/7wSTaWFERP3ywJm2x2u9bWXbBED8+on7805R76FkErRm3 xKYlQHhuzQ/iOM9vN+qep1ZVaKbzTz1xmNSauY6EyTjhSQ2T9udrSFilS9YKGP2or0Dt VwVA== 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=dEMPiCqe9PefxpWTTe3SJ7uQAbS0drp2NTOLNfe8U44=; b=q/YUsZ8SKMkreTYaZubcVl2694Jax4g+VZrNKS0cYrVBU0/0XDkPXduvYxpH0YVoQm nrGUG6sYNHFubJsavk09hw/a4RJOJAI8uWbAjgl1eNGHb4giyDNM1pa+saBjyF6VfuQ+ 2f1IUK+9JNhHa3D1VL0mVcxOBMHYYozgMljGyZfPo570Evv91QS0K2o5Hr5R+8xKEAd6 howeVJcTO7VLT6Q1PkuD6c1kFc7gPLCpp+xNZeGwXNE4wxeVvd0eOMs5GDtnAGkKY8KI 3s0SnPNrgvTmVTQc7EYDc5LrnxoplJueTOZEzqEzgOtRqcZ98hK0uiDHdLhlvqFrRyqd pCTw== X-Gm-Message-State: AOAM5322zNs+AoR4ThoNlp0aUiDKmPf6Jd3NeEIuQ9JpkCiAFOxamtWL xuSKwOX/lEnoF6LEinGklGD4tyGEljHfnL8/ X-Google-Smtp-Source: ABdhPJwahq30JprhS/yA4Rb8O051zjWBIvx9eWrphPvKHw8RrOdVdQ/bR0sL6XTB4FL+S8uxyali4A== X-Received: by 2002:adf:80c7:: with SMTP id 65mr153449wrl.35.1597967672431; Thu, 20 Aug 2020 16:54:32 -0700 (PDT) From: Nir Soffer X-Google-Original-From: Nir Soffer To: qemu-devel@nongnu.org Subject: [PATCH v2 1/5] qemu-iotests: Fix FilePaths cleanup Date: Fri, 21 Aug 2020 02:54:23 +0300 Message-Id: <20200820235427.374645-2-nsoffer@redhat.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200820235427.374645-1-nsoffer@redhat.com> References: <20200820235427.374645-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::443; envelope-from=nirsof@gmail.com; helo=mail-wr1-x443.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, URIBL_BLOCKED=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: Kevin Wolf 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 717b5b652c..16a04df8a3 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 14:54:09 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=1597967851; cv=none; d=zohomail.com; s=zohoarc; b=CJkaxYb4RkE/3AxnAiAO8/f5xEEsxDt+VqKlTc/1Vzkw6xbJRmz9h8InYzevMejvPe76TiMzmlRwlP3vHH4pi6CmooLMoaJiawbh8DZy9nJ8Wl0exGaU2MmcBRffMxHT0I/2es8S4DOCZXAl6yE/tZ/vyL23DhFehapFUCWDV8U= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1597967851; 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=JyZ42iytgyulxF3b/igSJBiCpRIiXynOvr9XqZCe6AQ=; b=lqeDW6fHxJh0R9eIoHrQC6TKq8QyRbYGvbPVWh5smRpI1DDNgH56YXQzh5VHXjaxHQNuaeXIWt8KwLqzN7yZ5cmx/dZAd6vHJq6A073B9w69+04xlIN5BR0CqYkDUGXKzeL5pd/v2VoEGSuzTsDUN4VNMzXtYoFhGIKgUt6eNDU= 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 1597967851177445.49044260403264; Thu, 20 Aug 2020 16:57:31 -0700 (PDT) Received: from localhost ([::1]:40044 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1k8uQz-00055D-U7 for importer@patchew.org; Thu, 20 Aug 2020 19:57:29 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:45972) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k8uOD-0000IY-Hc; Thu, 20 Aug 2020 19:54:37 -0400 Received: from mail-wr1-x441.google.com ([2a00:1450:4864:20::441]:40735) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1k8uOB-000712-UM; Thu, 20 Aug 2020 19:54:37 -0400 Received: by mail-wr1-x441.google.com with SMTP id l2so339376wrc.7; Thu, 20 Aug 2020 16:54:35 -0700 (PDT) Received: from localhost.localdomain (109-186-18-89.bb.netvision.net.il. [109.186.18.89]) by smtp.gmail.com with ESMTPSA id o128sm556506wmo.39.2020.08.20.16.54.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 20 Aug 2020 16:54:33 -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=JyZ42iytgyulxF3b/igSJBiCpRIiXynOvr9XqZCe6AQ=; b=sbtoQxF0Ljo53A4d8raN0AYvL6SC7z15jKoqCjtGJjRVzY5k9GKMerkXvVhC2FS+hJ s2BJ5wYRNnn0wfzFLnGfQCVxVgpJbtph2uxESVX6wzB5fm0GqHYfyUumXdh2G5YucivQ yd2JpnQdOrnikV6tWZJv8D02N8hFfxCxKRIEtXZnVDAKz56O5VEaaXgUtOWv41EPOoKn NDmUmVTc4u9uCWqT2Y48cs0q8E1r4Xr4HwimDbITFuVxh4stBJIE39NP1oEvI5iKN2ua WMwnzbFzD6enL76GBy2FOgvjmh44ckjw1weQq3OuLigwHCZ79L/L79CVd/oGjpau3IqD 7ZWQ== 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=JyZ42iytgyulxF3b/igSJBiCpRIiXynOvr9XqZCe6AQ=; b=dgycLcRGQir7pCx9Dvno9ujjKEh3+cvNUPks6rVlyO+wIRX0UsGA6XEiji3tyG1js8 BEhcQ3Nq0+ABZP7UomZHnSJpQzrt2GoVTOP56WtXzM2plQVwCcJyPZDLigAQAfhG37FK dWgmNnKtBM5nOrEP+xJOefaga0B5teuDltGMGl5NI4YFBfs8jxDkH4cm91DMD6NWOKml QdxFkws2f0YWLgT5AWg+sVVwUTlnz8MGdMyirIm59TZ+RShO+um7f272h18cZiuDypnc 6W2WtpxN6ddtSy29tFHqLH//2fqe14NK7Q+3WJbxrzm515oggXMFuRL9mApdbnUUAJSe cHyw== X-Gm-Message-State: AOAM533c39R7KylswZ9gEcs3k1RR7p5nTrek1LNv8YsHZq2+A4Eohz43 53bUJ+Icrh7Kgmzog0E7DgBW6p0Vtlo6Q2Aq X-Google-Smtp-Source: ABdhPJxvad/NuMT4ZgAWJh2LT4HCaPJX/NfmJB8Ts+KlG+BgfNaKKtQvX/t5pgJiabod53xM9+00+A== X-Received: by 2002:adf:9561:: with SMTP id 88mr165827wrs.240.1597967673960; Thu, 20 Aug 2020 16:54:33 -0700 (PDT) From: Nir Soffer X-Google-Original-From: Nir Soffer To: qemu-devel@nongnu.org Subject: [PATCH v2 2/5] qemu-iotests: Fix FilePaths docstring Date: Fri, 21 Aug 2020 02:54:24 +0300 Message-Id: <20200820235427.374645-3-nsoffer@redhat.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200820235427.374645-1-nsoffer@redhat.com> References: <20200820235427.374645-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::441; envelope-from=nirsof@gmail.com; helo=mail-wr1-x441.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, URIBL_BLOCKED=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. Fixes: de263986b5dc Signed-off-by: Nir Soffer Reviewed-by: Kevin Wolf Reviewed-by: Max Reitz --- tests/qemu-iotests/iotests.py | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/tests/qemu-iotests/iotests.py b/tests/qemu-iotests/iotests.py index 16a04df8a3..f34a1d7ef1 100644 --- a/tests/qemu-iotests/iotests.py +++ b/tests/qemu-iotests/iotests.py @@ -450,14 +450,16 @@ 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(['test.img', 'test.sock']) as (img_path, sock_path): + # Use img_path and sock_path here... + + # img_path and sock_path are automatically removed here. =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 14:54:09 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=1597967848; cv=none; d=zohomail.com; s=zohoarc; b=BQIg/sPWvf5c/czqfOUFHiLmhFu67LAksNtOEJaSTcZGLp7A4TsDDrD7KNzZBX/VmzVtF30jKHtcX+wdKVqcfizOiAeBmvkmJpdpGFsy7kSiKREq54l1ewkhfYNkbaXiYELO3SSvkxePFxXa/sZLB1VnIxv4WSL7HCPlpaNNdSo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1597967848; 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=sUR7IDboo7GrecxA9+uabpx4vhCBi+2dceKv7WvVfWI=; b=d+PpIPvwQjdPkRbawJ//gZRTvGFL2qWBwo5Z7fDZ0qxkPJ0Rm4FuLJNATttP6FDb4gwt6dWF+4YaXviOrOvHxaLkxwz8GpbJHg9hEvaECr2uO/gNpASZT8TktUQE0kRgHuTSO8Mf9jJJX20QxxoRjpuRMB8kW+Z3QAqWhE3mFAw= 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 1597967848603874.3793983882623; Thu, 20 Aug 2020 16:57:28 -0700 (PDT) Received: from localhost ([::1]:39808 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1k8uQx-0004yI-DW for importer@patchew.org; Thu, 20 Aug 2020 19:57:27 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:45988) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k8uOF-0000Os-GI; Thu, 20 Aug 2020 19:54:39 -0400 Received: from mail-wr1-x441.google.com ([2a00:1450:4864:20::441]:33403) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1k8uOD-00071e-Jd; Thu, 20 Aug 2020 19:54:39 -0400 Received: by mail-wr1-x441.google.com with SMTP id p20so371962wrf.0; Thu, 20 Aug 2020 16:54:36 -0700 (PDT) Received: from localhost.localdomain (109-186-18-89.bb.netvision.net.il. [109.186.18.89]) by smtp.gmail.com with ESMTPSA id o128sm556506wmo.39.2020.08.20.16.54.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 20 Aug 2020 16:54:34 -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=sUR7IDboo7GrecxA9+uabpx4vhCBi+2dceKv7WvVfWI=; b=qhZzI2e/IYT9QCe127JBq1W6JohxT5zKZfEzIVILEA4ROuRS9WRo3Tb6nlB/1ai2BB mFhqA+7i8GSais4EoYirrlCRGfjN/mZYu7oTfFW4LQSnIV2Onkf/M8PqxOOK2ZtiXh4L 9+pkii+rKgUAEGPMlcQa+Hc2svhMoGm/auBi4VeqQPQP4kubPjajvDV3hdmgmyEI0jkB 3c6AqlGjGwAXI6z7Pp7vG8hvEfkwOA5dXVq3ulureE9EWGCQdb0m76A8wOoqIKOp2oMQ gXhhtUVW1gRWN863TO9laBwjXzsiYKgs4b+KnuG6y5zS31QjlWqjJFSuGT/LtD1k5g+6 /+Ug== 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=sUR7IDboo7GrecxA9+uabpx4vhCBi+2dceKv7WvVfWI=; b=k4eFNXaulem5iwJSRJx/a7V3sPKYPxYHWyuKwABuT7bjasotBgvrA4qUisHV9WYcjU 43nyVNKqRUBbKDSgwN0ph31Hm1MpaD5XfT3V4xFBXDY7DeJYmKif0Tx49cVDlaHZa2nR fn3sZC+aOpUill9kZtKtTxaxnA/goSWe9GmCWs9DcALlZqvWhQzPfKgDfGeHUk250ebD oX/OX/iyTqnGOVuWgwBh7/c+E6/ngrvcjnr1ey17gjLf4t4Rmiyf1Lv5NXfZEZwWDR5i +sWWu/6QsHuVsrEY6pmj2j8Ytwu43LsdypJ36TGficGSlRvp5HqrqCn/gr9zl7Bchcfn EG3Q== X-Gm-Message-State: AOAM5321RglmJf0ys4O0pPChRA86orpr2upSfl0n+v7yqbvsmJnAHJC0 PJW/6PEH58xp5gqc96NXMAuKzuWZqqrjMTiI X-Google-Smtp-Source: ABdhPJy38bO73trNcWLwOhDTmpa5vOPLkSkQPZwCrsJns1Ix+CBhfVtLk5Us9KsyfpT0XZqZfAzqHw== X-Received: by 2002:a5d:6348:: with SMTP id b8mr158569wrw.362.1597967675561; Thu, 20 Aug 2020 16:54:35 -0700 (PDT) From: Nir Soffer X-Google-Original-From: Nir Soffer To: qemu-devel@nongnu.org Subject: [PATCH v2 3/5] qemu-iotests: Support varargs syntax in FilePaths Date: Fri, 21 Aug 2020 02:54:25 +0300 Message-Id: <20200820235427.374645-4-nsoffer@redhat.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200820235427.374645-1-nsoffer@redhat.com> References: <20200820235427.374645-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::441; envelope-from=nirsof@gmail.com; helo=mail-wr1-x441.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, URIBL_BLOCKED=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: Kevin Wolf Reviewed-by: Max Reitz --- tests/qemu-iotests/194 | 4 ++-- tests/qemu-iotests/257 | 10 ++++------ tests/qemu-iotests/iotests.py | 6 +++--- 3 files changed, 9 insertions(+), 11 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 f34a1d7ef1..cdcdc2ad8b 100644 --- a/tests/qemu-iotests/iotests.py +++ b/tests/qemu-iotests/iotests.py @@ -455,13 +455,13 @@ class FilePaths: =20 Example usage: =20 - with FilePaths(['test.img', 'test.sock']) as (img_path, sock_path): + with FilePaths('test.img', 'test.sock') as (img_path, sock_path): # Use img_path and sock_path here... =20 # img_path and sock_path are automatically removed here. =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))) @@ -482,7 +482,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 14:54:09 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=1597967789; cv=none; d=zohomail.com; s=zohoarc; b=NaJ0I1m1JkDhlv+erACMDX1Gi1nDezqd+FfCM7dz3aIFHWoXv1mlpswjATsUx3OGB5SOmhEHxKHV2M6hf1DxArlIvvxDuYq3dMfdwxdFDSV1z4oXR9LC0crTfNEwqKYypB477aWwcvhTXMDbBaRC0t60QYeTJpuHUdlFQtU+wXQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1597967789; 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=IemM2Uq8S1/BmOQeRYPD0lV6cTknW/ZTdpXLM2UH07I=; b=dg5Oxj0Kebo0KVTBzXUYK/yMekg0OWTlIAqDN9T+lel0H/9mnWPpGk5mOc2dV153q0bcjyGaQRKJyK+bTrRfyT1TfavQ6arKQmXIyLAfKfo3hw701fQ+svOefp36+3yQiYUZl98yiY94ascVBAW4MltcrhMsWY1HfVAGGi7Sq40= 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 1597967789106902.6347691882808; Thu, 20 Aug 2020 16:56:29 -0700 (PDT) Received: from localhost ([::1]:34554 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1k8uPz-0002oF-PY for importer@patchew.org; Thu, 20 Aug 2020 19:56:27 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:46016) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k8uOH-0000VS-L6; Thu, 20 Aug 2020 19:54:41 -0400 Received: from mail-wr1-x444.google.com ([2a00:1450:4864:20::444]:39488) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1k8uOF-000725-I3; Thu, 20 Aug 2020 19:54:41 -0400 Received: by mail-wr1-x444.google.com with SMTP id a5so342964wrm.6; Thu, 20 Aug 2020 16:54:38 -0700 (PDT) Received: from localhost.localdomain (109-186-18-89.bb.netvision.net.il. [109.186.18.89]) by smtp.gmail.com with ESMTPSA id o128sm556506wmo.39.2020.08.20.16.54.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 20 Aug 2020 16:54:36 -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=IemM2Uq8S1/BmOQeRYPD0lV6cTknW/ZTdpXLM2UH07I=; b=g5suQYgdTiEFWtt82U8pDCLIxl6a/9W56ol68qvg+4enbNcucQqKhAkaohrnkaJZ8T rK8KvWXA9KcffvSvM5frRCTX1LgDNiI3193Q93lDDYgnbHs5NyEKGPOqoQY9uvJLzHCN Nc+pJ7iBbRRpCkR7Y/MuHxtZ0FnhK6ljZ/VI/fw8gw4nadvriTFAj70vDd+i+GMrdIWV KV3i2eyYg8NiQMXz0LqOIrwMECnSUrCmBqkqLXnARsiaQvhopVBrauKUjcxc2ixE5yhQ h4dAbexPOahrX3kNLY51fzkQFchPgi1UZZk1dXJp7K/bHTb/o3lAGkYA8Ve4BI3jMY5v MzbA== 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=IemM2Uq8S1/BmOQeRYPD0lV6cTknW/ZTdpXLM2UH07I=; b=qk+2FPCknxvpBbgRwuQcni/MHsohsu4b1vkTWnKd3luNgD4PPLg0ws4GmiuGtCvBZU y3l7c/0lsBsAadKbV2jn0fQ+GEBK7ni/r39T0CMxmQHA/NE7OcD26Sx/pcA3sXfGy+qL hZ2L3H3ztgOx3eDboaDLi8UKN5IQu5FUKc9AYK7sdHNAq1mPfvqCZBv/Y4/bCGe4pe4r M8nIQ/mNRpjuoeSTzv/IeopvIvFTfeoYhJkh55r4n42uL1ZxLYW+s20P+6TT+RzH9g7k +I03D+iATDARX+Y4SKsbhql+GYOqvsix6G017WEuZfIP7Tnx3ke5Sk9QtUOfIiLh3WMP EZdw== X-Gm-Message-State: AOAM533wJ5ijCdaNjkYK/Kv4oJNqx2Lxf4hgw5UGRitKUz8hoMgfLGKd t4sSWNAw0+RncXuTvPsSutb8zFIssoMPXgam X-Google-Smtp-Source: ABdhPJyPo8WFg+RmMMt47KLGl9YZ7sf0r9969AmuIfRS2eoCiVAqQlY2UCzu1FC5ATAajHlW/gdeHA== X-Received: by 2002:adf:c789:: with SMTP id l9mr167455wrg.41.1597967677140; Thu, 20 Aug 2020 16:54:37 -0700 (PDT) From: Nir Soffer X-Google-Original-From: Nir Soffer To: qemu-devel@nongnu.org Subject: [PATCH v2 4/5] qemu-iotests: Merge FilePaths and FilePath Date: Fri, 21 Aug 2020 02:54:26 +0300 Message-Id: <20200820235427.374645-5-nsoffer@redhat.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200820235427.374645-1-nsoffer@redhat.com> References: <20200820235427.374645-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::444; envelope-from=nirsof@gmail.com; helo=mail-wr1-x444.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, URIBL_BLOCKED=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: Kevin Wolf 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, 16 insertions(+), 17 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 cdcdc2ad8b..1b5cdd493e 100644 --- a/tests/qemu-iotests/iotests.py +++ b/tests/qemu-iotests/iotests.py @@ -448,18 +448,23 @@ 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('test.img', 'test.sock') as (img_path, sock_path): + with FilePath('test.img', 'test.sock') as (img_path, sock_path): # Use img_path and sock_path here... =20 # img_path and sock_path are automatically removed here. =20 + For convenience, calling with one argument yields a single file instea= d of + a tuple with one item: + + with FilePath("a") as a: + """ def __init__(self, *names, base_dir=3Dtest_dir): self.paths =3D [] @@ -467,7 +472,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: @@ -477,15 +485,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 14:54:09 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=1597967779; cv=none; d=zohomail.com; s=zohoarc; b=C2/4htkCu0qy0hv5BbB8Bc5T5X+7veVSgeSmB+skDW1eR2qNa7EXixZepjZK0NPI/N83v3rvdC86qgDM8kj+Uv5VJeU44szizhhyrCCcPJUF5no5qh8m4RspDMIvuFipbSkWOrVpHWjdX3Dp0Z+HPwTv5ZDdvG3nMvKCULSjgpw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1597967779; 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=gC2hJbrUiIGgGDI/h0RY2Ob+Q69oEsfEZIUg5eipKcE=; b=N9Op0wsGVnhIbaPk67jT7FtSvJCtrMnfqJqod4enLPlvmNDnez2nhsX/+VOirToWzzRUezawIbxIkYL4t3iNrteY8KmsWACoV5YZBNlhUnkYQk0XcpSomwTqgsyj0gLrZdxI9GNcf4v/5epd2VGBCVd+aHZipGmOy/x7FYUon1Q= 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 1597967779683254.17693824355024; Thu, 20 Aug 2020 16:56:19 -0700 (PDT) Received: from localhost ([::1]:33488 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1k8uPq-0002Ok-CK for importer@patchew.org; Thu, 20 Aug 2020 19:56:18 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:46034) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k8uOI-0000Z1-VA; Thu, 20 Aug 2020 19:54:42 -0400 Received: from mail-wr1-x42e.google.com ([2a00:1450:4864:20::42e]:40129) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1k8uOG-00072R-Nu; Thu, 20 Aug 2020 19:54:42 -0400 Received: by mail-wr1-x42e.google.com with SMTP id l2so339544wrc.7; Thu, 20 Aug 2020 16:54:39 -0700 (PDT) Received: from localhost.localdomain (109-186-18-89.bb.netvision.net.il. [109.186.18.89]) by smtp.gmail.com with ESMTPSA id o128sm556506wmo.39.2020.08.20.16.54.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 20 Aug 2020 16:54:38 -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=gC2hJbrUiIGgGDI/h0RY2Ob+Q69oEsfEZIUg5eipKcE=; b=ieRnS9/t2idmp05ieVq6uL4x17BlWng5YactD6o1Co8uAuQrWnvJjydmf/Ew/chPvi 0SFn6QsG669tR6QnZGsrDz4w5B7oB/Mr2EVOqvlxRYTVX7KneE4Q9wNMQ6Z9Owz3ITIL B7MCsREhK03zGBEVUKHpWrAEVNrOIhrPY3n2TEyEYnry9gD5V2vNz2hEvC2iI7NIbMPT AyXsJ2HEo6Wr00bKv6cwKRrcdCMvcsISIsfzqmN6TO9YhPK5XfcJxVWB4ewALI2ia/Kg iDIWP5W7s87Ouk2ecvj5O75AmnTz/6rF8RLxBxW7/ANvSio1o4u6UNWKSmw6erJzT5lJ 2wzw== 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=gC2hJbrUiIGgGDI/h0RY2Ob+Q69oEsfEZIUg5eipKcE=; b=ZMbkE3rPI9bveuiakUZeiin0397gqBhuKxurH7A76Zr474pRMXquxo4g534g1evHat dmXp73xdKqkFxYf2XyojhSwKD+Bslg6XwWPbeYbeoJISEd4IW4fuEinGlvgp1iQ8ct/I V8Iro956qai3GpOeU4bq+0ohE1pgOhu1MEN6hdOwjYJhRGMIaczbpCjAj3MvMSbPjXus KaqBpba36fUPWRIKC8xLPVKjRyCkZv4l57T0eD8MyvfWy/Bag+OlbVUWrVb4JumgXStu 1fneENIsJHx4MRTWPo4CZQhbelNQNbyEF80aoFzj8wg8agdEKyQuFEYui3Wc3nIlirbr Ucjg== X-Gm-Message-State: AOAM533X0Zd+etvqO2/PI4IaVh6l6kqjdPgZSoDRNb9UlkAvIzG4kIjR 996KuERDx/5hR04Wjjag2xVu3AGQQkFsu6yN X-Google-Smtp-Source: ABdhPJxVs5mlEN5+ggQADMze65/RDrhSS/ThKeNei1G5Kmn3o0jrWbOCHZbFXZKW4DNh8+u8i54zQw== X-Received: by 2002:a5d:480b:: with SMTP id l11mr148027wrq.85.1597967678675; Thu, 20 Aug 2020 16:54:38 -0700 (PDT) From: Nir Soffer X-Google-Original-From: Nir Soffer To: qemu-devel@nongnu.org Subject: [PATCH v2 5/5] qemu-iotests: Simplify FilePath __init__ Date: Fri, 21 Aug 2020 02:54:27 +0300 Message-Id: <20200820235427.374645-6-nsoffer@redhat.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200820235427.374645-1-nsoffer@redhat.com> References: <20200820235427.374645-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::42e; envelope-from=nirsof@gmail.com; helo=mail-wr1-x42e.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, URIBL_BLOCKED=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: Kevin Wolf 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 1b5cdd493e..7ebd0bcc92 100644 --- a/tests/qemu-iotests/iotests.py +++ b/tests/qemu-iotests/iotests.py @@ -467,9 +467,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