Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp8284198rwb; Tue, 13 Dec 2022 04:41:51 -0800 (PST) X-Google-Smtp-Source: AA0mqf5H6Hl+Gy8qbxpo94EFx0a11yHUQPwyGsoGpuAgoDzU8c4KiJnE7LhsM85bONKYnwLU7Cqb X-Received: by 2002:a17:906:5402:b0:7be:ac3d:f67c with SMTP id q2-20020a170906540200b007beac3df67cmr16481548ejo.44.1670935311228; Tue, 13 Dec 2022 04:41:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670935311; cv=none; d=google.com; s=arc-20160816; b=O82/X4/4YMEA1M0Ui5v1j9pZjBnMF6tv5VNXYSB/Y24raMiKdB8atw9JN7F477KpRG aAJmJDDTwj34Axf5i72oO4gUZkXDyGmhcYWrd9G1EzeUBOnvO2hEdSkNZ1E5hHXSaZ06 GWdj5TKYTjgZIH6V3lH6TjkyPf0hT3PXu4JBJCQipRp7BwIeOvRlMSm+7rBn6nSRkpmF PSzxCSevrI/Bdt0qO2dle5f1I2Js5SOzav4Ki1tK2xQjxX+6WpIP4VKtmtb6UJOfQKm+ 75PWAr6skuN/XH/bmJtRWn2LVDyo7hR28NhfPymGUm11Sgxmp/CDANMqYTTcfyCpapgg vrbg== 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id dm22-20020a170907949600b007ae9bc0b977si421255ejc.486.2022.12.13.04.41.33; Tue, 13 Dec 2022 04:41:51 -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 + 73 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 Content-Transfer-Encoding: 8bit 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 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 = {} -- 2.25.1