summaryrefslogtreecommitdiffstats
path: root/dynamic-layers
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-10-20 15:32:45 -0700
commita201c568d82e65ca27ff18ee23eb6a809f3924a7 (patch)
treec62ca72f3ac64127fcfef923b430510c09938be7 /dynamic-layers
parent84fedfcd3432c5c2a5c75452e825cb7c657a835d (diff)
downloadmeta-clang-a201c568d82e65ca27ff18ee23eb6a809f3924a7.tar.gz
bpftrace: Simplify ptest script and use posix syntax
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-ptest59
-rw-r--r--dynamic-layers/openembedded-layer/recipes-devtools/bpftrace/bpftrace_0.16.0.bb3
2 files changed, 29 insertions, 33 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 aa582e4..bab3033 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.16.0)
29 case $test_case in 35 if [ "$test_name" = "signals" ] || [ "$test_name" = "watchpoint" ]; then
30 signals) 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.16.0.bb b/dynamic-layers/openembedded-layer/recipes-devtools/bpftrace/bpftrace_0.16.0.bb
index 0c0ea2a..ca324bc 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
@@ -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://run-ptest \ 20 file://run-ptest \
@@ -37,7 +36,7 @@ PACKAGECONFIG[tests] = "-DBUILD_TESTING=ON,-DBUILD_TESTING=OFF,gtest xxd-native"
37do_install_ptest() { 36do_install_ptest() {
38 if [ -e ${B}/tests/bpftrace_test ]; then 37 if [ -e ${B}/tests/bpftrace_test ]; then
39 install -Dm 755 ${B}/tests/bpftrace_test ${D}${PTEST_PATH}/tests/bpftrace_test 38 install -Dm 755 ${B}/tests/bpftrace_test ${D}${PTEST_PATH}/tests/bpftrace_test
40 cp -rf ${B}/tests/runtime* ${D}${PTEST_PATH}/tests 39 cp -rf ${B}/tests/runtime ${D}${PTEST_PATH}/tests
41 cp -rf ${B}/tests/test* ${D}${PTEST_PATH}/tests 40 cp -rf ${B}/tests/test* ${D}${PTEST_PATH}/tests
42 fi 41 fi
43} 42}