diff options
author | Ingo Molnar <mingo@kernel.org> | 2013-10-02 09:48:49 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@kernel.org> | 2013-10-09 02:48:58 -0400 |
commit | 1e3f30fae797660a014ac159d93fff9952ec1bf0 (patch) | |
tree | 026d1568a758f195d5176f3791456ba78c0bbede /tools/perf/config/feature-checks | |
parent | 0648f839ff754e2825fee2cb7080df5874316b3f (diff) |
tools/perf/build: Clean up various testcases
Prepare to include them into test-all.c directly, by making sure
that they build cleanly and without warnings.
Also make sure they make a certain amount of sense and don't crash
when executed.
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: David Ahern <dsahern@gmail.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Link: http://lkml.kernel.org/n/tip-Mn9gsdutzopoowk3xurqpsxE@git.kernel.org
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'tools/perf/config/feature-checks')
8 files changed, 46 insertions, 9 deletions
diff --git a/tools/perf/config/feature-checks/test-backtrace.c b/tools/perf/config/feature-checks/test-backtrace.c index 5b79468bea2a..5b33bcf12c27 100644 --- a/tools/perf/config/feature-checks/test-backtrace.c +++ b/tools/perf/config/feature-checks/test-backtrace.c | |||
@@ -3,8 +3,12 @@ | |||
3 | 3 | ||
4 | int main(void) | 4 | int main(void) |
5 | { | 5 | { |
6 | backtrace(NULL, 0); | 6 | void *backtrace_fns[10]; |
7 | backtrace_symbols(NULL, 0); | 7 | size_t entries; |
8 | |||
9 | entries = backtrace(backtrace_fns, 10); | ||
10 | backtrace_symbols_fd(backtrace_fns, entries, 1); | ||
8 | 11 | ||
9 | return 0; | 12 | return 0; |
10 | } | 13 | } |
14 | |||
diff --git a/tools/perf/config/feature-checks/test-cplus-demangle.c b/tools/perf/config/feature-checks/test-cplus-demangle.c index 5202f5038ad8..ab29f80570af 100644 --- a/tools/perf/config/feature-checks/test-cplus-demangle.c +++ b/tools/perf/config/feature-checks/test-cplus-demangle.c | |||
@@ -1,9 +1,14 @@ | |||
1 | 1 | extern int printf(const char *format, ...); | |
2 | extern char *cplus_demangle(const char *, int); | 2 | extern char *cplus_demangle(const char *, int); |
3 | 3 | ||
4 | int main(void) | 4 | int main(void) |
5 | { | 5 | { |
6 | cplus_demangle(0, 0); | 6 | char symbol[4096] = "FieldName__9ClassNameFd"; |
7 | char *tmp; | ||
8 | |||
9 | tmp = cplus_demangle(symbol, 0); | ||
10 | |||
11 | printf("demangled symbol: {%s}\n", tmp); | ||
7 | 12 | ||
8 | return 0; | 13 | return 0; |
9 | } | 14 | } |
diff --git a/tools/perf/config/feature-checks/test-gtk2-infobar.c b/tools/perf/config/feature-checks/test-gtk2-infobar.c index eebcfbc45120..397b4646d066 100644 --- a/tools/perf/config/feature-checks/test-gtk2-infobar.c +++ b/tools/perf/config/feature-checks/test-gtk2-infobar.c | |||
@@ -2,8 +2,9 @@ | |||
2 | #include <gtk/gtk.h> | 2 | #include <gtk/gtk.h> |
3 | #pragma GCC diagnostic error "-Wstrict-prototypes" | 3 | #pragma GCC diagnostic error "-Wstrict-prototypes" |
4 | 4 | ||
5 | int main(void) | 5 | int main(int argc, char *argv[]) |
6 | { | 6 | { |
7 | gtk_init(&argc, &argv); | ||
7 | gtk_info_bar_new(); | 8 | gtk_info_bar_new(); |
8 | 9 | ||
9 | return 0; | 10 | return 0; |
diff --git a/tools/perf/config/feature-checks/test-gtk2.c b/tools/perf/config/feature-checks/test-gtk2.c index 1ac6d8a1fb14..6bd80e509439 100644 --- a/tools/perf/config/feature-checks/test-gtk2.c +++ b/tools/perf/config/feature-checks/test-gtk2.c | |||
@@ -4,7 +4,7 @@ | |||
4 | 4 | ||
5 | int main(int argc, char *argv[]) | 5 | int main(int argc, char *argv[]) |
6 | { | 6 | { |
7 | gtk_init(&argc, &argv); | 7 | gtk_init(&argc, &argv); |
8 | 8 | ||
9 | return 0; | 9 | return 0; |
10 | } | 10 | } |
diff --git a/tools/perf/config/feature-checks/test-libaudit.c b/tools/perf/config/feature-checks/test-libaudit.c index 854a65d3cc78..f7e791efa6d1 100644 --- a/tools/perf/config/feature-checks/test-libaudit.c +++ b/tools/perf/config/feature-checks/test-libaudit.c | |||
@@ -1,5 +1,7 @@ | |||
1 | #include <libaudit.h> | 1 | #include <libaudit.h> |
2 | 2 | ||
3 | extern int printf(const char *format, ...); | ||
4 | |||
3 | int main(void) | 5 | int main(void) |
4 | { | 6 | { |
5 | printf("error message: %s\n", audit_errno_to_name(0)); | 7 | printf("error message: %s\n", audit_errno_to_name(0)); |
diff --git a/tools/perf/config/feature-checks/test-libbfd.c b/tools/perf/config/feature-checks/test-libbfd.c index d03339c995d7..1886c78c30e7 100644 --- a/tools/perf/config/feature-checks/test-libbfd.c +++ b/tools/perf/config/feature-checks/test-libbfd.c | |||
@@ -1,7 +1,16 @@ | |||
1 | #include <bfd.h> | 1 | #include <bfd.h> |
2 | 2 | ||
3 | extern int printf(const char *format, ...); | ||
4 | |||
3 | int main(void) | 5 | int main(void) |
4 | { | 6 | { |
5 | bfd_demangle(0, 0, 0); | 7 | char symbol[4096] = "FieldName__9ClassNameFd"; |
8 | char *tmp; | ||
9 | |||
10 | tmp = bfd_demangle(0, symbol, 0); | ||
11 | |||
12 | printf("demangled symbol: {%s}\n", tmp); | ||
13 | |||
6 | return 0; | 14 | return 0; |
7 | } | 15 | } |
16 | |||
diff --git a/tools/perf/config/feature-checks/test-libunwind.c b/tools/perf/config/feature-checks/test-libunwind.c index 562274695c76..43b9369bcab7 100644 --- a/tools/perf/config/feature-checks/test-libunwind.c +++ b/tools/perf/config/feature-checks/test-libunwind.c | |||
@@ -10,11 +10,18 @@ extern int UNW_OBJ(dwarf_search_unwind_table) (unw_addr_space_t as, | |||
10 | 10 | ||
11 | #define dwarf_search_unwind_table UNW_OBJ(dwarf_search_unwind_table) | 11 | #define dwarf_search_unwind_table UNW_OBJ(dwarf_search_unwind_table) |
12 | 12 | ||
13 | static unw_accessors_t accessors; | ||
14 | |||
13 | int main(void) | 15 | int main(void) |
14 | { | 16 | { |
15 | unw_addr_space_t addr_space; | 17 | unw_addr_space_t addr_space; |
16 | addr_space = unw_create_addr_space(NULL, 0); | 18 | |
19 | addr_space = unw_create_addr_space(&accessors, 0); | ||
20 | if (addr_space) | ||
21 | return 0; | ||
22 | |||
17 | unw_init_remote(NULL, addr_space, NULL); | 23 | unw_init_remote(NULL, addr_space, NULL); |
18 | dwarf_search_unwind_table(addr_space, 0, NULL, NULL, 0, NULL); | 24 | dwarf_search_unwind_table(addr_space, 0, NULL, NULL, 0, NULL); |
25 | |||
19 | return 0; | 26 | return 0; |
20 | } | 27 | } |
diff --git a/tools/perf/config/feature-checks/test-on-exit.c b/tools/perf/config/feature-checks/test-on-exit.c index 473f1dea5316..8f64ed3a58d9 100644 --- a/tools/perf/config/feature-checks/test-on-exit.c +++ b/tools/perf/config/feature-checks/test-on-exit.c | |||
@@ -1,6 +1,15 @@ | |||
1 | #include <stdio.h> | 1 | #include <stdio.h> |
2 | 2 | ||
3 | static void exit_fn(int status, void *__data) | ||
4 | { | ||
5 | printf("exit status: %d, data: %d\n", status, *(int *)__data); | ||
6 | } | ||
7 | |||
8 | static int data = 123; | ||
9 | |||
3 | int main(void) | 10 | int main(void) |
4 | { | 11 | { |
5 | return on_exit(NULL, NULL); | 12 | on_exit(exit_fn, &data); |
13 | |||
14 | return 321; | ||
6 | } | 15 | } |