From nobody Thu Dec 25 17:55:21 2025 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 To: linux-perf-users@vger.kernel.org, ilkka@os.amperecomputing.com Cc: James Clark , Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Namhyung Kim , Mark Rutland , Alexander Shishkin , Jiri Olsa , Ian Rogers , Adrian Hunter , Athira Rajeev , Anup Sharma , 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: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" The test does set -e, so any errors go straight to the exit handler, where it returns err=3D0 (success). Fix it by leaving err=3D1 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 'per= f data convert --to-json'") Signed-off-by: James Clark Acked-by: Namhyung Kim Reviewed-by: Ilkka Koskinen --- 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/tool= s/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 @@ =20 set -e =20 -err=3D0 +err=3D1 =20 shelldir=3D$(dirname "$0") # shellcheck source=3Dlib/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=3D1 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=3D1 exit fi else @@ -62,4 +60,7 @@ validate_json_format() test_json_converter_command validate_json_format =20 -exit ${err} +# Set -e is on, so it was only successful if it ran up to this point. +# Therefore only set err=3D0 here. +err=3D0 +exit --=20 2.34.1