eunomia-bpf / bpftime

Userspace eBPF runtime for fast Uprobe & Syscall hook & Extensions with LLVM JIT
https://eunomia.dev/bpftime/
MIT License
693 stars 68 forks source link

test: use Catch2 and cmake for runtime tests #215

Closed Officeyutong closed 5 months ago

Officeyutong commented 5 months ago

This PR uses cmake and catch2 to organize all actively-maintained runtime tests:

So after this PR, we only need the following command to run runtime tests:

cmake -DBPFTIME_LLVM_JIT=YES -DBPFTIME_ENABLE_UNIT_TESTING=YES -DCMAKE_BUILD_TYPE=Release -B build
cmake --build build --config Release --target bpftime_runtime_tests
sudo ./build/runtime/unit-test/bpftime_runtime_tests

This PR also updates test-runtime.yml to adapt the new tests

Officeyutong commented 5 months ago

Are the deleted old unit tests already covered by the new unit tests?

If not, I think before this pr gets merged, we need to add more tests to ensure the coverage.

You can add new unit tests in another PR?

I've covered all old unit tests that were enabled in runtime/test/CMakeLists.txt

Other remained test sources seem to be obsoleted. They were not listed in the CMakeLists, and would not be executed when running make unit-test. And some of them were not enable to run under the current bpftime(used outdated functions). I kept them here for future purpose(e.g migrate those tests to the new unit test framework)