Received: by 2002:a05:7412:e794:b0:fa:551:50a7 with SMTP id o20csp2247414rdd; Fri, 12 Jan 2024 04:08:04 -0800 (PST) X-Google-Smtp-Source: AGHT+IFwUhAJsqYbYp60FhvoiWOlfsvl/nnk3BLGJI98zcOn82+pUpmyNI34iwpnsfCzQjAdxHuS X-Received: by 2002:a05:6402:cba:b0:558:24da:1c41 with SMTP id cn26-20020a0564020cba00b0055824da1c41mr1354224edb.8.1705061284711; Fri, 12 Jan 2024 04:08:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1705061284; cv=none; d=google.com; s=arc-20160816; b=dSzXgCeuJheVct8/cNs4TXh6P+60AVfaflGIlX1cRgNwns58CTJMr/aSmgO4stM3eG Wmholh//fyVflDV2/32QCtXDkIBRJZkOKjeXnjCJEs4uc2cSbBZeoMOY1Iw+Ls0C9Fph IvgaFiUXgZtVk6c9eTbanB5tEHe0Us/ShAb1wWPRsGs0GrzmM2Wb6kY7h3ABHnH7QxAO RXaBtgFSXPpCkkTdSFEu7piGUsVT9o2Q6XeaLp5Vl5PqgO8z+SWsfglDkLfwDrq798NL TuyscGENVHC9MsQC+kfGuqqCP+i288NpKVBjZHCEAaOQQlCqTnTTjgJfpJjGEvauU8ev S6SQ== 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-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-24639-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id a9-20020a50e709000000b00558042d24f1si1334713edn.167.2024.01.12.04.08.04 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 12 Jan 2024 04:08:04 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-24639-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel+bounces-24639-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-24639-linux.lists.archive=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 am.mirrors.kernel.org (Postfix) with ESMTPS id 733921F22AA9 for ; Fri, 12 Jan 2024 12:08:04 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id CA4616A02A; Fri, 12 Jan 2024 12:07:54 +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 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: 8bit 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 --- 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