diff options
author | Michal Wojcik <michal.wojcik@linaro.org> | 2022-09-30 13:19:41 +0200 |
---|---|---|
committer | Khem Raj <raj.khem@gmail.com> | 2022-09-30 14:00:42 -0400 |
commit | b062a1f718d19aa1fc8e3d923d11d7117628ecba (patch) | |
tree | 394635accd7dbaa48a249b8b5e5942636abda462 /dynamic-layers/openembedded-layer | |
parent | 9c63ab7348324945d49d3195acee6debeb4815f9 (diff) | |
download | meta-clang-b062a1f718d19aa1fc8e3d923d11d7117628ecba.tar.gz |
bpftrace: Add ptest support
Use existing bpftrace unit and runtime tests and parse their results in
ptest form.
Running whole suite may take up to 40 minutes, so running it with
"ptest-runner -t 2400 bpftrace" is recommended.
Signed-off-by: Michal Wojcik <michal.wojcik@linaro.org>
Diffstat (limited to 'dynamic-layers/openembedded-layer')
-rw-r--r-- | dynamic-layers/openembedded-layer/recipes-devtools/bpftrace/bpftrace/run-ptest | 53 | ||||
-rw-r--r-- | dynamic-layers/openembedded-layer/recipes-devtools/bpftrace/bpftrace_0.16.0.bb | 17 |
2 files changed, 67 insertions, 3 deletions
diff --git a/dynamic-layers/openembedded-layer/recipes-devtools/bpftrace/bpftrace/run-ptest b/dynamic-layers/openembedded-layer/recipes-devtools/bpftrace/bpftrace/run-ptest new file mode 100644 index 0000000..aa582e4 --- /dev/null +++ b/dynamic-layers/openembedded-layer/recipes-devtools/bpftrace/bpftrace/run-ptest | |||
@@ -0,0 +1,53 @@ | |||
1 | #!/bin/bash | ||
2 | |||
3 | # The whole test suite may take up to 40 minutes to run, so setting -t 2400 | ||
4 | # parameter in ptest-runner is necessary to not kill it before completion | ||
5 | |||
6 | cd tests | ||
7 | export BPFTRACE_RUNTIME_TEST_EXECUTABLE=/usr/bin | ||
8 | |||
9 | PASS_CNT=0 | ||
10 | FAIL_CNT=0 | ||
11 | SKIP_CNT=0 | ||
12 | FAILED=() | ||
13 | |||
14 | # Start unit tests | ||
15 | for test_case in $(./bpftrace_test --gtest_list_tests | grep -v "^ "); do | ||
16 | if ./bpftrace_test --gtest_filter="${test_case}*" > /dev/null 2>&1 ; then | ||
17 | echo PASS: Unit test $test_case | ||
18 | PASS_CNT=$(($PASS_CNT + 1)) | ||
19 | else | ||
20 | echo FAIL: Unit test $test_case | ||
21 | FAIL_CNT=$(($FAIL_CNT + 1)) | ||
22 | FAILED+=("unit:${test_case}") | ||
23 | fi | ||
24 | done | ||
25 | |||
26 | # Start runtime tests | ||
27 | for test_case in $(ls runtime); do | ||
28 | # Ignore test cases that hang the suite forever (bpftrace v0.16.0) | ||
29 | case $test_case in | ||
30 | signals) | ||
31 | ;& | ||
32 | watchpoint) | ||
33 | echo SKIP: Runtime test $test_case | ||
34 | SKIP_CNT=$(($SKIP_CNT + 1)) | ||
35 | continue | ||
36 | ;; | ||
37 | esac | ||
38 | if ./runtime-tests.sh --filter="${test_case}.*" > /dev/null 2>&1 ; then | ||
39 | echo PASS: Runtime test $test_case | ||
40 | PASS_CNT=$(($PASS_CNT + 1)) | ||
41 | else | ||
42 | echo FAIL: Runtime test $test_case | ||
43 | FAIL_CNT=$(($FAIL_CNT + 1)) | ||
44 | FAILED+=("runtime:${test_case}") | ||
45 | fi | ||
46 | done | ||
47 | |||
48 | echo "#### bpftrace tests summary ####" | ||
49 | echo "# TOTAL: $(($PASS_CNT + $FAIL_CNT + $SKIP_CNT))" | ||
50 | echo "# PASS: $PASS_CNT" | ||
51 | echo "# FAIL: $FAIL_CNT (${FAILED[*]})" | ||
52 | echo "# SKIP: $SKIP_CNT" | ||
53 | echo "################################" | ||
diff --git a/dynamic-layers/openembedded-layer/recipes-devtools/bpftrace/bpftrace_0.16.0.bb b/dynamic-layers/openembedded-layer/recipes-devtools/bpftrace/bpftrace_0.16.0.bb index 7e8ec73..556722c 100644 --- a/dynamic-layers/openembedded-layer/recipes-devtools/bpftrace/bpftrace_0.16.0.bb +++ b/dynamic-layers/openembedded-layer/recipes-devtools/bpftrace/bpftrace_0.16.0.bb | |||
@@ -13,15 +13,26 @@ DEPENDS += "bison-native \ | |||
13 | libbpf \ | 13 | libbpf \ |
14 | " | 14 | " |
15 | 15 | ||
16 | DEPENDS += "${@bb.utils.contains('PTEST_ENABLED', '1', 'gtest xxd-native', '', d)}" | ||
16 | PV .= "+git${SRCREV}" | 17 | PV .= "+git${SRCREV}" |
17 | RDEPENDS:${PN} += "bash python3 xz" | 18 | RDEPENDS:${PN} += "bash python3 xz" |
19 | RDEPENDS:${PN}-ptest += "bash" | ||
18 | 20 | ||
19 | SRC_URI = "git://github.com/iovisor/bpftrace;branch=master;protocol=https" | 21 | SRC_URI = "git://github.com/iovisor/bpftrace;branch=master;protocol=https \ |
22 | file://run-ptest \ | ||
23 | " | ||
20 | SRCREV = "a277ec42102c463d656df8f64eb2f7e87e322210" | 24 | SRCREV = "a277ec42102c463d656df8f64eb2f7e87e322210" |
21 | 25 | ||
22 | S = "${WORKDIR}/git" | 26 | S = "${WORKDIR}/git" |
23 | 27 | ||
24 | inherit cmake | 28 | inherit cmake ptest |
29 | |||
30 | do_install_ptest() { | ||
31 | install -d ${D}${PTEST_PATH}/tests | ||
32 | install -m 755 ${B}/tests/bpftrace_test ${D}${PTEST_PATH}/tests | ||
33 | cp -rf ${B}/tests/runtime* ${D}${PTEST_PATH}/tests | ||
34 | cp -rf ${B}/tests/test* ${D}${PTEST_PATH}/tests | ||
35 | } | ||
25 | 36 | ||
26 | def llvm_major_version(d): | 37 | def llvm_major_version(d): |
27 | pvsplit = d.getVar('LLVMVERSION').split('.') | 38 | pvsplit = d.getVar('LLVMVERSION').split('.') |
@@ -33,9 +44,9 @@ EXTRA_OECMAKE = " \ | |||
33 | -DCMAKE_ENABLE_EXPORTS=1 \ | 44 | -DCMAKE_ENABLE_EXPORTS=1 \ |
34 | -DCMAKE_BUILD_TYPE=Release \ | 45 | -DCMAKE_BUILD_TYPE=Release \ |
35 | -DLLVM_REQUESTED_VERSION=${LLVM_MAJOR_VERSION} \ | 46 | -DLLVM_REQUESTED_VERSION=${LLVM_MAJOR_VERSION} \ |
36 | -DBUILD_TESTING=OFF \ | ||
37 | -DENABLE_MAN=OFF \ | 47 | -DENABLE_MAN=OFF \ |
38 | " | 48 | " |
49 | EXTRA_OECMAKE += "${@bb.utils.contains('PTEST_ENABLED', '1', '-DBUILD_TESTING=ON', '-DBUILD_TESTING=OFF', d)}" | ||
39 | 50 | ||
40 | COMPATIBLE_HOST = "(x86_64.*|aarch64.*|powerpc64.*|riscv64.*)-linux" | 51 | COMPATIBLE_HOST = "(x86_64.*|aarch64.*|powerpc64.*|riscv64.*)-linux" |
41 | COMPATIBLE_HOST:libc-musl = "null" | 52 | COMPATIBLE_HOST:libc-musl = "null" |