linux-perf-users.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ilkka Koskinen <ilkka@os.amperecomputing.com>
To: James Clark <james.clark@arm.com>
Cc: linux-perf-users@vger.kernel.org, ilkka@os.amperecomputing.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: Re: [PATCH] perf test: Fixed masked error condition in perf data convert test
Date: Tue, 16 Jan 2024 23:37:34 -0800 (PST)	[thread overview]
Message-ID: <726d2423-13a-010-e72e-8d3366f9c542@os.amperecomputing.com> (raw)
In-Reply-To: <20240112120737.1995575-1-james.clark@arm.com>



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
>
>

      parent reply	other threads:[~2024-01-17  7:37 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-12 12:07 [PATCH] perf test: Fixed masked error condition in perf data convert test James Clark
2024-01-16 21:54 ` Namhyung Kim
2024-01-17  7:37 ` Ilkka Koskinen [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=726d2423-13a-010-e72e-8d3366f9c542@os.amperecomputing.com \
    --to=ilkka@os.amperecomputing.com \
    --cc=acme@kernel.org \
    --cc=adrian.hunter@intel.com \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=anupnewsmail@gmail.com \
    --cc=atrajeev@linux.vnet.ibm.com \
    --cc=irogers@google.com \
    --cc=james.clark@arm.com \
    --cc=jolsa@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-perf-users@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=mingo@redhat.com \
    --cc=namhyung@kernel.org \
    --cc=peterz@infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).