diff options
author | Michal Wojcik <michal.wojcik@linaro.org> | 2022-10-14 15:29:41 +0200 |
---|---|---|
committer | Khem Raj <raj.khem@gmail.com> | 2022-10-17 12:54:08 -0700 |
commit | e8fd396155e1f8a5cdb57e7abd0c1eb698635371 (patch) | |
tree | e25ec9e9ec1ad839b12f2484b5faa1ede716d8eb /dynamic-layers | |
parent | bdbd3741126c1c4144c0c28cf2c0bb1d16d53d9d (diff) | |
download | meta-clang-e8fd396155e1f8a5cdb57e7abd0c1eb698635371.tar.gz |
bcc: Add ptest support
Use bcc cc and python test suites and parse their results in ptest form.
Running whole suite on qemu may take up to 25 minutes, so running it
with "ptest-runner -t 1800 bcc" is recommended.
Signed-off-by: Michal Wojcik <michal.wojcik@linaro.org>
Diffstat (limited to 'dynamic-layers')
3 files changed, 70 insertions, 1 deletions
diff --git a/dynamic-layers/openembedded-layer/recipes-devtools/bcc/bcc/ptest_wrapper.sh b/dynamic-layers/openembedded-layer/recipes-devtools/bcc/bcc/ptest_wrapper.sh new file mode 100644 index 0000000..92d0156 --- /dev/null +++ b/dynamic-layers/openembedded-layer/recipes-devtools/bcc/bcc/ptest_wrapper.sh | |||
@@ -0,0 +1,16 @@ | |||
1 | #!/bin/sh | ||
2 | # Simple OE specific wrapper for bcc python tests | ||
3 | |||
4 | name=$1 | ||
5 | kind=$2 | ||
6 | cmd=$3 | ||
7 | shift 3 | ||
8 | |||
9 | case $kind in | ||
10 | simple|sudo) | ||
11 | $cmd "$@" | ||
12 | ;; | ||
13 | *) | ||
14 | echo "Invalid kind $kind of test $name" | ||
15 | exit 1 | ||
16 | esac | ||
diff --git a/dynamic-layers/openembedded-layer/recipes-devtools/bcc/bcc/run-ptest b/dynamic-layers/openembedded-layer/recipes-devtools/bcc/bcc/run-ptest new file mode 100644 index 0000000..a27f697 --- /dev/null +++ b/dynamic-layers/openembedded-layer/recipes-devtools/bcc/bcc/run-ptest | |||
@@ -0,0 +1,42 @@ | |||
1 | #!/bin/sh | ||
2 | |||
3 | cd tests || exit 1 | ||
4 | |||
5 | PASS_CNT=0 | ||
6 | FAIL_CNT=0 | ||
7 | FAILED="" | ||
8 | |||
9 | print_test_result() { | ||
10 | if [ $? -eq 0 ]; then | ||
11 | echo PASS: "$1" | ||
12 | PASS_CNT=$((PASS_CNT + 1)) | ||
13 | else | ||
14 | echo FAIL: "$1" | ||
15 | FAIL_CNT=$((FAIL_CNT + 1)) | ||
16 | FAILED="$FAILED $1;" | ||
17 | fi | ||
18 | } | ||
19 | |||
20 | # Run CC tests, set IFS as test names have spaces | ||
21 | IFS=$(printf '\n\t') | ||
22 | for test_name in $(./cc/test_libbcc_no_libbpf --list-test-names-only); do | ||
23 | ./cc/test_libbcc_no_libbpf "$test_name" > /dev/null 2>&1 | ||
24 | print_test_result "cc $test_name" | ||
25 | done | ||
26 | unset IFS | ||
27 | |||
28 | # Run python tests, skip namespace tests as they currently don't work | ||
29 | if cmake -DCMAKE_TESTING_ENABLED=ON -DTEST_WRAPPER="$(pwd)/ptest_wrapper.sh" python > /dev/null 2>&1; then | ||
30 | for test_name in $(awk -F '[( ]' '/^add_test/ && !/namespace/ {print $2}' CTestTestfile.cmake); do | ||
31 | ctest -Q -R "$test_name" | ||
32 | print_test_result "python $test_name" | ||
33 | done | ||
34 | else | ||
35 | print_test_result "cmake error, couldn't start python tests" | ||
36 | fi | ||
37 | |||
38 | echo "#### bcc tests summary ####" | ||
39 | echo "# TOTAL: $((PASS_CNT + FAIL_CNT))" | ||
40 | echo "# PASS: $PASS_CNT" | ||
41 | echo "# FAIL: $FAIL_CNT ($FAILED)" | ||
42 | echo "###########################" | ||
diff --git a/dynamic-layers/openembedded-layer/recipes-devtools/bcc/bcc_0.25.0.bb b/dynamic-layers/openembedded-layer/recipes-devtools/bcc/bcc_0.25.0.bb index 31ef5c2..cdacbb2 100644 --- a/dynamic-layers/openembedded-layer/recipes-devtools/bcc/bcc_0.25.0.bb +++ b/dynamic-layers/openembedded-layer/recipes-devtools/bcc/bcc_0.25.0.bb | |||
@@ -3,7 +3,7 @@ HOMEPAGE = "https://github.com/iovisor/bcc" | |||
3 | LICENSE = "Apache-2.0" | 3 | LICENSE = "Apache-2.0" |
4 | LIC_FILES_CHKSUM = "file://LICENSE.txt;md5=e3fc50a88d0a364313df4b21ef20c29e" | 4 | LIC_FILES_CHKSUM = "file://LICENSE.txt;md5=e3fc50a88d0a364313df4b21ef20c29e" |
5 | 5 | ||
6 | inherit cmake python3native manpages | 6 | inherit cmake python3native manpages ptest |
7 | 7 | ||
8 | DEPENDS += "bison-native \ | 8 | DEPENDS += "bison-native \ |
9 | flex-native \ | 9 | flex-native \ |
@@ -20,12 +20,15 @@ LUAJIT:powerpc64 = "" | |||
20 | LUAJIT:riscv64 = "" | 20 | LUAJIT:riscv64 = "" |
21 | 21 | ||
22 | RDEPENDS:${PN} += "bash python3 python3-core python3-setuptools xz" | 22 | RDEPENDS:${PN} += "bash python3 python3-core python3-setuptools xz" |
23 | RDEPENDS:${PN}-ptest = "cmake python3 python3-distutils python3-netaddr python3-pyroute2" | ||
23 | 24 | ||
24 | SRC_URI = "gitsm://github.com/iovisor/bcc;branch=master;protocol=https \ | 25 | SRC_URI = "gitsm://github.com/iovisor/bcc;branch=master;protocol=https \ |
25 | file://0001-python-CMakeLists.txt-Remove-check-for-host-etc-debi.patch \ | 26 | file://0001-python-CMakeLists.txt-Remove-check-for-host-etc-debi.patch \ |
26 | file://0001-tools-trace.py-Fix-failing-to-exit.patch \ | 27 | file://0001-tools-trace.py-Fix-failing-to-exit.patch \ |
27 | file://0001-CMakeLists.txt-override-the-PY_CMD_ESCAPED.patch \ | 28 | file://0001-CMakeLists.txt-override-the-PY_CMD_ESCAPED.patch \ |
28 | file://0001-Vendor-just-enough-extra-headers-to-allow-libbpf-to-.patch \ | 29 | file://0001-Vendor-just-enough-extra-headers-to-allow-libbpf-to-.patch \ |
30 | file://run-ptest \ | ||
31 | file://ptest_wrapper.sh \ | ||
29 | " | 32 | " |
30 | 33 | ||
31 | SRCREV = "711f03024d776d174874b1f833dac0597f22a49a" | 34 | SRCREV = "711f03024d776d174874b1f833dac0597f22a49a" |
@@ -54,6 +57,14 @@ do_install:append() { | |||
54 | -i $(find ${D}${datadir}/${PN} -type f) | 57 | -i $(find ${D}${datadir}/${PN} -type f) |
55 | } | 58 | } |
56 | 59 | ||
60 | do_install_ptest() { | ||
61 | install -d ${D}${PTEST_PATH}/tests/cc | ||
62 | install ${B}/tests/cc/test_libbcc_no_libbpf ${B}/tests/cc/libusdt_test_lib.so ${D}${PTEST_PATH}/tests/cc | ||
63 | cp -rf ${S}/tests/python ${D}${PTEST_PATH}/tests/python | ||
64 | install ${WORKDIR}/ptest_wrapper.sh ${D}${PTEST_PATH}/tests | ||
65 | install ${S}/examples/networking/simulation.py ${D}${PTEST_PATH}/tests/python | ||
66 | } | ||
67 | |||
57 | FILES:${PN} += "${PYTHON_SITEPACKAGES_DIR}" | 68 | FILES:${PN} += "${PYTHON_SITEPACKAGES_DIR}" |
58 | FILES:${PN}-doc += "${datadir}/${PN}/man" | 69 | FILES:${PN}-doc += "${datadir}/${PN}/man" |
59 | 70 | ||