From 94652693940a348b4ec345bdb9e0d218e5664044 Mon Sep 17 00:00:00 2001 From: kenlig <28685375+kenlig@users.noreply.github.com> Date: Tue, 24 Sep 2024 10:50:29 +0800 Subject: [PATCH 01/12] feat:add lcov support for test --- .github/workflows/test-attach.yml | 19 +++++++++++++++---- .github/workflows/test-runtime.yml | 17 +++++++++++++++-- .github/workflows/test-verifier.yml | 11 ++++++++++- .../frida_uprobe_attach_impl/CMakeLists.txt | 12 +++++++++++- .../syscall_trace_attach_impl/CMakeLists.txt | 12 +++++++++++- bpftime-verifier/CMakeLists.txt | 14 +++++++++++++- runtime/unit-test/CMakeLists.txt | 15 ++++++++++++++- 7 files changed, 89 insertions(+), 11 deletions(-) diff --git a/.github/workflows/test-attach.yml b/.github/workflows/test-attach.yml index 4a556fc6..bf8c3aa1 100644 --- a/.github/workflows/test-attach.yml +++ b/.github/workflows/test-attach.yml @@ -26,24 +26,35 @@ jobs: - uses: actions/checkout@v2 with: submodules: 'recursive' - + - name: Install lcov + run: | + sudo apt install -y lcov libzstd-dev libboost-all-dev - name: Build for frida uprobe attach tests run: | - cmake -B build + cmake -DTEST_LCOV=ON -B build cmake --build build --config Debug --target bpftime_frida_uprobe_attach_tests -j$(nproc) - name: Run frida uprobe attach tests run: | ./build/attach/frida_uprobe_attach_impl/bpftime_frida_uprobe_attach_tests - + - name: upload frida uprobe attach test coverage + run: | + lcov --capture --directory . --output-file coverage.info + lcov --remove coverage.info '/usr/*' --output-file coverage.info + lcov --list coverage.info - name: Remove the build run: rm -rf build - name: Build syscall trace uprobe attach tests run: | - cmake -B build + cmake -DTEST_LCOV=ON -B build cmake --build build --config Debug --target bpftime_syscall_trace_attach_tests -j$(nproc) - name: Run syscall trace uprobe attach tests run: | ./build/attach/syscall_trace_attach_impl/bpftime_syscall_trace_attach_tests + - name: upload syscall trace uprobe attach coverage + run: | + lcov --capture --directory . --output-file coverage.info + lcov --remove coverage.info '/usr/*' --output-file coverage.info + lcov --list coverage.info diff --git a/.github/workflows/test-runtime.yml b/.github/workflows/test-runtime.yml index eafcf6a1..c6a5e527 100644 --- a/.github/workflows/test-runtime.yml +++ b/.github/workflows/test-runtime.yml @@ -24,18 +24,31 @@ jobs: - uses: actions/checkout@v2 with: submodules: 'recursive' + - name: Install lcov + run: | + sudo apt install -y lcov libzstd-dev libboost-all-dev - name: Build run: | - cmake -DBPFTIME_LLVM_JIT=YES -DBPFTIME_ENABLE_UNIT_TESTING=YES -DCMAKE_BUILD_TYPE=Debug -B build + cmake -DTEST_LCOV=ON -DBPFTIME_LLVM_JIT=YES -DBPFTIME_ENABLE_UNIT_TESTING=YES -DCMAKE_BUILD_TYPE=Debug -B build cmake --build build --config Debug --target bpftime_runtime_tests -j$(nproc) - name: Test Runtime run: ./build/runtime/unit-test/bpftime_runtime_tests + - name: upload runtime coverage + run: | + lcov --capture --directory . --output-file coverage.info + lcov --remove coverage.info '/usr/*' --output-file coverage.info + lcov --list coverage.info - name: build runtime with mpk enable run: | rm -rf build - cmake -Bbuild -DBPFTIME_LLVM_JIT=YES -DBPFTIME_ENABLE_UNIT_TESTING=YES -DBPFTIME_ENABLE_MPK=YES -DCMAKE_BUILD_TYPE=Debug + cmake -Bbuild -DTEST_LCOV=ON -DBPFTIME_LLVM_JIT=YES -DBPFTIME_ENABLE_UNIT_TESTING=YES -DBPFTIME_ENABLE_MPK=YES -DCMAKE_BUILD_TYPE=Debug cmake --build build --config Debug --target bpftime_runtime_tests -j$(nproc) + - name: upload runtime with mpk enable coverage + run: | + lcov --capture --directory . --output-file coverage.info + lcov --remove coverage.info '/usr/*' --output-file coverage.info + lcov --list coverage.info - name: test runtime with mpk diff --git a/.github/workflows/test-verifier.yml b/.github/workflows/test-verifier.yml index 66862ebf..b2d2d602 100644 --- a/.github/workflows/test-verifier.yml +++ b/.github/workflows/test-verifier.yml @@ -19,10 +19,19 @@ jobs: run: | sudo apt-get update -y sudo apt-get install binutils-dev libboost1.74-all-dev libelf-dev zlib1g-dev ninja-build libyaml-cpp-dev -y + - name: Install lcov + run: | + sudo apt install -y lcov libzstd-dev - name: Build test target run: | - cmake -DBPFTIME_ENABLE_UNIT_TESTING=YES -DBPFTIME_LLVM_JIT=NO -DENABLE_EBPF_VERIFIER=YES -DCMAKE_BUILD_TYPE:STRING=Release -S . -B build -G Ninja + cmake -DTEST_LCOV=ON -DBPFTIME_ENABLE_UNIT_TESTING=YES -DBPFTIME_LLVM_JIT=NO -DENABLE_EBPF_VERIFIER=YES -DCMAKE_BUILD_TYPE:STRING=Release -S . -B build -G Ninja cmake --build build --config Release --target bpftime_verifier_tests - name: Run tests run: | ./build/bpftime-verifier/bpftime_verifier_tests + - name: upload runtime coverage + run: | + lcov --capture --directory . --output-file coverage.info + lcov --remove coverage.info '/usr/*' --output-file coverage.info + lcov --list coverage.info + diff --git a/attach/frida_uprobe_attach_impl/CMakeLists.txt b/attach/frida_uprobe_attach_impl/CMakeLists.txt index 258c0893..ccb44b4c 100644 --- a/attach/frida_uprobe_attach_impl/CMakeLists.txt +++ b/attach/frida_uprobe_attach_impl/CMakeLists.txt @@ -23,8 +23,13 @@ set(TEST_SOURCES test/test_replace_attach_with_override.cpp test/test_attach_with_unified_interface.cpp ) +option(TEST_LCOV "option for lcov" OFF) add_executable(bpftime_frida_uprobe_attach_tests ${TEST_SOURCES}) +if (${TEST_LCOV}) + target_compile_options(bpftime_frida_uprobe_attach_tests PRIVATE -fprofile-arcs -ftest-coverage) +endif() + if(${ENABLE_EBPF_VERIFIER} AND NOT TARGET Catch2) message(STATUS "Adding Catch2 by FetchContent for frida_uprobe_attach_impl") Include(FetchContent) @@ -39,7 +44,12 @@ if(${ENABLE_EBPF_VERIFIER} AND NOT TARGET Catch2) endif() add_dependencies(bpftime_frida_uprobe_attach_tests Catch2 bpftime_frida_uprobe_attach_impl spdlog::spdlog) -target_link_libraries(bpftime_frida_uprobe_attach_tests PRIVATE Catch2::Catch2WithMain bpftime_frida_uprobe_attach_impl spdlog::spdlog) +if (${TEST_LCOV}) + target_link_options(bpftime_frida_uprobe_attach_tests PRIVATE -lgcov) + target_link_libraries(bpftime_frida_uprobe_attach_tests PRIVATE Catch2::Catch2WithMain bpftime_frida_uprobe_attach_impl spdlog::spdlog gcov) +else () + target_link_libraries(bpftime_frida_uprobe_attach_tests PRIVATE Catch2::Catch2WithMain bpftime_frida_uprobe_attach_impl spdlog::spdlog) +endif() target_include_directories(bpftime_frida_uprobe_attach_tests PRIVATE ${FRIDA_UPROBE_ATTACH_IMPL_INCLUDE} ${Catch2_INCLUDE} ${SPDLOG_INCLUDE}) add_test(NAME bpftime_frida_uprobe_attach_tests COMMAND bpftime_frida_uprobe_attach_tests) diff --git a/attach/syscall_trace_attach_impl/CMakeLists.txt b/attach/syscall_trace_attach_impl/CMakeLists.txt index e94da71e..2241cab2 100644 --- a/attach/syscall_trace_attach_impl/CMakeLists.txt +++ b/attach/syscall_trace_attach_impl/CMakeLists.txt @@ -28,8 +28,13 @@ set(TEST_SOURCES test/test_private_data_parsing.cpp test/test_syscall_dispatch.cpp ) +option(TEST_LCOV "option for lcov" OFF) add_executable(bpftime_syscall_trace_attach_tests ${TEST_SOURCES}) +if (${TEST_LCOV}) + target_compile_options(bpftime_syscall_trace_attach_tests PRIVATE -fprofile-arcs -ftest-coverage) +endif() + if(${ENABLE_EBPF_VERIFIER} AND NOT TARGET Catch2) message(STATUS "Adding Catch2 by FetchContent at syscall_trace_attach_impl") Include(FetchContent) @@ -44,7 +49,12 @@ if(${ENABLE_EBPF_VERIFIER} AND NOT TARGET Catch2) endif() add_dependencies(bpftime_syscall_trace_attach_tests Catch2 bpftime_syscall_trace_attach_impl spdlog::spdlog) -target_link_libraries(bpftime_syscall_trace_attach_tests PRIVATE Catch2::Catch2WithMain bpftime_syscall_trace_attach_impl spdlog::spdlog) +if (${TEST_LCOV}) + target_link_options(bpftime_syscall_trace_attach_tests PRIVATE -lgcov) + target_link_libraries(bpftime_syscall_trace_attach_tests PRIVATE Catch2::Catch2WithMain bpftime_syscall_trace_attach_impl spdlog::spdlog gcov) +else () + target_link_libraries(bpftime_syscall_trace_attach_tests PRIVATE Catch2::Catch2WithMain bpftime_syscall_trace_attach_impl spdlog::spdlog) +endif() target_include_directories(bpftime_syscall_trace_attach_tests PRIVATE ${SYSCALL_TRACE_ATTACH_IMPL_INCLUDE} ${Catch2_INCLUDE} ${SPDLOG_INCLUDE}) add_test(NAME bpftime_syscall_trace_attach_tests COMMAND bpftime_syscall_trace_attach_tests) diff --git a/bpftime-verifier/CMakeLists.txt b/bpftime-verifier/CMakeLists.txt index 2b93d5d4..5ab5be9e 100644 --- a/bpftime-verifier/CMakeLists.txt +++ b/bpftime-verifier/CMakeLists.txt @@ -34,8 +34,20 @@ if(NOT TARGET Catch2) FetchContent_MakeAvailable(Catch2) endif() +option(TEST_LCOV "option for lcov" OFF) add_executable(bpftime_verifier_tests ${TEST_SOURCES}) + +if (${TEST_LCOV}) + target_compile_options(bpftime_verifier_tests PRIVATE -fprofile-arcs -ftest-coverage) +endif() + add_dependencies(bpftime_verifier_tests bpftime-verifier) -target_link_libraries(bpftime_verifier_tests PRIVATE bpftime-verifier Catch2::Catch2WithMain) + +if (${TEST_LCOV}) + target_link_options(bpftime_verifier_tests PRIVATE -lgcov) + target_link_libraries(bpftime_verifier_tests PRIVATE bpftime-verifier Catch2::Catch2WithMain gcov) +else () + target_link_libraries(bpftime_verifier_tests PRIVATE bpftime-verifier Catch2::Catch2WithMain) +endif() target_include_directories(bpftime_verifier_tests PRIVATE ${BPFTIME_VERIFIER_INCLUDE}) add_test(NAME bpftime_verifier_tests COMMAND bpftime_verifier_tests) diff --git a/runtime/unit-test/CMakeLists.txt b/runtime/unit-test/CMakeLists.txt index 95560844..6f7bf94c 100644 --- a/runtime/unit-test/CMakeLists.txt +++ b/runtime/unit-test/CMakeLists.txt @@ -31,10 +31,23 @@ set(TEST_SOURCES tailcall/test_user_to_kernel_tailcall.cpp ) +option(TEST_LCOV "option for lcov" OFF) add_executable(bpftime_runtime_tests ${TEST_SOURCES}) + +if (${TEST_LCOV}) + target_compile_options(bpftime_runtime_tests PRIVATE -fprofile-arcs -ftest-coverage) +endif() + set_property(TARGET bpftime_runtime_tests PROPERTY CXX_STANDARD 20) add_dependencies(bpftime_runtime_tests runtime bpftime-object bpftime_frida_uprobe_attach_impl) -target_link_libraries(bpftime_runtime_tests PRIVATE runtime bpftime-object Catch2::Catch2WithMain bpftime_frida_uprobe_attach_impl) + +if (${TEST_LCOV}) + target_link_options(bpftime_runtime_tests PRIVATE -lgcov) + target_link_libraries(bpftime_runtime_tests PRIVATE runtime bpftime-object Catch2::Catch2WithMain bpftime_frida_uprobe_attach_impl gcov) +else () + target_link_libraries(bpftime_runtime_tests PRIVATE runtime bpftime-object Catch2::Catch2WithMain bpftime_frida_uprobe_attach_impl) +endif() + target_include_directories(bpftime_runtime_tests PRIVATE ${BPFTIME_RUNTIME_INCLUDE} ${BPFTIME_OBJECT_INCLUDE_DIRS} ${Catch2_INCLUDE} ${Boost_INCLUDE} ${FRIDA_UPROBE_ATTACH_IMPL_INCLUDE}) add_test(NAME bpftime_runtime_tests COMMAND bpftime_runtime_tests) From 6abe1295570d424b57e939f9355a5cb8214ba865 Mon Sep 17 00:00:00 2001 From: kenlig <28685375+kenlig@users.noreply.github.com> Date: Thu, 26 Sep 2024 20:24:36 +0800 Subject: [PATCH 02/12] update --- .github/workflows/test-attach.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test-attach.yml b/.github/workflows/test-attach.yml index bf8c3aa1..d7555ee3 100644 --- a/.github/workflows/test-attach.yml +++ b/.github/workflows/test-attach.yml @@ -28,7 +28,7 @@ jobs: submodules: 'recursive' - name: Install lcov run: | - sudo apt install -y lcov libzstd-dev libboost-all-dev + apt-get install -y lcov libzstd-dev libboost-all-dev - name: Build for frida uprobe attach tests run: | cmake -DTEST_LCOV=ON -B build From 946c224728270c0f4fe7f1c657c660e054908aa1 Mon Sep 17 00:00:00 2001 From: kenlig <28685375+kenlig@users.noreply.github.com> Date: Thu, 26 Sep 2024 20:31:14 +0800 Subject: [PATCH 03/12] update --- .github/workflows/test-runtime.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test-runtime.yml b/.github/workflows/test-runtime.yml index c6a5e527..4f6d05de 100644 --- a/.github/workflows/test-runtime.yml +++ b/.github/workflows/test-runtime.yml @@ -26,7 +26,7 @@ jobs: submodules: 'recursive' - name: Install lcov run: | - sudo apt install -y lcov libzstd-dev libboost-all-dev + apt-get install -y lcov libzstd-dev libboost-all-dev - name: Build run: | cmake -DTEST_LCOV=ON -DBPFTIME_LLVM_JIT=YES -DBPFTIME_ENABLE_UNIT_TESTING=YES -DCMAKE_BUILD_TYPE=Debug -B build From 368400c36174ba77db97a9c106915b108aa5d498 Mon Sep 17 00:00:00 2001 From: kenlig <28685375+kenlig@users.noreply.github.com> Date: Thu, 26 Sep 2024 21:14:08 +0800 Subject: [PATCH 04/12] update --- .github/workflows/test-attach.yml | 6 ++++++ .github/workflows/test-runtime.yml | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/.github/workflows/test-attach.yml b/.github/workflows/test-attach.yml index d7555ee3..2e7a3af0 100644 --- a/.github/workflows/test-attach.yml +++ b/.github/workflows/test-attach.yml @@ -27,8 +27,14 @@ jobs: with: submodules: 'recursive' - name: Install lcov + if: "matrix.container == 'ubuntu-2204'" run: | apt-get install -y lcov libzstd-dev libboost-all-dev + - name: Install lcov + if: "matrix.container == 'fedora-39'" + run: | + dnf install -y lcov + - name: Build for frida uprobe attach tests run: | cmake -DTEST_LCOV=ON -B build diff --git a/.github/workflows/test-runtime.yml b/.github/workflows/test-runtime.yml index 4f6d05de..f6fab15a 100644 --- a/.github/workflows/test-runtime.yml +++ b/.github/workflows/test-runtime.yml @@ -25,8 +25,14 @@ jobs: with: submodules: 'recursive' - name: Install lcov + if: "matrix.container == 'ubuntu-2204'" run: | apt-get install -y lcov libzstd-dev libboost-all-dev + - name: Install lcov + if: "matrix.container == 'fedora-39'" + run: | + dnf install -y lcov + - name: Build run: | cmake -DTEST_LCOV=ON -DBPFTIME_LLVM_JIT=YES -DBPFTIME_ENABLE_UNIT_TESTING=YES -DCMAKE_BUILD_TYPE=Debug -B build From 50e9fdbc99b2d3fcabd9295059509c1c7fa2f5cd Mon Sep 17 00:00:00 2001 From: kenlig <28685375+kenlig@users.noreply.github.com> Date: Thu, 26 Sep 2024 23:44:23 +0800 Subject: [PATCH 05/12] update --- .github/workflows/test-attach.yml | 30 ++++++++++++++++++++++-------- 1 file changed, 22 insertions(+), 8 deletions(-) diff --git a/.github/workflows/test-attach.yml b/.github/workflows/test-attach.yml index 2e7a3af0..70f37369 100644 --- a/.github/workflows/test-attach.yml +++ b/.github/workflows/test-attach.yml @@ -43,11 +43,18 @@ jobs: - name: Run frida uprobe attach tests run: | ./build/attach/frida_uprobe_attach_impl/bpftime_frida_uprobe_attach_tests - - name: upload frida uprobe attach test coverage + - name: Generate frida uprobe attach test coverage run: | - lcov --capture --directory . --output-file coverage.info - lcov --remove coverage.info '/usr/*' --output-file coverage.info - lcov --list coverage.info + lcov --capture --directory . --output-file coverage-uprobe.info + lcov --remove coverage.info '/usr/*' --output-file coverage-uprobe.info + lcov --list coverage-uprobe.info + - name: Upload uprobe coverage + uses: actions/upload-artifact@v4 + with: + name: coverage-uprobe + include-hidden-files: false + path: | + ./coverage-uprobe.info - name: Remove the build run: rm -rf build @@ -59,8 +66,15 @@ jobs: - name: Run syscall trace uprobe attach tests run: | ./build/attach/syscall_trace_attach_impl/bpftime_syscall_trace_attach_tests - - name: upload syscall trace uprobe attach coverage + - name: Generate syscall trace uprobe attach coverage run: | - lcov --capture --directory . --output-file coverage.info - lcov --remove coverage.info '/usr/*' --output-file coverage.info - lcov --list coverage.info + lcov --capture --directory . --output-file coverage-syscall-trace.info + lcov --remove coverage-syscall-trace.info '/usr/*' --output-file coverage-syscall-trace.info + lcov --list coverage-syscall-trace.info + - name: Upload uprobe coverage + uses: actions/upload-artifact@v4 + with: + name: coverage-syscall-trace + include-hidden-files: false + path: | + ./coverage-syscall-trace.info From 0a5cdfa7632a5445b51c97e9114e84402f36d19d Mon Sep 17 00:00:00 2001 From: kenlig <28685375+kenlig@users.noreply.github.com> Date: Fri, 27 Sep 2024 00:01:36 +0800 Subject: [PATCH 06/12] update --- .github/workflows/test-attach.yml | 4 ++-- .github/workflows/test-runtime.yml | 36 +++++++++++++++++++++--------- 2 files changed, 27 insertions(+), 13 deletions(-) diff --git a/.github/workflows/test-attach.yml b/.github/workflows/test-attach.yml index 70f37369..ebfdf0c3 100644 --- a/.github/workflows/test-attach.yml +++ b/.github/workflows/test-attach.yml @@ -45,7 +45,7 @@ jobs: ./build/attach/frida_uprobe_attach_impl/bpftime_frida_uprobe_attach_tests - name: Generate frida uprobe attach test coverage run: | - lcov --capture --directory . --output-file coverage-uprobe.info + lcov --capture --directory . --output-file coverage-uprobe.info --gcov-tool $(which gcov-12) lcov --remove coverage.info '/usr/*' --output-file coverage-uprobe.info lcov --list coverage-uprobe.info - name: Upload uprobe coverage @@ -68,7 +68,7 @@ jobs: ./build/attach/syscall_trace_attach_impl/bpftime_syscall_trace_attach_tests - name: Generate syscall trace uprobe attach coverage run: | - lcov --capture --directory . --output-file coverage-syscall-trace.info + lcov --capture --directory . --output-file coverage-syscall-trace.info --gcov-tool $(which gcov-12) lcov --remove coverage-syscall-trace.info '/usr/*' --output-file coverage-syscall-trace.info lcov --list coverage-syscall-trace.info - name: Upload uprobe coverage diff --git a/.github/workflows/test-runtime.yml b/.github/workflows/test-runtime.yml index f6fab15a..309f1623 100644 --- a/.github/workflows/test-runtime.yml +++ b/.github/workflows/test-runtime.yml @@ -39,23 +39,37 @@ jobs: cmake --build build --config Debug --target bpftime_runtime_tests -j$(nproc) - name: Test Runtime run: ./build/runtime/unit-test/bpftime_runtime_tests - - name: upload runtime coverage + - name: Generate runtime coverage run: | - lcov --capture --directory . --output-file coverage.info - lcov --remove coverage.info '/usr/*' --output-file coverage.info - lcov --list coverage.info + lcov --capture --directory . --output-file coverage-runtime.info --gcov-tool $(which gcov-12) + lcov --remove coverage-runtime.info '/usr/*' --output-file coverage-runtime.info + lcov --list coverage-runtime.info + - name: Upload runtime coverage + uses: actions/upload-artifact@v4 + with: + name: coverage-runtime + include-hidden-files: false + path: | + ./coverage-runtime.info + - name: build runtime with mpk enable run: | rm -rf build cmake -Bbuild -DTEST_LCOV=ON -DBPFTIME_LLVM_JIT=YES -DBPFTIME_ENABLE_UNIT_TESTING=YES -DBPFTIME_ENABLE_MPK=YES -DCMAKE_BUILD_TYPE=Debug cmake --build build --config Debug --target bpftime_runtime_tests -j$(nproc) - - name: upload runtime with mpk enable coverage - run: | - lcov --capture --directory . --output-file coverage.info - lcov --remove coverage.info '/usr/*' --output-file coverage.info - lcov --list coverage.info - - - name: test runtime with mpk run: ./build/runtime/unit-test/bpftime_runtime_tests + - name: Generate runtime with mpk enable coverage + run: | + lcov --capture --directory . --output-file coverage-runtime-mpk.info --gcov-tool $(which gcov-12) + lcov --remove coverage-runtime-mpk.info '/usr/*' --output-file coverage-runtime-mpk.info + lcov --list coverage-runtime-mpk.info + - name: Upload runtime-mpk coverage + uses: actions/upload-artifact@v4 + with: + name: coverage-runtime-mpk + include-hidden-files: false + path: | + ./coverage-runtime-mpk.info + From 223019441a6d753c6026d30207c787fef4c0e6e1 Mon Sep 17 00:00:00 2001 From: kenlig <28685375+kenlig@users.noreply.github.com> Date: Fri, 27 Sep 2024 00:06:26 +0800 Subject: [PATCH 07/12] update --- .github/workflows/test-attach.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test-attach.yml b/.github/workflows/test-attach.yml index ebfdf0c3..74534d5f 100644 --- a/.github/workflows/test-attach.yml +++ b/.github/workflows/test-attach.yml @@ -46,7 +46,7 @@ jobs: - name: Generate frida uprobe attach test coverage run: | lcov --capture --directory . --output-file coverage-uprobe.info --gcov-tool $(which gcov-12) - lcov --remove coverage.info '/usr/*' --output-file coverage-uprobe.info + lcov --remove coverage-uprobe.info '/usr/*' --output-file coverage-uprobe.info lcov --list coverage-uprobe.info - name: Upload uprobe coverage uses: actions/upload-artifact@v4 From a01eff0d92b6bc9e7b76059d80fe1ac6984e8dea Mon Sep 17 00:00:00 2001 From: kenlig <28685375+kenlig@users.noreply.github.com> Date: Fri, 27 Sep 2024 00:15:56 +0800 Subject: [PATCH 08/12] update --- .github/workflows/test-attach.yml | 4 ++-- .github/workflows/test-runtime.yml | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/test-attach.yml b/.github/workflows/test-attach.yml index 74534d5f..f43027c5 100644 --- a/.github/workflows/test-attach.yml +++ b/.github/workflows/test-attach.yml @@ -30,10 +30,10 @@ jobs: if: "matrix.container == 'ubuntu-2204'" run: | apt-get install -y lcov libzstd-dev libboost-all-dev - - name: Install lcov + - name: Install lcov and which if: "matrix.container == 'fedora-39'" run: | - dnf install -y lcov + dnf install -y lcov which - name: Build for frida uprobe attach tests run: | diff --git a/.github/workflows/test-runtime.yml b/.github/workflows/test-runtime.yml index 309f1623..9c91708e 100644 --- a/.github/workflows/test-runtime.yml +++ b/.github/workflows/test-runtime.yml @@ -28,10 +28,10 @@ jobs: if: "matrix.container == 'ubuntu-2204'" run: | apt-get install -y lcov libzstd-dev libboost-all-dev - - name: Install lcov + - name: Install lcov and which if: "matrix.container == 'fedora-39'" run: | - dnf install -y lcov + dnf install -y lcov which - name: Build run: | From 7fd9616cd0f823a75bfad769951e533f8a1593c0 Mon Sep 17 00:00:00 2001 From: kenlig <28685375+kenlig@users.noreply.github.com> Date: Fri, 27 Sep 2024 00:29:16 +0800 Subject: [PATCH 09/12] update --- .github/workflows/test-attach.yml | 22 ++++++++++++++++++---- .github/workflows/test-runtime.yml | 25 ++++++++++++++++++++++--- 2 files changed, 40 insertions(+), 7 deletions(-) diff --git a/.github/workflows/test-attach.yml b/.github/workflows/test-attach.yml index f43027c5..0577a1b1 100644 --- a/.github/workflows/test-attach.yml +++ b/.github/workflows/test-attach.yml @@ -30,10 +30,10 @@ jobs: if: "matrix.container == 'ubuntu-2204'" run: | apt-get install -y lcov libzstd-dev libboost-all-dev - - name: Install lcov and which + - name: Install lcov if: "matrix.container == 'fedora-39'" run: | - dnf install -y lcov which + dnf install -y lcov - name: Build for frida uprobe attach tests run: | @@ -43,7 +43,14 @@ jobs: - name: Run frida uprobe attach tests run: | ./build/attach/frida_uprobe_attach_impl/bpftime_frida_uprobe_attach_tests - - name: Generate frida uprobe attach test coverage + - name: Generate frida uprobe attach test coverage (Fedora) + if: "matrix.container == 'fedora-39'" + run: | + lcov --capture --directory . --output-file coverage-uprobe.info + lcov --remove coverage-uprobe.info '/usr/*' --output-file coverage-uprobe.info + lcov --list coverage-uprobe.info + - name: Generate frida uprobe attach test coverage (Ubuntu) + if: "matrix.container == 'ubuntu-2204'" run: | lcov --capture --directory . --output-file coverage-uprobe.info --gcov-tool $(which gcov-12) lcov --remove coverage-uprobe.info '/usr/*' --output-file coverage-uprobe.info @@ -66,11 +73,18 @@ jobs: - name: Run syscall trace uprobe attach tests run: | ./build/attach/syscall_trace_attach_impl/bpftime_syscall_trace_attach_tests - - name: Generate syscall trace uprobe attach coverage + - name: Generate syscall trace uprobe attach coverage (Ubuntu) + if: "matrix.container == 'ubuntu-2204'" run: | lcov --capture --directory . --output-file coverage-syscall-trace.info --gcov-tool $(which gcov-12) lcov --remove coverage-syscall-trace.info '/usr/*' --output-file coverage-syscall-trace.info lcov --list coverage-syscall-trace.info + - name: Generate syscall trace uprobe attach coverage (Fedora) + if: "matrix.container == 'fedora-39'" + run: | + lcov --capture --directory . --output-file coverage-syscall-trace.info + lcov --remove coverage-syscall-trace.info '/usr/*' --output-file coverage-syscall-trace.info + lcov --list coverage-syscall-trace.info - name: Upload uprobe coverage uses: actions/upload-artifact@v4 with: diff --git a/.github/workflows/test-runtime.yml b/.github/workflows/test-runtime.yml index 9c91708e..a60ef33a 100644 --- a/.github/workflows/test-runtime.yml +++ b/.github/workflows/test-runtime.yml @@ -28,10 +28,10 @@ jobs: if: "matrix.container == 'ubuntu-2204'" run: | apt-get install -y lcov libzstd-dev libboost-all-dev - - name: Install lcov and which + - name: Install lcov if: "matrix.container == 'fedora-39'" run: | - dnf install -y lcov which + dnf install -y lcov - name: Build run: | @@ -39,6 +39,18 @@ jobs: cmake --build build --config Debug --target bpftime_runtime_tests -j$(nproc) - name: Test Runtime run: ./build/runtime/unit-test/bpftime_runtime_tests + - name: Generate runtime coverage (Ubuntu) + if: "matrix.container == 'ubuntu-2204'" + run: | + lcov --capture --directory . --output-file coverage-runtime.info --gcov-tool $(which gcov-12) + lcov --remove coverage-runtime.info '/usr/*' --output-file coverage-runtime.info + lcov --list coverage-runtime.info + - name: Generate runtime coverage (Fedora) + if: "matrix.container == 'fedora-39'" + run: | + lcov --capture --directory . --output-file coverage-runtime.info + lcov --remove coverage-runtime.info '/usr/*' --output-file coverage-runtime.info + lcov --list coverage-runtime.info - name: Generate runtime coverage run: | lcov --capture --directory . --output-file coverage-runtime.info --gcov-tool $(which gcov-12) @@ -60,11 +72,18 @@ jobs: cmake --build build --config Debug --target bpftime_runtime_tests -j$(nproc) - name: test runtime with mpk run: ./build/runtime/unit-test/bpftime_runtime_tests - - name: Generate runtime with mpk enable coverage + - name: Generate runtime with mpk enable coverage (Ubuntu) + if: "matrix.container == 'ubuntu-2204'" run: | lcov --capture --directory . --output-file coverage-runtime-mpk.info --gcov-tool $(which gcov-12) lcov --remove coverage-runtime-mpk.info '/usr/*' --output-file coverage-runtime-mpk.info lcov --list coverage-runtime-mpk.info + - name: Generate runtime with mpk enable coverage (Fedora) + if: "matrix.container == 'fedora-39'" + run: | + lcov --capture --directory . --output-file coverage-runtime-mpk.info + lcov --remove coverage-runtime-mpk.info '/usr/*' --output-file coverage-runtime-mpk.info + lcov --list coverage-runtime-mpk.info - name: Upload runtime-mpk coverage uses: actions/upload-artifact@v4 with: From 33f8535d25a1ca9d1ac5d51007ac504a24812eec Mon Sep 17 00:00:00 2001 From: kenlig <28685375+kenlig@users.noreply.github.com> Date: Fri, 27 Sep 2024 00:37:59 +0800 Subject: [PATCH 10/12] update --- .github/workflows/test-attach.yml | 4 ++-- .github/workflows/test-runtime.yml | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/test-attach.yml b/.github/workflows/test-attach.yml index 0577a1b1..f89e1113 100644 --- a/.github/workflows/test-attach.yml +++ b/.github/workflows/test-attach.yml @@ -58,7 +58,7 @@ jobs: - name: Upload uprobe coverage uses: actions/upload-artifact@v4 with: - name: coverage-uprobe + name: coverage-uprobe-${{matrix.container}} include-hidden-files: false path: | ./coverage-uprobe.info @@ -88,7 +88,7 @@ jobs: - name: Upload uprobe coverage uses: actions/upload-artifact@v4 with: - name: coverage-syscall-trace + name: coverage-syscall-trace-${{matrix.container}} include-hidden-files: false path: | ./coverage-syscall-trace.info diff --git a/.github/workflows/test-runtime.yml b/.github/workflows/test-runtime.yml index a60ef33a..4ec2d130 100644 --- a/.github/workflows/test-runtime.yml +++ b/.github/workflows/test-runtime.yml @@ -59,7 +59,7 @@ jobs: - name: Upload runtime coverage uses: actions/upload-artifact@v4 with: - name: coverage-runtime + name: coverage-runtime-${{matrix.container}} include-hidden-files: false path: | ./coverage-runtime.info @@ -87,7 +87,7 @@ jobs: - name: Upload runtime-mpk coverage uses: actions/upload-artifact@v4 with: - name: coverage-runtime-mpk + name: coverage-runtime-mpk-${{matrix.container}} include-hidden-files: false path: | ./coverage-runtime-mpk.info From f38ab672104d5e51a9296ee2f1a00da02aec6574 Mon Sep 17 00:00:00 2001 From: kenlig <28685375+kenlig@users.noreply.github.com> Date: Sat, 28 Sep 2024 00:46:23 +0800 Subject: [PATCH 11/12] update --- .github/workflows/test-attach.yml | 7 +++++++ .github/workflows/test-runtime.yml | 8 ++++++++ 2 files changed, 15 insertions(+) diff --git a/.github/workflows/test-attach.yml b/.github/workflows/test-attach.yml index f89e1113..5d8ce80e 100644 --- a/.github/workflows/test-attach.yml +++ b/.github/workflows/test-attach.yml @@ -92,3 +92,10 @@ jobs: include-hidden-files: false path: | ./coverage-syscall-trace.info + - uses: codecov/codecov-action@v4 + with: + fail_ci_if_error: true # optional (default = false) + files: ./coverage-syscall-trace.info, ./coverage-uprobe.info # optional + flags: attach tests (uprobe & syscall trace) + token: ${{ secrets.CODECOV_TOKEN }} # required + verbose: true # optional (default = false) diff --git a/.github/workflows/test-runtime.yml b/.github/workflows/test-runtime.yml index 4ec2d130..a2ce689c 100644 --- a/.github/workflows/test-runtime.yml +++ b/.github/workflows/test-runtime.yml @@ -92,3 +92,11 @@ jobs: path: | ./coverage-runtime-mpk.info + - uses: codecov/codecov-action@v4 + with: + fail_ci_if_error: true # optional (default = false) + files: ./coverage-runtime.info + flags: runtime tests + token: ${{ secrets.CODECOV_TOKEN }} # required + verbose: true # optional (default = false) + \ No newline at end of file From a18d9c441980c40912ef9186287c1e0ac3da8984 Mon Sep 17 00:00:00 2001 From: kenlig <28685375+kenlig@users.noreply.github.com> Date: Sat, 28 Sep 2024 00:54:16 +0800 Subject: [PATCH 12/12] update --- .github/workflows/test-attach.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test-attach.yml b/.github/workflows/test-attach.yml index 5d8ce80e..a925f767 100644 --- a/.github/workflows/test-attach.yml +++ b/.github/workflows/test-attach.yml @@ -26,10 +26,10 @@ jobs: - uses: actions/checkout@v2 with: submodules: 'recursive' - - name: Install lcov + - name: Install dependencies if: "matrix.container == 'ubuntu-2204'" run: | - apt-get install -y lcov libzstd-dev libboost-all-dev + apt-get install -y lcov libzstd-dev libboost-all-dev gpg - name: Install lcov if: "matrix.container == 'fedora-39'" run: |