Re: [PATCH 1/2] libperf tests: If a test fails return non-zero

From: Jiri Olsa
Date: Fri Jan 15 2021 - 03:59:28 EST


On Thu, Jan 14, 2021 at 10:02:49AM -0800, Ian Rogers wrote:
> If a test fails return -1 rather than 0. This is consistent with the
> return value in test-cpumap.c
>
> Signed-off-by: Ian Rogers <irogers@xxxxxxxxxx>

for the patchset

Acked-by: Jiri Olsa <jolsa@xxxxxxxxxx>

thanks,
jirka

> ---
> tools/lib/perf/tests/test-cpumap.c | 2 +-
> tools/lib/perf/tests/test-evlist.c | 2 +-
> tools/lib/perf/tests/test-evsel.c | 2 +-
> tools/lib/perf/tests/test-threadmap.c | 2 +-
> 4 files changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/tools/lib/perf/tests/test-cpumap.c b/tools/lib/perf/tests/test-cpumap.c
> index c8d45091e7c2..c70e9e03af3e 100644
> --- a/tools/lib/perf/tests/test-cpumap.c
> +++ b/tools/lib/perf/tests/test-cpumap.c
> @@ -27,5 +27,5 @@ int main(int argc, char **argv)
> perf_cpu_map__put(cpus);
>
> __T_END;
> - return 0;
> + return tests_failed == 0 ? 0 : -1;
> }
> diff --git a/tools/lib/perf/tests/test-evlist.c b/tools/lib/perf/tests/test-evlist.c
> index 6d8ebe0c2504..d913241d4135 100644
> --- a/tools/lib/perf/tests/test-evlist.c
> +++ b/tools/lib/perf/tests/test-evlist.c
> @@ -409,5 +409,5 @@ int main(int argc, char **argv)
> test_mmap_cpus();
>
> __T_END;
> - return 0;
> + return tests_failed == 0 ? 0 : -1;
> }
> diff --git a/tools/lib/perf/tests/test-evsel.c b/tools/lib/perf/tests/test-evsel.c
> index 135722ac965b..0ad82d7a2a51 100644
> --- a/tools/lib/perf/tests/test-evsel.c
> +++ b/tools/lib/perf/tests/test-evsel.c
> @@ -131,5 +131,5 @@ int main(int argc, char **argv)
> test_stat_thread_enable();
>
> __T_END;
> - return 0;
> + return tests_failed == 0 ? 0 : -1;
> }
> diff --git a/tools/lib/perf/tests/test-threadmap.c b/tools/lib/perf/tests/test-threadmap.c
> index 7dc4d6fbedde..384471441b48 100644
> --- a/tools/lib/perf/tests/test-threadmap.c
> +++ b/tools/lib/perf/tests/test-threadmap.c
> @@ -27,5 +27,5 @@ int main(int argc, char **argv)
> perf_thread_map__put(threads);
>
> __T_END;
> - return 0;
> + return tests_failed == 0 ? 0 : -1;
> }
> --
> 2.30.0.284.gd98b1dd5eaa7-goog
>