summaryrefslogtreecommitdiffstats
path: root/dynamic-layers
diff options
context:
space:
mode:
authorMichal Wojcik <michal.wojcik@linaro.org>2022-09-30 13:19:41 +0200
committerKhem Raj <raj.khem@gmail.com>2022-09-30 14:00:42 -0400
commitb062a1f718d19aa1fc8e3d923d11d7117628ecba (patch)
tree394635accd7dbaa48a249b8b5e5942636abda462 /dynamic-layers
parent9c63ab7348324945d49d3195acee6debeb4815f9 (diff)
downloadmeta-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')
-rw-r--r--dynamic-layers/openembedded-layer/recipes-devtools/bpftrace/bpftrace/run-ptest53
-rw-r--r--dynamic-layers/openembedded-layer/recipes-devtools/bpftrace/bpftrace_0.16.0.bb17
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
6cd tests
7export BPFTRACE_RUNTIME_TEST_EXECUTABLE=/usr/bin
8
9PASS_CNT=0
10FAIL_CNT=0
11SKIP_CNT=0
12FAILED=()
13
14# Start unit tests
15for 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
24done
25
26# Start runtime tests
27for 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
46done
47
48echo "#### bpftrace tests summary ####"
49echo "# TOTAL: $(($PASS_CNT + $FAIL_CNT + $SKIP_CNT))"
50echo "# PASS: $PASS_CNT"
51echo "# FAIL: $FAIL_CNT (${FAILED[*]})"
52echo "# SKIP: $SKIP_CNT"
53echo "################################"
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
16DEPENDS += "${@bb.utils.contains('PTEST_ENABLED', '1', 'gtest xxd-native', '', d)}"
16PV .= "+git${SRCREV}" 17PV .= "+git${SRCREV}"
17RDEPENDS:${PN} += "bash python3 xz" 18RDEPENDS:${PN} += "bash python3 xz"
19RDEPENDS:${PN}-ptest += "bash"
18 20
19SRC_URI = "git://github.com/iovisor/bpftrace;branch=master;protocol=https" 21SRC_URI = "git://github.com/iovisor/bpftrace;branch=master;protocol=https \
22 file://run-ptest \
23"
20SRCREV = "a277ec42102c463d656df8f64eb2f7e87e322210" 24SRCREV = "a277ec42102c463d656df8f64eb2f7e87e322210"
21 25
22S = "${WORKDIR}/git" 26S = "${WORKDIR}/git"
23 27
24inherit cmake 28inherit cmake ptest
29
30do_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
26def llvm_major_version(d): 37def 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"
49EXTRA_OECMAKE += "${@bb.utils.contains('PTEST_ENABLED', '1', '-DBUILD_TESTING=ON', '-DBUILD_TESTING=OFF', d)}"
39 50
40COMPATIBLE_HOST = "(x86_64.*|aarch64.*|powerpc64.*|riscv64.*)-linux" 51COMPATIBLE_HOST = "(x86_64.*|aarch64.*|powerpc64.*|riscv64.*)-linux"
41COMPATIBLE_HOST:libc-musl = "null" 52COMPATIBLE_HOST:libc-musl = "null"