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>
This commit is contained in:
Родитель
0648f839ff
Коммит
1e3f30fae7
|
@ -3,8 +3,12 @@
|
||||||
|
|
||||||
int main(void)
|
int main(void)
|
||||||
{
|
{
|
||||||
backtrace(NULL, 0);
|
void *backtrace_fns[10];
|
||||||
backtrace_symbols(NULL, 0);
|
size_t entries;
|
||||||
|
|
||||||
|
entries = backtrace(backtrace_fns, 10);
|
||||||
|
backtrace_symbols_fd(backtrace_fns, entries, 1);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,9 +1,14 @@
|
||||||
|
extern int printf(const char *format, ...);
|
||||||
extern char *cplus_demangle(const char *, int);
|
extern char *cplus_demangle(const char *, int);
|
||||||
|
|
||||||
int main(void)
|
int main(void)
|
||||||
{
|
{
|
||||||
cplus_demangle(0, 0);
|
char symbol[4096] = "FieldName__9ClassNameFd";
|
||||||
|
char *tmp;
|
||||||
|
|
||||||
|
tmp = cplus_demangle(symbol, 0);
|
||||||
|
|
||||||
|
printf("demangled symbol: {%s}\n", tmp);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,8 +2,9 @@
|
||||||
#include <gtk/gtk.h>
|
#include <gtk/gtk.h>
|
||||||
#pragma GCC diagnostic error "-Wstrict-prototypes"
|
#pragma GCC diagnostic error "-Wstrict-prototypes"
|
||||||
|
|
||||||
int main(void)
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
|
gtk_init(&argc, &argv);
|
||||||
gtk_info_bar_new();
|
gtk_info_bar_new();
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
|
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
gtk_init(&argc, &argv);
|
gtk_init(&argc, &argv);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
#include <libaudit.h>
|
#include <libaudit.h>
|
||||||
|
|
||||||
|
extern int printf(const char *format, ...);
|
||||||
|
|
||||||
int main(void)
|
int main(void)
|
||||||
{
|
{
|
||||||
printf("error message: %s\n", audit_errno_to_name(0));
|
printf("error message: %s\n", audit_errno_to_name(0));
|
||||||
|
|
|
@ -1,7 +1,16 @@
|
||||||
#include <bfd.h>
|
#include <bfd.h>
|
||||||
|
|
||||||
|
extern int printf(const char *format, ...);
|
||||||
|
|
||||||
int main(void)
|
int main(void)
|
||||||
{
|
{
|
||||||
bfd_demangle(0, 0, 0);
|
char symbol[4096] = "FieldName__9ClassNameFd";
|
||||||
|
char *tmp;
|
||||||
|
|
||||||
|
tmp = bfd_demangle(0, symbol, 0);
|
||||||
|
|
||||||
|
printf("demangled symbol: {%s}\n", tmp);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -10,11 +10,18 @@ extern int UNW_OBJ(dwarf_search_unwind_table) (unw_addr_space_t as,
|
||||||
|
|
||||||
#define dwarf_search_unwind_table UNW_OBJ(dwarf_search_unwind_table)
|
#define dwarf_search_unwind_table UNW_OBJ(dwarf_search_unwind_table)
|
||||||
|
|
||||||
|
static unw_accessors_t accessors;
|
||||||
|
|
||||||
int main(void)
|
int main(void)
|
||||||
{
|
{
|
||||||
unw_addr_space_t addr_space;
|
unw_addr_space_t addr_space;
|
||||||
addr_space = unw_create_addr_space(NULL, 0);
|
|
||||||
|
addr_space = unw_create_addr_space(&accessors, 0);
|
||||||
|
if (addr_space)
|
||||||
|
return 0;
|
||||||
|
|
||||||
unw_init_remote(NULL, addr_space, NULL);
|
unw_init_remote(NULL, addr_space, NULL);
|
||||||
dwarf_search_unwind_table(addr_space, 0, NULL, NULL, 0, NULL);
|
dwarf_search_unwind_table(addr_space, 0, NULL, NULL, 0, NULL);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,15 @@
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
|
static void exit_fn(int status, void *__data)
|
||||||
|
{
|
||||||
|
printf("exit status: %d, data: %d\n", status, *(int *)__data);
|
||||||
|
}
|
||||||
|
|
||||||
|
static int data = 123;
|
||||||
|
|
||||||
int main(void)
|
int main(void)
|
||||||
{
|
{
|
||||||
return on_exit(NULL, NULL);
|
on_exit(exit_fn, &data);
|
||||||
|
|
||||||
|
return 321;
|
||||||
}
|
}
|
||||||
|
|
Загрузка…
Ссылка в новой задаче