* [PATCH 1/2] libperf tests: If a test fails return non-zero
@ 2021-01-14 18:02 Ian Rogers
2021-01-14 18:02 ` [PATCH 2/2] libperf tests: Fail when failing to get a tracepoint id Ian Rogers
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Ian Rogers @ 2021-01-14 18:02 UTC (permalink / raw)
To: Peter Zijlstra, Ingo Molnar, Arnaldo Carvalho de Melo,
Mark Rutland, Alexander Shishkin, Jiri Olsa, Namhyung Kim,
linux-kernel
Cc: Stephane Eranian, Ian Rogers
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@google.com>
---
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
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH 2/2] libperf tests: Fail when failing to get a tracepoint id
2021-01-14 18:02 [PATCH 1/2] libperf tests: If a test fails return non-zero Ian Rogers
@ 2021-01-14 18:02 ` Ian Rogers
2021-01-15 8:57 ` [PATCH 1/2] libperf tests: If a test fails return non-zero Jiri Olsa
2021-01-15 18:59 ` Arnaldo Carvalho de Melo
2 siblings, 0 replies; 4+ messages in thread
From: Ian Rogers @ 2021-01-14 18:02 UTC (permalink / raw)
To: Peter Zijlstra, Ingo Molnar, Arnaldo Carvalho de Melo,
Mark Rutland, Alexander Shishkin, Jiri Olsa, Namhyung Kim,
linux-kernel
Cc: Stephane Eranian, Ian Rogers
Permissions are necessary to get a tracepoint id. Fail the test when the
read fails.
Signed-off-by: Ian Rogers <irogers@google.com>
---
tools/lib/perf/tests/test-evlist.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/tools/lib/perf/tests/test-evlist.c b/tools/lib/perf/tests/test-evlist.c
index d913241d4135..bd19cabddaf6 100644
--- a/tools/lib/perf/tests/test-evlist.c
+++ b/tools/lib/perf/tests/test-evlist.c
@@ -215,6 +215,7 @@ static int test_mmap_thread(void)
sysfs__mountpoint());
if (filename__read_int(path, &id)) {
+ tests_failed++;
fprintf(stderr, "error: failed to get tracepoint id: %s\n", path);
return -1;
}
--
2.30.0.284.gd98b1dd5eaa7-goog
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH 1/2] libperf tests: If a test fails return non-zero
2021-01-14 18:02 [PATCH 1/2] libperf tests: If a test fails return non-zero Ian Rogers
2021-01-14 18:02 ` [PATCH 2/2] libperf tests: Fail when failing to get a tracepoint id Ian Rogers
@ 2021-01-15 8:57 ` Jiri Olsa
2021-01-15 18:59 ` Arnaldo Carvalho de Melo
2 siblings, 0 replies; 4+ messages in thread
From: Jiri Olsa @ 2021-01-15 8:57 UTC (permalink / raw)
To: Ian Rogers
Cc: Peter Zijlstra, Ingo Molnar, Arnaldo Carvalho de Melo,
Mark Rutland, Alexander Shishkin, Namhyung Kim, linux-kernel,
Stephane Eranian
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@google.com>
for the patchset
Acked-by: Jiri Olsa <jolsa@redhat.com>
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
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 1/2] libperf tests: If a test fails return non-zero
2021-01-14 18:02 [PATCH 1/2] libperf tests: If a test fails return non-zero Ian Rogers
2021-01-14 18:02 ` [PATCH 2/2] libperf tests: Fail when failing to get a tracepoint id Ian Rogers
2021-01-15 8:57 ` [PATCH 1/2] libperf tests: If a test fails return non-zero Jiri Olsa
@ 2021-01-15 18:59 ` Arnaldo Carvalho de Melo
2 siblings, 0 replies; 4+ messages in thread
From: Arnaldo Carvalho de Melo @ 2021-01-15 18:59 UTC (permalink / raw)
To: Ian Rogers
Cc: Peter Zijlstra, Ingo Molnar, Mark Rutland, Alexander Shishkin,
Jiri Olsa, Namhyung Kim, linux-kernel, Stephane Eranian
Em Thu, Jan 14, 2021 at 10:02:49AM -0800, Ian Rogers escreveu:
> If a test fails return -1 rather than 0. This is consistent with the
> return value in test-cpumap.c
Thanks, applied both patches.
- Arnaldo
> Signed-off-by: Ian Rogers <irogers@google.com>
> ---
> 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
>
--
- Arnaldo
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2021-01-15 18:59 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-01-14 18:02 [PATCH 1/2] libperf tests: If a test fails return non-zero Ian Rogers
2021-01-14 18:02 ` [PATCH 2/2] libperf tests: Fail when failing to get a tracepoint id Ian Rogers
2021-01-15 8:57 ` [PATCH 1/2] libperf tests: If a test fails return non-zero Jiri Olsa
2021-01-15 18:59 ` Arnaldo Carvalho de Melo
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox