perf test: Print result for each LLVM subtest
Currently 'perf test llvm' and 'perf test BPF' have multiple sub-tests, but the result is provided in only one line: # perf test LLVM 35: Test LLVM searching and compiling : Ok This patch introduces sub-tests support, allowing 'perf test' to report result for each sub-tests: # perf test LLVM 35: Test LLVM searching and compiling : 35.1: Basic BPF llvm compiling test : Ok 35.2: Test kbuild searching : Ok 35.3: Compile source for BPF prologue generation test : Ok When a failure happens: # cat ~/.perfconfig [llvm] clang-path = "/bin/false" # perf test LLVM 35: Test LLVM searching and compiling : 35.1: Basic BPF llvm compiling test : FAILED! 35.2: Test kbuild searching : Skip 35.3: Compile source for BPF prologue generation test : Skip And: # rm ~/.perfconfig # ./perf test LLVM 35: Test LLVM searching and compiling : 35.1: Basic BPF llvm compiling test : Skip 35.2: Test kbuild searching : Skip 35.3: Compile source for BPF prologue generation test : Skip Skip by user: # ./perf test -s 1,`seq -s , 3 42` 1: vmlinux symtab matches kallsyms : Skip (user override) 2: detect openat syscall event : Ok ... 35: Test LLVM searching and compiling : Skip (user override) ... Suggested-and-Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com> Signed-off-by: Wang Nan <wangnan0@huawei.com> Cc: Alexei Starovoitov <ast@kernel.org> Cc: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com> Cc: Zefan Li <lizefan@huawei.com> Cc: pi3orama@163.com Link: http://lkml.kernel.org/r/1447749170-175898-4-git-send-email-wangnan0@huawei.com [ Changed so that func is not on an anonymous union ] Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
This commit is contained in:

committed by
Arnaldo Carvalho de Melo

parent
721a1f53df
commit
e8c6d50044
@@ -46,7 +46,7 @@ static struct {
|
||||
},
|
||||
[LLVM_TESTCASE_BPF_PROLOGUE] = {
|
||||
.source = test_llvm__bpf_test_prologue_prog,
|
||||
.desc = "Test BPF prologue generation",
|
||||
.desc = "Compile source for BPF prologue generation test",
|
||||
},
|
||||
};
|
||||
|
||||
@@ -131,44 +131,39 @@ out:
|
||||
return ret;
|
||||
}
|
||||
|
||||
int test__llvm(int subtest __maybe_unused)
|
||||
int test__llvm(int subtest)
|
||||
{
|
||||
enum test_llvm__testcase i;
|
||||
int ret;
|
||||
void *obj_buf = NULL;
|
||||
size_t obj_buf_sz = 0;
|
||||
|
||||
for (i = 0; i < __LLVM_TESTCASE_MAX; i++) {
|
||||
int ret;
|
||||
void *obj_buf = NULL;
|
||||
size_t obj_buf_sz = 0;
|
||||
if ((subtest < 0) || (subtest >= __LLVM_TESTCASE_MAX))
|
||||
return TEST_FAIL;
|
||||
|
||||
ret = test_llvm__fetch_bpf_obj(&obj_buf, &obj_buf_sz,
|
||||
i, false);
|
||||
ret = test_llvm__fetch_bpf_obj(&obj_buf, &obj_buf_sz,
|
||||
subtest, false);
|
||||
|
||||
if (ret == TEST_OK) {
|
||||
ret = test__bpf_parsing(obj_buf, obj_buf_sz);
|
||||
if (ret != TEST_OK)
|
||||
pr_debug("Failed to parse test case '%s'\n",
|
||||
bpf_source_table[i].desc);
|
||||
}
|
||||
free(obj_buf);
|
||||
|
||||
switch (ret) {
|
||||
case TEST_SKIP:
|
||||
return TEST_SKIP;
|
||||
case TEST_OK:
|
||||
break;
|
||||
default:
|
||||
/*
|
||||
* Test 0 is the basic LLVM test. If test 0
|
||||
* fail, the basic LLVM support not functional
|
||||
* so the whole test should fail. If other test
|
||||
* case fail, it can be fixed by adjusting
|
||||
* config so don't report error.
|
||||
*/
|
||||
if (i == 0)
|
||||
return TEST_FAIL;
|
||||
else
|
||||
return TEST_SKIP;
|
||||
if (ret == TEST_OK) {
|
||||
ret = test__bpf_parsing(obj_buf, obj_buf_sz);
|
||||
if (ret != TEST_OK) {
|
||||
pr_debug("Failed to parse test case '%s'\n",
|
||||
bpf_source_table[subtest].desc);
|
||||
}
|
||||
}
|
||||
return TEST_OK;
|
||||
free(obj_buf);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
int test__llvm_subtest_get_nr(void)
|
||||
{
|
||||
return __LLVM_TESTCASE_MAX;
|
||||
}
|
||||
|
||||
const char *test__llvm_subtest_get_desc(int subtest)
|
||||
{
|
||||
if ((subtest < 0) || (subtest >= __LLVM_TESTCASE_MAX))
|
||||
return NULL;
|
||||
|
||||
return bpf_source_table[subtest].desc;
|
||||
}
|
||||
|
Reference in New Issue
Block a user