libperf tests: If a test fails return non-zero
Ian Rogers
reviewerPATCH 1/2 libperf tests: If a test fails return non-zero
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 <[email protected]>
--- 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(-)
tools/lib/perf/tests/test-cpumap.c +1 -1
@@ -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 ; }
tools/lib/perf/tests/test-evlist.c +1 -1
@@ -409,5 +409,5 @@ int main(int argc, char **argv)test_mmap_cpus (); __T_END; -return 0 ; +return tests_failed ==0 ?0 :-1 ; }
tools/lib/perf/tests/test-evsel.c +1 -1
@@ -131,5 +131,5 @@ int main(int argc, char **argv)test_stat_thread_enable (); __T_END; -return 0 ; +return tests_failed ==0 ?0 :-1 ; }
tools/lib/perf/tests/test-threadmap.c +1 -1
@@ -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 ; }
Signature · 1 line
2.30.0.284.gd98b1dd5eaa7-goog
Ian Rogers
reviewerPATCH 2/2 libperf tests: Fail when failing to get a tracepoint id
Permissions are necessary to get a tracepoint id. Fail the test when the read fails.
Signed-off-by Ian Rogers <[email protected]>
--- tools/lib/perf/tests/test-evlist.c | 1 + 1 file changed, 1 insertion(+)
tools/lib/perf/tests/test-evlist.c +1 -0
@@ -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 ; }
Signature · 1 line
2.30.0.284.gd98b1dd5eaa7-goog
Quoted 4 lines · Ian Rogers
If a test fails return -1 rather than 0. This is consistent with the return value in
test-cpumap.cSigned-off-by Ian Rogers <[email protected]>
for the patchset
Acked-by Jiri Olsa <[email protected]>
thanks,
jirka
Quoted 54 lines
--- 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(-)tools/lib/perf/tests/test-cpumap.c +1
-1@@ -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 ; }tools/lib/perf/tests/test-evlist.c +1
-1@@ -409,5 +409,5 @@ int main(int argc, char **argv)test_mmap_cpus (); __T_END; -return 0 ; +return tests_failed ==0 ?0 :-1 ; }tools/lib/perf/tests/test-evsel.c +1
-1@@ -131,5 +131,5 @@ int main(int argc, char **argv)test_stat_thread_enable (); __T_END; -return 0 ; +return tests_failed ==0 ?0 :-1 ; }tools/lib/perf/tests/test-threadmap.c +1
-1@@ -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 ; }Signature · 1 line
2.30.0.284.gd98b1dd5eaa7-goog
Em Thu, Jan 14, 2021 at 10:02:49AM -0800, Ian Rogers escreveu:
Quoted 2 lines
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
Quoted 55 lines
Signed-off-by Ian Rogers <[email protected]>--- 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(-)tools/lib/perf/tests/test-cpumap.c +1
-1@@ -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 ; }tools/lib/perf/tests/test-evlist.c +1
-1@@ -409,5 +409,5 @@ int main(int argc, char **argv)test_mmap_cpus (); __T_END; -return 0 ; +return tests_failed ==0 ?0 :-1 ; }tools/lib/perf/tests/test-evsel.c +1
-1@@ -131,5 +131,5 @@ int main(int argc, char **argv)test_stat_thread_enable (); __T_END; -return 0 ; +return tests_failed ==0 ?0 :-1 ; }tools/lib/perf/tests/test-threadmap.c +1
-1@@ -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 ; }Signature · 1 line
2.30.0.284.gd98b1dd5eaa7-goog
Signature · 1 line
- Arnaldo