From acb53c7858a8a323aad1aa034e3bca028b0e1f4b Mon Sep 17 00:00:00 2001 From: Martin Jansa Date: Tue, 3 Sep 2024 12:09:56 +0200 Subject: bpftrace: move from dynamic-layers/openembedded-layer to dynamic-layers/meta-python * bpftrace itself doesn't depend on meta-python, but bpftrace from dynamic-layers/openembedded-layer depends on bcc from dynamic-layers/meta-python so better to move it there. This way both bcc and bpftrace are either both available at the same time or neither of them. * fixes https://github.com/kraj/meta-clang/issues/985 ERROR: Nothing PROVIDES 'bcc' (but /mnt/secondary/poky/meta-clang/dynamic-layers/openembedded-layer/recipes-devtools/bpftrace/bpftrace_0.20.1.bb DEPENDS on or otherwise requires it). Close matches: bc byacc NOTE: Runtime target 'bpftrace' is unbuildable, removing... Missing or unbuildable dependency chain was: ['bpftrace', 'bcc'] ERROR: Required build target 'core-image-minimal' has no buildable providers. Missing or unbuildable dependency chain was: ['core-image-minimal', 'bpftrace', 'bcc'] when only openembedded-layer (meta-oe) is in BBLAYERS and meta-python isn't. Signed-off-by: Martin Jansa --- .../0001-cmake-Bump-max-LLVM-version-to-19.patch | 24 ++++++++++ .../recipes-devtools/bpftrace/bpftrace/run-ptest | 51 ++++++++++++++++++++ .../recipes-devtools/bpftrace/bpftrace_0.21.2.bb | 55 ++++++++++++++++++++++ 3 files changed, 130 insertions(+) create mode 100644 dynamic-layers/meta-python/recipes-devtools/bpftrace/bpftrace/0001-cmake-Bump-max-LLVM-version-to-19.patch create mode 100644 dynamic-layers/meta-python/recipes-devtools/bpftrace/bpftrace/run-ptest create mode 100644 dynamic-layers/meta-python/recipes-devtools/bpftrace/bpftrace_0.21.2.bb (limited to 'dynamic-layers/meta-python') diff --git a/dynamic-layers/meta-python/recipes-devtools/bpftrace/bpftrace/0001-cmake-Bump-max-LLVM-version-to-19.patch b/dynamic-layers/meta-python/recipes-devtools/bpftrace/bpftrace/0001-cmake-Bump-max-LLVM-version-to-19.patch new file mode 100644 index 0000000..88dc60b --- /dev/null +++ b/dynamic-layers/meta-python/recipes-devtools/bpftrace/bpftrace/0001-cmake-Bump-max-LLVM-version-to-19.patch @@ -0,0 +1,24 @@ +From 16186113346c268a0bb45424ba1c41768b7e94cf Mon Sep 17 00:00:00 2001 +From: Khem Raj +Date: Fri, 16 Feb 2024 10:14:41 -0800 +Subject: [PATCH] cmake: Bump max LLVM version to 19 + +Upstream-Status: Submitted [https://github.com/bpftrace/bpftrace/pull/3433] +Signed-off-by: Khem Raj +--- + CMakeLists.txt | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +Index: git/CMakeLists.txt +=================================================================== +--- git.orig/CMakeLists.txt ++++ git/CMakeLists.txt +@@ -152,7 +152,7 @@ else() + endif() + + set(MIN_LLVM_MAJOR 13) +-set(MAX_LLVM_MAJOR 18) ++set(MAX_LLVM_MAJOR 19) + + if((${LLVM_VERSION_MAJOR} VERSION_LESS ${MIN_LLVM_MAJOR}) OR (${LLVM_VERSION_MAJOR} VERSION_GREATER ${MAX_LLVM_MAJOR})) + message(SEND_ERROR "Unsupported LLVM version found via ${LLVM_INCLUDE_DIRS}: ${LLVM_VERSION_MAJOR}") diff --git a/dynamic-layers/meta-python/recipes-devtools/bpftrace/bpftrace/run-ptest b/dynamic-layers/meta-python/recipes-devtools/bpftrace/bpftrace/run-ptest new file mode 100644 index 0000000..63d65e2 --- /dev/null +++ b/dynamic-layers/meta-python/recipes-devtools/bpftrace/bpftrace/run-ptest @@ -0,0 +1,51 @@ +#!/bin/sh + +# The whole test suite may take up to 40 minutes to run, so setting -t 2400 +# parameter in ptest-runner is necessary to not kill it before completion + +cd tests || exit 1 +export BPFTRACE_RUNTIME_TEST_EXECUTABLE=/usr/bin/bpftrace +export BPFTRACE_AOT_RUNTIME_TEST_EXECUTABLE=/usr/bin/bpftrace-aotrt + +PASS_CNT=0 +FAIL_CNT=0 +SKIP_CNT=0 +FAILED="" + +print_test_result() { + if [ $? -eq 0 ]; then + echo "PASS: $1" + PASS_CNT=$((PASS_CNT + 1)) + else + echo "FAIL: $1" + FAIL_CNT=$((FAIL_CNT + 1)) + FAILED="${FAILED:+$FAILED }$1;" + fi + } + +IFS=$(printf '\n\t') +# Start unit tests +for test_name in $(./bpftrace_test --gtest_list_tests | grep -v "^ "); do + ./bpftrace_test --gtest_filter="${test_name}*" > /dev/null 2>&1 + print_test_result "unit:$test_name" +done + +# Start runtime tests +for test_name in $(ls runtime); do + # Ignore test cases that hang the suite forever (bpftrace v0.16.0) + if [ "$test_name" = "signals" ] || [ "$test_name" = "watchpoint" ]; then + echo "SKIP: runtime:$test_name" + SKIP_CNT=$((SKIP_CNT + 1)) + continue + fi + python3 runtime/engine/main.py --filter="${test_name}.*" > /dev/null 2>&1 + print_test_result "runtime:$test_name" +done +unset IFS + +echo "#### bpftrace tests summary ####" +echo "# TOTAL: $((PASS_CNT + FAIL_CNT + SKIP_CNT))" +echo "# PASS: $PASS_CNT" +echo "# FAIL: $FAIL_CNT ($FAILED)" +echo "# SKIP: $SKIP_CNT" +echo "################################" diff --git a/dynamic-layers/meta-python/recipes-devtools/bpftrace/bpftrace_0.21.2.bb b/dynamic-layers/meta-python/recipes-devtools/bpftrace/bpftrace_0.21.2.bb new file mode 100644 index 0000000..addd2c5 --- /dev/null +++ b/dynamic-layers/meta-python/recipes-devtools/bpftrace/bpftrace_0.21.2.bb @@ -0,0 +1,55 @@ +SUMMARY = "bpftrace" +HOMEPAGE = "https://github.com/iovisor/bpftrace" +LICENSE = "Apache-2.0" +LIC_FILES_CHKSUM = "file://LICENSE;md5=3b83ef96387f14655fc854ddc3c6bd57" + +DEPENDS += "bison-native \ + flex-native \ + gzip-native \ + elfutils \ + bcc \ + systemtap \ + libcereal \ + libbpf \ + " +DEPENDS += "${@bb.utils.contains('PTEST_ENABLED', '1', 'pahole-native llvm-native', '', d)}" + +RDEPENDS:${PN} += "bash python3 xz" + +PV .= "+git" + +SRC_URI = "git://github.com/iovisor/bpftrace;branch=master;protocol=https \ + file://run-ptest \ + file://0001-cmake-Bump-max-LLVM-version-to-19.patch \ +" +SRCREV = "b2e255870ba010d4a7e4852bffcf1c567b016fd0" + +S = "${WORKDIR}/git" + +inherit cmake ptest + +PACKAGECONFIG ?= "${@bb.utils.contains('PTEST_ENABLED', '1', 'tests', '', d)}" + +PACKAGECONFIG[tests] = "-DBUILD_TESTING=ON,-DBUILD_TESTING=OFF,gtest xxd-native" + +do_install_ptest() { + if [ -e ${B}/tests/bpftrace_test ]; then + install -Dm 755 ${B}/tests/bpftrace_test ${D}${PTEST_PATH}/tests/bpftrace_test + cp -rf ${B}/tests/runtime ${D}${PTEST_PATH}/tests + cp -rf ${B}/tests/test* ${D}${PTEST_PATH}/tests + fi +} + +EXTRA_OECMAKE = " \ + -DCMAKE_ENABLE_EXPORTS=1 \ + -DCMAKE_BUILD_TYPE=Release \ + -DUSE_SYSTEM_BPF_BCC=ON \ + -DENABLE_MAN=OFF \ +" + +COMPATIBLE_HOST = "(x86_64.*|aarch64.*|powerpc64.*|riscv64.*)-linux" +COMPATIBLE_HOST:libc-musl = "null" + +INHIBIT_PACKAGE_STRIP_FILES += "\ + ${PKGD}${PTEST_PATH}/tests/testprogs/uprobe_test \ +" -- cgit v1.2.3-54-g00ecf