Message ID | 20240112120737.1995575-1-james.clark@arm.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel+bounces-24639-ouuuleilei=gmail.com@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:693c:2614:b0:101:6a76:bbe3 with SMTP id mm20csp126299dyc; Fri, 12 Jan 2024 04:08:12 -0800 (PST) X-Google-Smtp-Source: AGHT+IF23d3llJ/aSttn0NCPRTG7WpTYOpVfvhyoQMl4BSGYV3ILG8XmmVDubH2Ay1/xtF7+078L X-Received: by 2002:aa7:9f12:0:b0:6d9:bf8d:e32f with SMTP id g18-20020aa79f12000000b006d9bf8de32fmr581649pfr.9.1705061292136; Fri, 12 Jan 2024 04:08:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1705061292; cv=none; d=google.com; s=arc-20160816; b=ZFT73LOlalGEKqcC0v7hzO4+nGLc7zp6/p3zXECqbsThKhoQYN/LsLgelcGxhCyfEH lO5wdgfVc7zoFeEMcJTZ8s4IKJXTWk455XXsvA0qunNov/GATDEDUztQf7EctwwnDz6y FMX4JPoVsVnFkumkStiA64mIv1tGEBntPmN4+FtIcqfdnfi9WDX/8VNcJLcI1bF8688/ Oj/OS8HuABfLIkrGAW0zdtykef1pdkME/p4zXO8IwxbPFu7xZHKFx7Kxq5CsvSlVFBLi M7PYC2xBFuG25LC45iNiR81yjJ5X9iR9K9OkRnroS1pQoeiHtA0KsJmGTYbZWTxzPNgp +xXw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from; bh=mIBgU9Z9hqZERNiDOZmnLSfxMPujhslT0NSGSc5kUVE=; fh=gBUPQDYmchJMmh0551qdgEyphsJBs1QrqiGqCoAKUks=; b=KZzlOiqr1D6CIbZkXfXHHE6fjmRz56Dd5sCL/aSeQAlLf6y+11iubOIjfz0sr+hunN P8qOHSSxdWfVKX8giMEPFqJ2I7yEH2g6iDvA/JSXQnRxzWpPX/EQLExOT6Usu4nz4Vtx PZ8kflJrI0hXeYQZMuwzzgK/OeMWCt0y2OraFBYVN19tl4G0e5z04UR9lUFjm0yIxLsb o/ai8ev1yP/UyvYR0Yl7kmgOrhOwSysWLF4nnMp0DzanM/m9wUOX58r9Y7+/3U8lqRi0 6OkVlHdNQ48P5RgTEE9etJigTtEvjfZakRAmzjCul1+dEMaYfEix94Xw5y4k/LUM6ybA gqGg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel+bounces-24639-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-24639-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id du21-20020a056a002b5500b006dabae16930si2962742pfb.102.2024.01.12.04.08.12 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 12 Jan 2024 04:08:12 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-24639-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel+bounces-24639-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-24639-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id E806D287BF2 for <ouuuleilei@gmail.com>; Fri, 12 Jan 2024 12:08:11 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id CD5FE6A03D; Fri, 12 Jan 2024 12:07:55 +0000 (UTC) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 2C0C36A011; Fri, 12 Jan 2024 12:07:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arm.com 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 6313D1FB; Fri, 12 Jan 2024 04:08:37 -0800 (PST) Received: from e127643.arm.com (unknown [10.57.91.137]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id CD8843F73F; Fri, 12 Jan 2024 04:07:47 -0800 (PST) From: James Clark <james.clark@arm.com> To: linux-perf-users@vger.kernel.org, ilkka@os.amperecomputing.com Cc: James Clark <james.clark@arm.com>, Peter Zijlstra <peterz@infradead.org>, Ingo Molnar <mingo@redhat.com>, Arnaldo Carvalho de Melo <acme@kernel.org>, Namhyung Kim <namhyung@kernel.org>, Mark Rutland <mark.rutland@arm.com>, Alexander Shishkin <alexander.shishkin@linux.intel.com>, Jiri Olsa <jolsa@kernel.org>, Ian Rogers <irogers@google.com>, Adrian Hunter <adrian.hunter@intel.com>, Athira Rajeev <atrajeev@linux.vnet.ibm.com>, Anup Sharma <anupnewsmail@gmail.com>, linux-kernel@vger.kernel.org Subject: [PATCH] perf test: Fixed masked error condition in perf data convert test Date: Fri, 12 Jan 2024 12:07:35 +0000 Message-Id: <20240112120737.1995575-1-james.clark@arm.com> X-Mailer: git-send-email 2.34.1 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: <linux-kernel.vger.kernel.org> List-Subscribe: <mailto:linux-kernel+subscribe@vger.kernel.org> List-Unsubscribe: <mailto:linux-kernel+unsubscribe@vger.kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1787886349735438113 X-GMAIL-MSGID: 1787886349735438113 |
Series |
perf test: Fixed masked error condition in perf data convert test
|
|
Commit Message
James Clark
Jan. 12, 2024, 12:07 p.m. UTC
The test does set -e, so any errors go straight to the exit handler,
where it returns err=0 (success). Fix it by leaving err=1 from the
beginning and only set the success code if it ran all the way to the end
without errors.
Also remove the exit code argument from the last exit because it doesn't
do anything, it's always replaced by err in the exit handler.
Fixes: 68d124182610 ("perf test: Add test validating JSON generated by 'perf data convert --to-json'")
Signed-off-by: James Clark <james.clark@arm.com>
---
tools/perf/tests/shell/test_perf_data_converter_json.sh | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
Comments
On Fri, Jan 12, 2024 at 4:07 AM James Clark <james.clark@arm.com> wrote: > > The test does set -e, so any errors go straight to the exit handler, > where it returns err=0 (success). Fix it by leaving err=1 from the > beginning and only set the success code if it ran all the way to the end > without errors. > > Also remove the exit code argument from the last exit because it doesn't > do anything, it's always replaced by err in the exit handler. > > Fixes: 68d124182610 ("perf test: Add test validating JSON generated by 'perf data convert --to-json'") > Signed-off-by: James Clark <james.clark@arm.com> Acked-by: Namhyung Kim <namhyung@kernel.org> Thanks, Namhyung > --- > tools/perf/tests/shell/test_perf_data_converter_json.sh | 9 +++++---- > 1 file changed, 5 insertions(+), 4 deletions(-) > > diff --git a/tools/perf/tests/shell/test_perf_data_converter_json.sh b/tools/perf/tests/shell/test_perf_data_converter_json.sh > index c4f1b59d116f..1781b7215c11 100755 > --- a/tools/perf/tests/shell/test_perf_data_converter_json.sh > +++ b/tools/perf/tests/shell/test_perf_data_converter_json.sh > @@ -4,7 +4,7 @@ > > set -e > > -err=0 > +err=1 > > shelldir=$(dirname "$0") > # shellcheck source=lib/setup_python.sh > @@ -36,7 +36,6 @@ test_json_converter_command() > echo "Perf Data Converter Command to JSON [SUCCESS]" > else > echo "Perf Data Converter Command to JSON [FAILED]" > - err=1 > exit > fi > } > @@ -49,7 +48,6 @@ validate_json_format() > echo "The file contains valid JSON format [SUCCESS]" > else > echo "The file does not contain valid JSON format [FAILED]" > - err=1 > exit > fi > else > @@ -62,4 +60,7 @@ validate_json_format() > test_json_converter_command > validate_json_format > > -exit ${err} > +# Set -e is on, so it was only successful if it ran up to this point. > +# Therefore only set err=0 here. > +err=0 > +exit > -- > 2.34.1 >
On Fri, 12 Jan 2024, James Clark wrote: > The test does set -e, so any errors go straight to the exit handler, > where it returns err=0 (success). Fix it by leaving err=1 from the > beginning and only set the success code if it ran all the way to the end > without errors. > > Also remove the exit code argument from the last exit because it doesn't > do anything, it's always replaced by err in the exit handler. > > Fixes: 68d124182610 ("perf test: Add test validating JSON generated by 'perf data convert --to-json'") > Signed-off-by: James Clark <james.clark@arm.com> Looks good to me. Reviewed-by: Ilkka Koskinen <ilkka@os.amperecomputing.com> Cheers, Ilkka > --- > tools/perf/tests/shell/test_perf_data_converter_json.sh | 9 +++++---- > 1 file changed, 5 insertions(+), 4 deletions(-) > > diff --git a/tools/perf/tests/shell/test_perf_data_converter_json.sh b/tools/perf/tests/shell/test_perf_data_converter_json.sh > index c4f1b59d116f..1781b7215c11 100755 > --- a/tools/perf/tests/shell/test_perf_data_converter_json.sh > +++ b/tools/perf/tests/shell/test_perf_data_converter_json.sh > @@ -4,7 +4,7 @@ > > set -e > > -err=0 > +err=1 > > shelldir=$(dirname "$0") > # shellcheck source=lib/setup_python.sh > @@ -36,7 +36,6 @@ test_json_converter_command() > echo "Perf Data Converter Command to JSON [SUCCESS]" > else > echo "Perf Data Converter Command to JSON [FAILED]" > - err=1 > exit > fi > } > @@ -49,7 +48,6 @@ validate_json_format() > echo "The file contains valid JSON format [SUCCESS]" > else > echo "The file does not contain valid JSON format [FAILED]" > - err=1 > exit > fi > else > @@ -62,4 +60,7 @@ validate_json_format() > test_json_converter_command > validate_json_format > > -exit ${err} > +# Set -e is on, so it was only successful if it ran up to this point. > +# Therefore only set err=0 here. > +err=0 > +exit > -- > 2.34.1 > >
diff --git a/tools/perf/tests/shell/test_perf_data_converter_json.sh b/tools/perf/tests/shell/test_perf_data_converter_json.sh index c4f1b59d116f..1781b7215c11 100755 --- a/tools/perf/tests/shell/test_perf_data_converter_json.sh +++ b/tools/perf/tests/shell/test_perf_data_converter_json.sh @@ -4,7 +4,7 @@ set -e -err=0 +err=1 shelldir=$(dirname "$0") # shellcheck source=lib/setup_python.sh @@ -36,7 +36,6 @@ test_json_converter_command() echo "Perf Data Converter Command to JSON [SUCCESS]" else echo "Perf Data Converter Command to JSON [FAILED]" - err=1 exit fi } @@ -49,7 +48,6 @@ validate_json_format() echo "The file contains valid JSON format [SUCCESS]" else echo "The file does not contain valid JSON format [FAILED]" - err=1 exit fi else @@ -62,4 +60,7 @@ validate_json_format() test_json_converter_command validate_json_format -exit ${err} +# Set -e is on, so it was only successful if it ran up to this point. +# Therefore only set err=0 here. +err=0 +exit