Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 3ca576a4 authored by Ingo Molnar's avatar Ingo Molnar
Browse files

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: default avatarIngo Molnar <mingo@kernel.org>
parent 1e3f30fa
Loading
Loading
Loading
Loading
+100 −190
Original line number Original line Diff line number Diff line

/*
#pragma GCC diagnostic ignored "-Wstrict-prototypes"
 * test-all.c: Try to build all the main testcases at once.

 *
#include <Python.h>
 * A well-configured system will have all the prereqs installed, so we can speed

 * up auto-detection on such systems.
#include <EXTERN.h>
 */
#include <perl.h>


/*
#include <stdio.h>
 * Quirk: Python and Perl headers cannot be in arbitrary places, so keep
#include <libelf.h>
 * these 3 testcases at the top:
#include <gnu/libc-version.h>
 */
#include <dwarf.h>
#define main main_test_libpython
#include <elfutils/libdw.h>
# include "test-libpython.c"
#include <elfutils/version.h>
#undef main
#include <libelf.h>

#include <libunwind.h>
#define main main_test_libpython_version
#include <stdlib.h>
# include "test-libpython-version.c"
#include <libaudit.h>
#undef main
#include <slang.h>

#include <gtk/gtk.h>
#define main main_test_libperl
#include <bfd.h>
# include "test-libperl.c"
#include <stdio.h>
#undef main
#include <execinfo.h>

#include <stdio.h>
#define main main_test_hello
#include <numa.h>
# include "test-hello.c"
#include <numaif.h>
#undef main


#pragma GCC diagnostic error "-Wstrict-prototypes"
#define main main_test_libelf

# include "test-libelf.c"
int main1(void)
#undef main
{

	return puts("hi");
#define main main_test_libelf_mmap
}
# include "test-libelf-mmap.c"

#undef main
int main2(void)

{
#define main main_test_glibc
	return puts("hi");
# include "test-glibc.c"
}
#undef main


int main3(void)
#define main main_test_dwarf
{
# include "test-dwarf.c"
	return puts("hi");
#undef main
}


#define main main_test_libelf_getphdrnum
int main4(void)
# include "test-libelf-getphdrnum.c"
{
#undef main
	Elf *elf = elf_begin(0, ELF_C_READ, 0);

	return (long)elf;
#define main main_test_libunwind
}
# include "test-libunwind.c"
#
#undef main
int main5(void)

{
#define main main_test_libaudit
	Elf *elf = elf_begin(0, ELF_C_READ_MMAP, 0);
# include "test-libaudit.c"
	return (long)elf;
#undef main
}


#define main main_test_libslang
int main6(void)
# include "test-libslang.c"
{
#undef main
	const char *version = gnu_get_libc_version();

	return (long)version;
#define main main_test_gtk2
}
# include "test-gtk2.c"

#undef main
int main7(void)

{
#define main main_test_gtk2_infobar
	Dwarf *dbg = dwarf_begin(0, DWARF_C_READ);
# include "test-gtk2-infobar.c"
	return (long)dbg;
#undef main
}


#define main main_test_libbfd
int main8(void)
# include "test-libbfd.c"
{
#undef main
	size_t dst;

	return elf_getphdrnum(0, &dst);
#define main main_test_on_exit
}
# include "test-on-exit.c"

#undef main
extern int UNW_OBJ(dwarf_search_unwind_table) (unw_addr_space_t as,

                                      unw_word_t ip,
#define main main_test_backtrace
                                      unw_dyn_info_t *di,
# include "test-backtrace.c"
                                      unw_proc_info_t *pi,
#undef main
                                      int need_unwind_info, void *arg);


#define main main_test_libnuma

# include "test-libnuma.c"
#define dwarf_search_unwind_table UNW_OBJ(dwarf_search_unwind_table)
#undef main

int main9(void)
{
	unw_addr_space_t addr_space;
	addr_space = unw_create_addr_space(NULL, 0);
	unw_init_remote(NULL, addr_space, NULL);
	dwarf_search_unwind_table(addr_space, 0, NULL, NULL, 0, NULL);
	return 0;
}

int main10(void)
{
	printf("error message: %s\n", audit_errno_to_name(0));
	return audit_open();
}

int main11(void)
{
	return SLsmg_init_smg();
}

int main12(int argc, char *argv[])
{
        gtk_init(&argc, &argv);

        return 0;
}

int main13(void)
{
	gtk_info_bar_new();

	return 0;
}

int main14(void)
{
	perl_alloc();

	return 0;
}

int main15(void)
{
	Py_Initialize();
	return 0;
}

#if PY_VERSION_HEX >= 0x03000000
	#error
#endif

int main16(void)
{
	return 0;
}

int main17(void)
{
	bfd_demangle(0, 0, 0);
	return 0;
}

void exit_function(int x, void *y)
{
}

int main18(void)
{
	return on_exit(exit_function, NULL);
}

int main19(void)
{
	void *backtrace_fns[1];
	size_t entries;

	entries = backtrace(backtrace_fns, 1);
	backtrace_symbols(backtrace_fns, entries);

	return 0;
}

int main20(void)
{
	numa_available();
	return 0;
}


int main(int argc, char *argv[])
int main(int argc, char *argv[])
{
{
	main1();
	main_test_libpython();
	main2();
	main_test_libpython_version();
	main3();
	main_test_libperl();
	main4();
	main_test_hello();
	main5();
	main_test_libelf();
	main6();
	main_test_libelf_mmap();
	main7();
	main_test_glibc();
	main8();
	main_test_dwarf();
	main9();
	main_test_libelf_getphdrnum();
	main10();
	main_test_libunwind();
	main11();
	main_test_libaudit();
	main12(argc, argv);
	main_test_libslang();
	main13();
	main_test_gtk2(argc, argv);
	main14();
	main_test_gtk2_infobar(argc, argv);
	main15();
	main_test_libbfd();
	main16();
	main_test_on_exit();
	main17();
	main_test_backtrace();
	main18();
	main_test_libnuma();
	main19();
	main20();


	return 0;
	return 0;
}
}