aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIngo Molnar <mingo@kernel.org>2013-10-02 10:21:37 -0400
committerIngo Molnar <mingo@kernel.org>2013-10-09 02:48:59 -0400
commit3ca576a481f8c12fe606fb75232d52637c666ed0 (patch)
treed1b31170959866cb5975d8b48423b22ace58c374
parent1e3f30fae797660a014ac159d93fff9952ec1bf0 (diff)
tools/perf/build: Collapse the test-all.c testcase
Simplify test-all.c by including it all the testcases via #include. 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-pcZlwqq5ou7Ebvkekvhtzfbm@git.kernel.org Signed-off-by: Ingo Molnar <mingo@kernel.org>
-rw-r--r--tools/perf/config/feature-checks/test-all.c290
1 files changed, 100 insertions, 190 deletions
diff --git a/tools/perf/config/feature-checks/test-all.c b/tools/perf/config/feature-checks/test-all.c
index 9f7c4b165305..50d431892a0c 100644
--- a/tools/perf/config/feature-checks/test-all.c
+++ b/tools/perf/config/feature-checks/test-all.c
@@ -1,196 +1,106 @@
1 1/*
2#pragma GCC diagnostic ignored "-Wstrict-prototypes" 2 * test-all.c: Try to build all the main testcases at once.
3 3 *
4#include <Python.h> 4 * A well-configured system will have all the prereqs installed, so we can speed
5 5 * up auto-detection on such systems.
6#include <EXTERN.h> 6 */
7#include <perl.h> 7
8 8/*
9#include <stdio.h> 9 * Quirk: Python and Perl headers cannot be in arbitrary places, so keep
10#include <libelf.h> 10 * these 3 testcases at the top:
11#include <gnu/libc-version.h> 11 */
12#include <dwarf.h> 12#define main main_test_libpython
13#include <elfutils/libdw.h> 13# include "test-libpython.c"
14#include <elfutils/version.h> 14#undef main
15#include <libelf.h> 15
16#include <libunwind.h> 16#define main main_test_libpython_version
17#include <stdlib.h> 17# include "test-libpython-version.c"
18#include <libaudit.h> 18#undef main
19#include <slang.h> 19
20#include <gtk/gtk.h> 20#define main main_test_libperl
21#include <bfd.h> 21# include "test-libperl.c"
22#include <stdio.h> 22#undef main
23#include <execinfo.h> 23
24#include <stdio.h> 24#define main main_test_hello
25#include <numa.h> 25# include "test-hello.c"
26#include <numaif.h> 26#undef main
27 27
28#pragma GCC diagnostic error "-Wstrict-prototypes" 28#define main main_test_libelf
29 29# include "test-libelf.c"
30int main1(void) 30#undef main
31{ 31
32 return puts("hi"); 32#define main main_test_libelf_mmap
33} 33# include "test-libelf-mmap.c"
34 34#undef main
35int main2(void) 35
36{ 36#define main main_test_glibc
37 return puts("hi"); 37# include "test-glibc.c"
38} 38#undef main
39 39
40int main3(void) 40#define main main_test_dwarf
41{ 41# include "test-dwarf.c"
42 return puts("hi"); 42#undef main
43} 43
44 44#define main main_test_libelf_getphdrnum
45int main4(void) 45# include "test-libelf-getphdrnum.c"
46{ 46#undef main
47 Elf *elf = elf_begin(0, ELF_C_READ, 0); 47
48 return (long)elf; 48#define main main_test_libunwind
49} 49# include "test-libunwind.c"
50# 50#undef main
51int main5(void) 51
52{ 52#define main main_test_libaudit
53 Elf *elf = elf_begin(0, ELF_C_READ_MMAP, 0); 53# include "test-libaudit.c"
54 return (long)elf; 54#undef main
55} 55
56 56#define main main_test_libslang
57int main6(void) 57# include "test-libslang.c"
58{ 58#undef main
59 const char *version = gnu_get_libc_version(); 59
60 return (long)version; 60#define main main_test_gtk2
61} 61# include "test-gtk2.c"
62 62#undef main
63int main7(void) 63
64{ 64#define main main_test_gtk2_infobar
65 Dwarf *dbg = dwarf_begin(0, DWARF_C_READ); 65# include "test-gtk2-infobar.c"
66 return (long)dbg; 66#undef main
67} 67
68 68#define main main_test_libbfd
69int main8(void) 69# include "test-libbfd.c"
70{ 70#undef main
71 size_t dst; 71
72 return elf_getphdrnum(0, &dst); 72#define main main_test_on_exit
73} 73# include "test-on-exit.c"
74 74#undef main
75extern int UNW_OBJ(dwarf_search_unwind_table) (unw_addr_space_t as, 75
76 unw_word_t ip, 76#define main main_test_backtrace
77 unw_dyn_info_t *di, 77# include "test-backtrace.c"
78 unw_proc_info_t *pi, 78#undef main
79 int need_unwind_info, void *arg); 79
80 80#define main main_test_libnuma
81 81# include "test-libnuma.c"
82#define dwarf_search_unwind_table UNW_OBJ(dwarf_search_unwind_table) 82#undef main
83
84int main9(void)
85{
86 unw_addr_space_t addr_space;
87 addr_space = unw_create_addr_space(NULL, 0);
88 unw_init_remote(NULL, addr_space, NULL);
89 dwarf_search_unwind_table(addr_space, 0, NULL, NULL, 0, NULL);
90 return 0;
91}
92
93int main10(void)
94{
95 printf("error message: %s\n", audit_errno_to_name(0));
96 return audit_open();
97}
98
99int main11(void)
100{
101 return SLsmg_init_smg();
102}
103
104int main12(int argc, char *argv[])
105{
106 gtk_init(&argc, &argv);
107
108 return 0;
109}
110
111int main13(void)
112{
113 gtk_info_bar_new();
114
115 return 0;
116}
117
118int main14(void)
119{
120 perl_alloc();
121
122 return 0;
123}
124
125int main15(void)
126{
127 Py_Initialize();
128 return 0;
129}
130
131#if PY_VERSION_HEX >= 0x03000000
132 #error
133#endif
134
135int main16(void)
136{
137 return 0;
138}
139
140int main17(void)
141{
142 bfd_demangle(0, 0, 0);
143 return 0;
144}
145
146void exit_function(int x, void *y)
147{
148}
149
150int main18(void)
151{
152 return on_exit(exit_function, NULL);
153}
154
155int main19(void)
156{
157 void *backtrace_fns[1];
158 size_t entries;
159
160 entries = backtrace(backtrace_fns, 1);
161 backtrace_symbols(backtrace_fns, entries);
162
163 return 0;
164}
165
166int main20(void)
167{
168 numa_available();
169 return 0;
170}
171 83
172int main(int argc, char *argv[]) 84int main(int argc, char *argv[])
173{ 85{
174 main1(); 86 main_test_libpython();
175 main2(); 87 main_test_libpython_version();
176 main3(); 88 main_test_libperl();
177 main4(); 89 main_test_hello();
178 main5(); 90 main_test_libelf();
179 main6(); 91 main_test_libelf_mmap();
180 main7(); 92 main_test_glibc();
181 main8(); 93 main_test_dwarf();
182 main9(); 94 main_test_libelf_getphdrnum();
183 main10(); 95 main_test_libunwind();
184 main11(); 96 main_test_libaudit();
185 main12(argc, argv); 97 main_test_libslang();
186 main13(); 98 main_test_gtk2(argc, argv);
187 main14(); 99 main_test_gtk2_infobar(argc, argv);
188 main15(); 100 main_test_libbfd();
189 main16(); 101 main_test_on_exit();
190 main17(); 102 main_test_backtrace();
191 main18(); 103 main_test_libnuma();
192 main19();
193 main20();
194 104
195 return 0; 105 return 0;
196} 106}