mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-12-15 20:26:48 +07:00
5e08a76525
getBPFObjectFromModule() is introduced to compile LLVM IR(Module) to BPF object. Add new testcase for it. Test result: $ ./buildperf/perf test -v clang 51: builtin clang support : 51.1: builtin clang compile C source to IR : --- start --- test child forked, pid 21822 test child finished with 0 ---- end ---- builtin clang support subtest 0: Ok 51.2: builtin clang compile C source to ELF object : --- start --- test child forked, pid 21823 test child finished with 0 ---- end ---- builtin clang support subtest 1: Ok Signed-off-by: Wang Nan <wangnan0@huawei.com> Cc: Alexei Starovoitov <ast@fb.com> Cc: He Kuang <hekuang@huawei.com> Cc: Jiri Olsa <jolsa@kernel.org> Cc: Joe Stringer <joe@ovn.org> Cc: Zefan Li <lizefan@huawei.com> Cc: pi3orama@163.com Link: http://lkml.kernel.org/r/20161126070354.141764-15-wangnan0@huawei.com [ Remove redundant "Test" from entry descriptions ] Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
47 lines
897 B
C
47 lines
897 B
C
#include "tests.h"
|
|
#include "debug.h"
|
|
#include "util.h"
|
|
#include "c++/clang-c.h"
|
|
|
|
static struct {
|
|
int (*func)(void);
|
|
const char *desc;
|
|
} clang_testcase_table[] = {
|
|
#ifdef HAVE_LIBCLANGLLVM_SUPPORT
|
|
{
|
|
.func = test__clang_to_IR,
|
|
.desc = "builtin clang compile C source to IR",
|
|
},
|
|
{
|
|
.func = test__clang_to_obj,
|
|
.desc = "builtin clang compile C source to ELF object",
|
|
},
|
|
#endif
|
|
};
|
|
|
|
int test__clang_subtest_get_nr(void)
|
|
{
|
|
return (int)ARRAY_SIZE(clang_testcase_table);
|
|
}
|
|
|
|
const char *test__clang_subtest_get_desc(int i)
|
|
{
|
|
if (i < 0 || i >= (int)ARRAY_SIZE(clang_testcase_table))
|
|
return NULL;
|
|
return clang_testcase_table[i].desc;
|
|
}
|
|
|
|
#ifndef HAVE_LIBCLANGLLVM_SUPPORT
|
|
int test__clang(int i __maybe_unused)
|
|
{
|
|
return TEST_SKIP;
|
|
}
|
|
#else
|
|
int test__clang(int i)
|
|
{
|
|
if (i < 0 || i >= (int)ARRAY_SIZE(clang_testcase_table))
|
|
return TEST_FAIL;
|
|
return clang_testcase_table[i].func();
|
|
}
|
|
#endif
|