From patchwork Tue Dec 13 11:47:36 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Clark X-Patchwork-Id: 32775 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:e747:0:0:0:0:0 with SMTP id c7csp69518wrn; Tue, 13 Dec 2022 03:54:56 -0800 (PST) X-Google-Smtp-Source: AA0mqf4q4iAh2WvKznZ2Mch81svcNnwpc1nn9mkuKlY1mBz89ylbpmsXTyA34PQXjFsYFnSFL1aO X-Received: by 2002:a05:6a20:9594:b0:a3:aabe:54b8 with SMTP id iu20-20020a056a20959400b000a3aabe54b8mr23671410pzb.38.1670932495751; Tue, 13 Dec 2022 03:54:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670932495; cv=none; d=google.com; s=arc-20160816; b=FI/HhKQjSxZts0K0W8fxb0E2LzLOd4eCXmyiCOn/a3YUFvI2Xn8OiERzdwzONgilQp xww2OrrytH4vILNwhOEwJ3O6t5tNDk5TxXrQqUCVVutzsH4K+Dj08RHQ9iXlo0i+sR0s BUw38QeXv0MNK61ztugJUdVDwz9NlBjRXfWodMZICbibCcp9055q451FG3Zw7d+lDj+s t1PWXp5pKxCuYVKdSC5E8EbLiPHfTyELTG4qrb2t7rxGnGrySs/EmorHm6TNA0eci9bn XZZe8AScsgI6/HRhKrb10eAIaP43KaVN30we+P5RrmHmyucEH/Oy1IqDUh53zfo682ea N/8A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=k9fWIRSYB8bpTYlURR2842NnJ0+NscShFSnXz6Rc7Rk=; b=xwBjkSncYJ4bB8eWbEBI5w+EC0MqgM86u362K1JaIFYKbvSVMiI/te2xxdQFXUdJzf nRDeaJABx0FbHK/6DXnSmc1aKDq+PLmahfcpOGTVFKnsSuPDrxcza2cOBIRQEXLubdFK Y1LqF1nCXJVnbbCwh9r+peY7DmClU8NAlUE3bLayinjmsZ8CEI7uVS1quFw5Z6IyPfby s+StnI/bKob0dZEyt29HpeJIdGs5SEAMutToLprAG8ZQXTlGX1ylWS5c+KeaNqX/Sn5H 2gOUCU7Zb8ojuXYlBeXxVCsQcMhzBJnffXp5xdRp+XvFaj8k9wGMbuBX68hkE88/v7o5 P/RA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id c17-20020a631c11000000b00438766f903asi11627778pgc.490.2022.12.13.03.54.42; Tue, 13 Dec 2022 03:54:55 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235280AbiLMLud (ORCPT + 99 others); Tue, 13 Dec 2022 06:50:33 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44858 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235274AbiLMLu0 (ORCPT ); Tue, 13 Dec 2022 06:50:26 -0500 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id A4B6510FFE; Tue, 13 Dec 2022 03:50:24 -0800 (PST) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id DEC191682; Tue, 13 Dec 2022 03:51:04 -0800 (PST) Received: from e126815.warwick.arm.com (e126815.arm.com [10.32.32.26]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id BB3683F5A1; Tue, 13 Dec 2022 03:50:22 -0800 (PST) From: James Clark To: linux-perf-users@vger.kernel.org Cc: James Clark , Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Mark Rutland , Alexander Shishkin , Jiri Olsa , Namhyung Kim , linux-kernel@vger.kernel.org, bpf@vger.kernel.org Subject: [PATCH v2 1/4] perf test: Add ability to test exit code for attr tests Date: Tue, 13 Dec 2022 11:47:36 +0000 Message-Id: <20221213114739.2312862-2-james.clark@arm.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221213114739.2312862-1-james.clark@arm.com> References: <20221213114739.2312862-1-james.clark@arm.com> MIME-Version: 1.0 X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1752099712491309981?= X-GMAIL-MSGID: =?utf-8?q?1752099712491309981?= Currently the return value is used to skip the test, but sometimes it can be useful to test if a certain command should return a certain exit code. Signed-off-by: James Clark --- tools/perf/tests/attr.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/tools/perf/tests/attr.py b/tools/perf/tests/attr.py index cb39ac46bc73..cf40df472918 100644 --- a/tools/perf/tests/attr.py +++ b/tools/perf/tests/attr.py @@ -129,7 +129,8 @@ class Event(dict): # - needs to specify: # 'command' - perf command name # 'args' - special command arguments -# 'ret' - expected command return value (0 by default) +# 'ret' - Skip test if Perf doesn't exit with this value (0 by default) +# 'test_ret'- If set to 'true', fail test instead of skipping for 'ret' argument # 'arch' - architecture specific test (optional) # comma separated list, ! at the beginning # negates it. @@ -155,6 +156,8 @@ class Test(object): except: self.ret = 0 + self.test_ret = parser.getboolean('config', 'test_ret', fallback=False) + try: self.arch = parser.get('config', 'arch') log.warning("test limitation '%s'" % self.arch) @@ -232,7 +235,10 @@ class Test(object): log.info(" '%s' ret '%s', expected '%s'" % (cmd, str(ret), str(self.ret))) if not data_equal(str(ret), str(self.ret)): - raise Unsup(self) + if self.test_ret: + raise Fail(self, "Perf exit code failure") + else: + raise Unsup(self) def compare(self, expect, result): match = {}