From nobody Fri Apr 19 03:35:52 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=patchew-devel-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=patchew-devel-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1534581116248556.0170468519614; Sat, 18 Aug 2018 01:31:56 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 85037C049E0F; Sat, 18 Aug 2018 08:31:54 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 6DA7816C04; Sat, 18 Aug 2018 08:31:54 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 53EE14BB78; Sat, 18 Aug 2018 08:31:54 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w7I8VqD1012358 for ; Sat, 18 Aug 2018 04:31:52 -0400 Received: by smtp.corp.redhat.com (Postfix) id 5F246308BDA3; Sat, 18 Aug 2018 08:31:52 +0000 (UTC) Received: from mx1.redhat.com (ext-mx18.extmail.prod.ext.phx2.redhat.com [10.5.110.47]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 57AB1308BDA2 for ; Sat, 18 Aug 2018 08:31:49 +0000 (UTC) Received: from mail-wm0-f68.google.com (mail-wm0-f68.google.com [74.125.82.68]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id E1E8730820D7 for ; Sat, 18 Aug 2018 08:31:47 +0000 (UTC) Received: by mail-wm0-f68.google.com with SMTP id c14-v6so9574353wmb.4 for ; Sat, 18 Aug 2018 01:31:47 -0700 (PDT) Received: from donizetti.lan (dynamic-adsl-78-12-184-244.clienti.tiscali.it. [78.12.184.244]) by smtp.gmail.com with ESMTPSA id a37-v6sm7511239wrc.21.2018.08.18.01.31.45 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sat, 18 Aug 2018 01:31:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:subject:date:message-id; bh=z6/KE3L3mJFI2tscCfsr8GxwRETE5FPesWPDAPui8jQ=; b=mSeyYBg2OmbkLsENTIE2k+8HOj817EOfjQ85tzNwzOXTu41QK2ZUhQ2xT/xF7/7hqf W+VhwHLJoOL1Ba5w6UcLec5Y+GsW3OnWS+/N7/NS6CyyM5IAw8fTz4G52MPtgZUxvpNE kRiTUpRKqWsTEOm0JM/C4CKTfqB2EhGpbSV1+jfdFSYKXQyt2vZUTiVw6CpFf5an4YAg C9S2NL9W1hBKJV5xmY3vFgDCTwIBjl9J+NN8VDeyzDhjY+NrIO9LQ/+S5h86JgV1pbnY G55LHIzYQYa0UQQw26ph7pRykpK7NcbBQmLQ374Fy15S67U+XqvCUh35l5N5x8VUkItB JMhQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:subject:date:message-id; bh=z6/KE3L3mJFI2tscCfsr8GxwRETE5FPesWPDAPui8jQ=; b=RVfO7SjFmyCUObY/Vwm3CSngofI6WkgI6/AVvNnJNLoi6Cf7UhmGkIiK51HakrleMX TRxq9NOQ/UvBvLJe+UmpIxrs52KjHEolDxo2iQpEsX1eqSjDUaWdmRwEN5b83TS8C9bf QGVsBVyX5sKjttK1y/aySJ2Wg49WbtrVnyo4/k2+xEem4T93E8Xkq/VeawwSdPEdyl/5 qtigEjFsM6+agcNGviPuUW1O59ZVrenV+sw7tiP0dCHgZGgJYjSzirxxAK9PyZbYNCmZ /rH7DdEb6nisr/+IHnrY6/hEd719BNPuRaBHNU5zlHiD9dqC8yAojIvF91uYZvPlnMj7 1yGA== X-Gm-Message-State: AOUpUlHuVSl/S2n7VQeIkdJxhI/9L/a/BHFlfGwJ86V9P8rZZtpCswi+ EpVG58B5KUfmdAT21fDA7pLJG7fI X-Google-Smtp-Source: AA+uWPwG/pNmHs44D+LuRzNwA9LkRcp9DyR638e9Bz/EtzN7QkfPg6tw68DmGtx5WBiJgA/p1bNXgQ== X-Received: by 2002:a1c:ea9c:: with SMTP id g28-v6mr20962401wmi.65.1534581106413; Sat, 18 Aug 2018 01:31:46 -0700 (PDT) From: Paolo Bonzini To: patchew-devel@redhat.com Date: Sat, 18 Aug 2018 10:31:45 +0200 Message-Id: <20180818083145.16505-1-pbonzini@redhat.com> X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.47]); Sat, 18 Aug 2018 08:31:48 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.47]); Sat, 18 Aug 2018 08:31:48 +0000 (UTC) for IP:'74.125.82.68' DOMAIN:'mail-wm0-f68.google.com' HELO:'mail-wm0-f68.google.com' FROM:'paolo.bonzini@gmail.com' RCPT:'' X-RedHat-Spam-Score: -0.028 (DKIM_SIGNED, DKIM_VALID, FREEMAIL_FORGED_FROMDOMAIN, FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_PASS) 74.125.82.68 mail-wm0-f68.google.com 74.125.82.68 mail-wm0-f68.google.com X-RedHat-Possible-Forgery: Paolo Bonzini X-Scanned-By: MIMEDefang 2.84 on 10.5.110.47 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.24 X-loop: patchew-devel@redhat.com Subject: [Patchew-devel] [PATCH] patchew-cli: tester: add subcommand to print capabilities of the current host X-BeenThere: patchew-devel@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Patchew development and discussion list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: patchew-devel-bounces@redhat.com Errors-To: patchew-devel-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Sat, 18 Aug 2018 08:31:54 +0000 (UTC) X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDMRC_0 RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" This can be useful for debugging. Signed-off-by: Paolo Bonzini Reviewed-by: Fam Zheng --- patchew-cli | 16 +++++++++++++--- tests/test_testing.py | 8 ++++++++ 2 files changed, 21 insertions(+), 3 deletions(-) diff --git a/patchew-cli b/patchew-cli index f4539a7..c67abd5 100755 --- a/patchew-cli +++ b/patchew-cli @@ -446,6 +446,8 @@ class TesterCommand(SubCommand): want_argv =3D True =20 def arguments(self, parser): + parser.add_argument("--print-capabilities", action=3D"store_true", + help=3D"print capabilities for the current mac= hine") parser.add_argument("--singleton", "-S", action=3D"store_true", help=3D"quit if another singleton mode tester = is running") parser.add_argument("--project", "-p", required=3DTrue, @@ -591,14 +593,22 @@ class TesterCommand(SubCommand): =20 def do(self, args, argv): # Make sure git works + projects =3D [x.strip() for x in args.project.split(",") if len(x.= strip())] + if not projects: + raise Exception("No project specified") + if args.print_capabilities: + if len(projects) > 1: + print("Only one project is allowed for --print-capabilitie= s") + return 1 + caps =3D self._refresh_capabilities(projects[0], args.name) + for i in caps: + print(i) + return 0 if args.singleton: self._check_singleton() subprocess.check_output(["git", "version"]) count =3D 0 cap_refresh =3D 10 - projects =3D [x.strip() for x in args.project.split(",") if len(x.= strip())] - if not projects: - raise Exception("No project specified") capabilities =3D {} while True: progress =3D False diff --git a/tests/test_testing.py b/tests/test_testing.py index 1284498..93aaf8b 100755 --- a/tests/test_testing.py +++ b/tests/test_testing.py @@ -237,6 +237,14 @@ class TesterTest(PatchewTestCase): cwd=3Dself.repo).decode() p.set_property("git.head", head) =20 + def test_print_capability(self): + self.cli_login() + out, err =3D self.check_cli(["tester", "-p", "ALLOW", "--print-cap= abilities"]) + self.assertEqual(out, 'allow') + out, err =3D self.check_cli(["tester", "-p", "DENY", "--print-capa= bilities"]) + self.assertEqual(out, '') + self.cli_logout() + def test_tester(self): self.cli_login() out, err =3D self.check_cli(["tester", "-p", "QEMU,UMEQ,ALLOW,DENY= ", --=20 2.17.1 _______________________________________________ Patchew-devel mailing list Patchew-devel@redhat.com https://www.redhat.com/mailman/listinfo/patchew-devel