summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichal Wojcik <michal.wojcik@linaro.org>2022-10-18 11:09:42 +0200
committerKhem Raj <raj.khem@gmail.com>2022-11-03 10:09:11 -0700
commitede6ff1ceabb67d075c2ab5f851af5a7b5a9e447 (patch)
tree21974b58ad70a0a3dabcea4d1f01d4ab697541ce
parenta0cfbec15cc9da8180d22202e13ec464eab047c8 (diff)
downloadmeta-clang-ede6ff1ceabb67d075c2ab5f851af5a7b5a9e447.tar.gz
bpftrace: Simplify ptest script and use posix syntax
Signed-off-by: Michal Wojcik <michal.wojcik@linaro.org>
-rw-r--r--dynamic-layers/openembedded-layer/recipes-devtools/bpftrace/bpftrace/run-ptest61
-rw-r--r--dynamic-layers/openembedded-layer/recipes-devtools/bpftrace/bpftrace_0.14.1.bb3
2 files changed, 30 insertions, 34 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
index 93d2db2..72dc0ab 100644
--- a/dynamic-layers/openembedded-layer/recipes-devtools/bpftrace/bpftrace/run-ptest
+++ b/dynamic-layers/openembedded-layer/recipes-devtools/bpftrace/bpftrace/run-ptest
@@ -1,53 +1,50 @@
1#!/bin/bash 1#!/bin/sh
2 2
3# The whole test suite may take up to 40 minutes to run, so setting -t 2400 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 4# parameter in ptest-runner is necessary to not kill it before completion
5 5
6cd tests 6cd tests || exit 1
7export BPFTRACE_RUNTIME_TEST_EXECUTABLE=/usr/bin 7export BPFTRACE_RUNTIME_TEST_EXECUTABLE=/usr/bin
8 8
9PASS_CNT=0 9PASS_CNT=0
10FAIL_CNT=0 10FAIL_CNT=0
11SKIP_CNT=0 11SKIP_CNT=0
12FAILED=() 12FAILED=""
13 13
14print_test_result() {
15 if [ $? -eq 0 ]; then
16 echo "PASS: $1"
17 PASS_CNT=$((PASS_CNT + 1))
18 else
19 echo "FAIL: $1"
20 FAIL_CNT=$((FAIL_CNT + 1))
21 FAILED="${FAILED:+$FAILED }$1;"
22 fi
23 }
24
25IFS=$(printf '\n\t')
14# Start unit tests 26# Start unit tests
15for test_case in $(./bpftrace_test --gtest_list_tests | grep -v "^ "); do 27for test_name in $(./bpftrace_test --gtest_list_tests | grep -v "^ "); do
16 if ./bpftrace_test --gtest_filter="${test_case}*" > /dev/null 2>&1 ; then 28 ./bpftrace_test --gtest_filter="${test_name}*" > /dev/null 2>&1
17 echo PASS: Unit test $test_case 29 print_test_result "unit:$test_name"
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 30done
25 31
26# Start runtime tests 32# Start runtime tests
27for test_case in $(ls runtime); do 33for test_name in $(ls runtime); do
28 # Ignore test cases that hang the suite forever (bpftrace v0.16.0) 34 # Ignore test cases that hang the suite forever (bpftrace v0.14.1)
29 case $test_case in 35 if [ "$test_name" = "sigint" ] || [ "$test_name" = "watchpoint" ]; then
30 sigint) 36 echo "SKIP: runtime:$test_name"
31 ;& 37 SKIP_CNT=$((SKIP_CNT + 1))
32 watchpoint) 38 continue
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 39 fi
40 python3 runtime/engine/main.py --filter="${test_name}.*" > /dev/null 2>&1
41 print_test_result "runtime:$test_name"
46done 42done
43unset IFS
47 44
48echo "#### bpftrace tests summary ####" 45echo "#### bpftrace tests summary ####"
49echo "# TOTAL: $(($PASS_CNT + $FAIL_CNT + $SKIP_CNT))" 46echo "# TOTAL: $((PASS_CNT + FAIL_CNT + SKIP_CNT))"
50echo "# PASS: $PASS_CNT" 47echo "# PASS: $PASS_CNT"
51echo "# FAIL: $FAIL_CNT (${FAILED[*]})" 48echo "# FAIL: $FAIL_CNT ($FAILED)"
52echo "# SKIP: $SKIP_CNT" 49echo "# SKIP: $SKIP_CNT"
53echo "################################" 50echo "################################"
diff --git a/dynamic-layers/openembedded-layer/recipes-devtools/bpftrace/bpftrace_0.14.1.bb b/dynamic-layers/openembedded-layer/recipes-devtools/bpftrace/bpftrace_0.14.1.bb
index 4a03ab0..c6cfdab 100644
--- a/dynamic-layers/openembedded-layer/recipes-devtools/bpftrace/bpftrace_0.14.1.bb
+++ b/dynamic-layers/openembedded-layer/recipes-devtools/bpftrace/bpftrace_0.14.1.bb
@@ -15,7 +15,6 @@ DEPENDS += "bison-native \
15 15
16PV .= "+git${SRCREV}" 16PV .= "+git${SRCREV}"
17RDEPENDS:${PN} += "bash python3 xz" 17RDEPENDS:${PN} += "bash python3 xz"
18RDEPENDS:${PN}-ptest += "bash"
19 18
20SRC_URI = "git://github.com/iovisor/bpftrace;branch=master;protocol=https \ 19SRC_URI = "git://github.com/iovisor/bpftrace;branch=master;protocol=https \
21 file://0001-Detect-new-BTF-api-btf_dump__new-btf_dump__new_v0_6_.patch \ 20 file://0001-Detect-new-BTF-api-btf_dump__new-btf_dump__new_v0_6_.patch \
@@ -39,7 +38,7 @@ PACKAGECONFIG[tests] = "-DBUILD_TESTING=ON,-DBUILD_TESTING=OFF,gtest xxd-native"
39do_install_ptest() { 38do_install_ptest() {
40 if [ -e ${B}/tests/bpftrace_test ]; then 39 if [ -e ${B}/tests/bpftrace_test ]; then
41 install -Dm 755 ${B}/tests/bpftrace_test ${D}${PTEST_PATH}/tests/bpftrace_test 40 install -Dm 755 ${B}/tests/bpftrace_test ${D}${PTEST_PATH}/tests/bpftrace_test
42 cp -rf ${B}/tests/runtime* ${D}${PTEST_PATH}/tests 41 cp -rf ${B}/tests/runtime ${D}${PTEST_PATH}/tests
43 cp -rf ${B}/tests/test* ${D}${PTEST_PATH}/tests 42 cp -rf ${B}/tests/test* ${D}${PTEST_PATH}/tests
44 fi 43 fi
45} 44}