From 9455696f0ed01d54cf5b37e8f822d203a32ab266 Mon Sep 17 00:00:00 2001 From: yz <43207690+yzim@users.noreply.github.com> Date: Mon, 15 Jun 2026 23:11:28 +0800 Subject: [PATCH 01/21] Reorganize tests into unit and system suites --- .github/workflows/ci.yml | 94 +++++++++++++------ CMakeLists.txt | 76 +++++++-------- tests/{cas => system}/test_agentvfs_ctl.sh | 0 tests/{cas => system}/test_cas_10cp_ebpf.sh | 0 .../{cas => system}/test_cas_10cp_rollback.sh | 0 .../test_cas_backend_compare.sh | 0 tests/{cas => system}/test_cas_bootstrap.sh | 0 tests/{cas => system}/test_cas_bpftime.sh | 0 .../{cas => system}/test_cas_branch_merge.sh | 0 tests/{cas => system}/test_cas_branching.sh | 0 tests/{cas => system}/test_cas_fanotify.sh | 0 .../{cas => system}/test_cas_fh_lifecycle.cpp | 0 .../{cas => system}/test_cas_fh_lifecycle.sh | 0 tests/{cas => system}/test_cas_ldpreload.sh | 0 tests/{cas => system}/test_cas_lua.sh | 0 .../{cas => system}/test_cas_multi_backend.sh | 0 .../{cas => system}/test_cas_multi_branch.sh | 0 .../test_cas_multi_branch_ebpf.sh | 0 .../test_cas_multi_branch_merge.sh | 0 tests/{cas => system}/test_cas_ptrace.sh | 0 tests/{cas => system}/test_cas_smoke.sh | 0 tests/{cas => system}/test_cas_telemetry.sh | 0 .../test_cas_telemetry_ramp.sh | 0 tests/{cas => system}/test_cas_wasm.sh | 0 tests/{cas => system}/test_macos_e2e.sh | 0 .../test_quickstart_demo_smoke.sh | 0 tests/{cas => system}/test_start_sh.sh | 0 .../test_workspace_cli.sh} | 0 .../test_workspace_multi_branch.sh} | 0 .../windows/test_winfsp_e2e.ps1 | 0 tests/{cas => unit}/test_blake3_simd.cpp | 0 tests/{cas => unit}/test_bpftime_backend.cpp | 0 tests/{cas => unit}/test_branch_context.cpp | 0 tests/{cas => unit}/test_branch_merge.cpp | 0 .../test_branch_merge_commit.cpp | 0 .../test_branch_merge_daemon.cpp | 0 .../{cas => unit}/test_branch_persistence.cpp | 0 tests/{cas => unit}/test_ebpf_backend.cpp | 0 tests/{cas => unit}/test_fanotify_backend.cpp | 0 tests/{cas => unit}/test_fuse_t_preflight.cpp | 0 .../{cas => unit}/test_ldpreload_backend.cpp | 0 .../{cas => unit}/test_ldpreload_preload.cpp | 0 tests/{cas => unit}/test_lua_backend.cpp | 0 .../{cas => unit}/test_named_pipe_channel.cpp | 0 tests/{cas => unit}/test_object_store.cpp | 0 tests/{cas => unit}/test_ptrace_backend.cpp | 0 tests/{cas => unit}/test_telemetry_event.cpp | 0 .../{cas => unit}/test_telemetry_registry.cpp | 0 tests/{cas => unit}/test_wasm_backend.cpp | 0 tests/{cas => unit}/test_win_helpers.cpp | 0 tests/{cas => unit}/test_working_tree.cpp | 0 tests/{cas => unit}/test_workspace_cli.cpp | 0 tests/{cas => unit}/test_write_buffer.cpp | 0 53 files changed, 104 insertions(+), 66 deletions(-) rename tests/{cas => system}/test_agentvfs_ctl.sh (100%) rename tests/{cas => system}/test_cas_10cp_ebpf.sh (100%) rename tests/{cas => system}/test_cas_10cp_rollback.sh (100%) rename tests/{cas => system}/test_cas_backend_compare.sh (100%) rename tests/{cas => system}/test_cas_bootstrap.sh (100%) rename tests/{cas => system}/test_cas_bpftime.sh (100%) rename tests/{cas => system}/test_cas_branch_merge.sh (100%) rename tests/{cas => system}/test_cas_branching.sh (100%) rename tests/{cas => system}/test_cas_fanotify.sh (100%) rename tests/{cas => system}/test_cas_fh_lifecycle.cpp (100%) rename tests/{cas => system}/test_cas_fh_lifecycle.sh (100%) rename tests/{cas => system}/test_cas_ldpreload.sh (100%) rename tests/{cas => system}/test_cas_lua.sh (100%) rename tests/{cas => system}/test_cas_multi_backend.sh (100%) rename tests/{cas => system}/test_cas_multi_branch.sh (100%) rename tests/{cas => system}/test_cas_multi_branch_ebpf.sh (100%) rename tests/{cas => system}/test_cas_multi_branch_merge.sh (100%) rename tests/{cas => system}/test_cas_ptrace.sh (100%) rename tests/{cas => system}/test_cas_smoke.sh (100%) rename tests/{cas => system}/test_cas_telemetry.sh (100%) rename tests/{cas => system}/test_cas_telemetry_ramp.sh (100%) rename tests/{cas => system}/test_cas_wasm.sh (100%) rename tests/{cas => system}/test_macos_e2e.sh (100%) rename tests/{cas => system}/test_quickstart_demo_smoke.sh (100%) rename tests/{cas => system}/test_start_sh.sh (100%) rename tests/{cas/test_agentvfs_workspace.sh => system/test_workspace_cli.sh} (100%) rename tests/{cas/workspace_test.sh => system/test_workspace_multi_branch.sh} (100%) rename tests/{cas => system}/windows/test_winfsp_e2e.ps1 (100%) rename tests/{cas => unit}/test_blake3_simd.cpp (100%) rename tests/{cas => unit}/test_bpftime_backend.cpp (100%) rename tests/{cas => unit}/test_branch_context.cpp (100%) rename tests/{cas => unit}/test_branch_merge.cpp (100%) rename tests/{cas => unit}/test_branch_merge_commit.cpp (100%) rename tests/{cas => unit}/test_branch_merge_daemon.cpp (100%) rename tests/{cas => unit}/test_branch_persistence.cpp (100%) rename tests/{cas => unit}/test_ebpf_backend.cpp (100%) rename tests/{cas => unit}/test_fanotify_backend.cpp (100%) rename tests/{cas => unit}/test_fuse_t_preflight.cpp (100%) rename tests/{cas => unit}/test_ldpreload_backend.cpp (100%) rename tests/{cas => unit}/test_ldpreload_preload.cpp (100%) rename tests/{cas => unit}/test_lua_backend.cpp (100%) rename tests/{cas => unit}/test_named_pipe_channel.cpp (100%) rename tests/{cas => unit}/test_object_store.cpp (100%) rename tests/{cas => unit}/test_ptrace_backend.cpp (100%) rename tests/{cas => unit}/test_telemetry_event.cpp (100%) rename tests/{cas => unit}/test_telemetry_registry.cpp (100%) rename tests/{cas => unit}/test_wasm_backend.cpp (100%) rename tests/{cas => unit}/test_win_helpers.cpp (100%) rename tests/{cas => unit}/test_working_tree.cpp (100%) rename tests/{cas => unit}/test_workspace_cli.cpp (100%) rename tests/{cas => unit}/test_write_buffer.cpp (100%) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 07ba057..3f1afe0 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -7,7 +7,7 @@ on: branches: [main] jobs: - linux: + linux-unit-tests: runs-on: ubuntu-latest strategy: fail-fast: false @@ -16,7 +16,7 @@ jobs: - name: Install dependencies run: sudo apt-get update && sudo apt-get install -y libfuse3-dev fuse3 - name: Configure - run: cmake -B build -DAGENTVFS_EBPF=OFF + run: cmake -B build -DAGENTVFS_EBPF=OFF -DAGENTVFS_LDPRELOAD=ON - name: Build run: cmake --build build -j - name: Unit tests @@ -27,14 +27,22 @@ jobs: ./build/cas_test_branch_context ./build/cas_test_branch_merge ./build/cas_test_branch_merge_commit - ./build/cas_test_fh_lifecycle /tmp /tmp/test.sock || true ./build/cas_test_branch_merge_daemon || true ./build/cas_test_branch_persistence || true ./build/cas_test_blake3_simd ./build/cas_test_telemetry_event ./build/cas_test_telemetry_registry + ./build/cas_test_workspace_cli + ./build/cas_test_ebpf_backend + ./build/cas_test_fanotify_backend + ./build/cas_test_ptrace_backend + ./build/cas_test_ldpreload_backend + ./build/cas_test_bpftime_backend + ./build/cas_test_wasm_backend + ./build/cas_test_lua_backend + ./build/cas_test_ldpreload_preload - macos: + macos-unit-tests: runs-on: macos-latest strategy: fail-fast: false @@ -42,14 +50,11 @@ jobs: - uses: actions/checkout@v4 - name: Configure # AGENTVFS_FUSE_T defaults to ON on Apple; disable it here so this - # portable-only job doesn't require fuse-t (covered by macos-daemon). + # unit-only job doesn't require fuse-t. run: cmake -B build -DAGENTVFS_EBPF=OFF -DAGENTVFS_FUSE_T=OFF - name: Build run: cmake --build build -j - name: Unit tests - # macOS is UNIX, so every UNIX-gated test still builds and runs. - # The daemon target is Linux-only and is intentionally not built - # here. run: | ./build/cas_test_working_tree ./build/cas_test_write_buffer @@ -60,24 +65,19 @@ jobs: ./build/cas_test_blake3_simd ./build/cas_test_telemetry_event ./build/cas_test_telemetry_registry + ./build/cas_test_workspace_cli + ./build/cas_test_fuse_t_preflight - windows: + windows-unit-tests: runs-on: windows-latest strategy: fail-fast: false steps: - uses: actions/checkout@v4 - name: Configure - # AGENTVFS_WINFSP defaults to ON on Windows; explicitly disable it - # so this portable-only job doesn't require the WinFsp SDK. + # Build only unit targets here; WinFsp is reserved for system tests. run: cmake -B build -DAGENTVFS_EBPF=OFF -DAGENTVFS_WINFSP=OFF - name: Build - # Windows builds only the portable tests gated by the CMake - # if(UNIX)/if(LINUX) guards. The fh_lifecycle / object_store / - # branch_merge_commit / telemetry_registry / branch_persistence / - # branch_merge_daemon harnesses use POSIX-only APIs and are not - # available here. cas_core itself compiles via std::filesystem - # and the posix_compat.h shim. run: cmake --build build --config Release -j - name: Unit tests run: | @@ -87,8 +87,50 @@ jobs: .\build\Release\cas_test_branch_merge.exe .\build\Release\cas_test_blake3_simd.exe .\build\Release\cas_test_telemetry_event.exe + .\build\Release\cas_test_win_helpers.exe + .\build\Release\cas_test_named_pipe_channel.exe + + linux-system-tests: + runs-on: ubuntu-latest + strategy: + fail-fast: false + steps: + - uses: actions/checkout@v4 + - name: Install dependencies + run: sudo apt-get update && sudo apt-get install -y libfuse3-dev fuse3 netcat-openbsd + - name: Configure + run: cmake -B build -DAGENTVFS_EBPF=OFF -DAGENTVFS_FANOTIFY=ON -DAGENTVFS_PTRACE=ON -DAGENTVFS_LDPRELOAD=ON -DAGENTVFS_BPFTIME=ON -DAGENTVFS_WASM=ON -DAGENTVFS_LUA=ON + - name: Build + run: cmake --build build -j + - name: System tests + run: | + bash tests/system/test_agentvfs_ctl.sh + bash tests/system/test_workspace_cli.sh + bash tests/system/test_cas_smoke.sh + bash tests/system/test_cas_bootstrap.sh + bash tests/system/test_cas_fh_lifecycle.sh + bash tests/system/test_cas_branching.sh + bash tests/system/test_cas_branch_merge.sh + bash tests/system/test_cas_multi_branch.sh + bash tests/system/test_cas_multi_branch_merge.sh + bash tests/system/test_workspace_multi_branch.sh + bash tests/system/test_cas_10cp_rollback.sh + bash tests/system/test_cas_10cp_ebpf.sh + bash tests/system/test_cas_telemetry.sh + bash tests/system/test_cas_telemetry_ramp.sh + bash tests/system/test_cas_backend_compare.sh + bash tests/system/test_cas_multi_backend.sh + bash tests/system/test_cas_multi_branch_ebpf.sh + bash tests/system/test_cas_fanotify.sh + bash tests/system/test_cas_ptrace.sh + bash tests/system/test_cas_ldpreload.sh + bash tests/system/test_cas_bpftime.sh + bash tests/system/test_cas_lua.sh + bash tests/system/test_cas_wasm.sh + bash tests/system/test_start_sh.sh + bash tests/system/test_quickstart_demo_smoke.sh - windows-daemon: + windows-system-tests: runs-on: windows-latest strategy: { fail-fast: false } steps: @@ -114,15 +156,11 @@ jobs: run: cmake -B build -DAGENTVFS_EBPF=OFF -DAGENTVFS_WINFSP=ON - name: Build run: cmake --build build --config Release -j - - name: Windows unit tests - run: | - .\build\Release\cas_test_win_helpers.exe - .\build\Release\cas_test_named_pipe_channel.exe - - name: E2E test + - name: System tests shell: powershell - run: ./tests/cas/windows/test_winfsp_e2e.ps1 + run: ./tests/system/windows/test_winfsp_e2e.ps1 - macos-daemon: + macos-system-tests: runs-on: macos-latest strategy: { fail-fast: false } steps: @@ -133,7 +171,5 @@ jobs: run: cmake -B build -DAGENTVFS_EBPF=OFF -DAGENTVFS_FUSE_T=ON - name: Build run: cmake --build build -j - - name: Preflight unit test - run: ./build/cas_test_fuse_t_preflight - - name: E2E test - run: bash tests/cas/test_macos_e2e.sh + - name: System tests + run: bash tests/system/test_macos_e2e.sh diff --git a/CMakeLists.txt b/CMakeLists.txt index 52fd04e..b5044d2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -90,6 +90,23 @@ endif() option(AGENTVFS_WINFSP "Build the Windows daemon (requires WinFsp 2.0+ SDK)" ${WIN32}) +if(WIN32) + add_executable(cas_test_named_pipe_channel + tests/unit/test_named_pipe_channel.cpp + src/cas/platform/windows/named_pipe_channel.cpp) + target_include_directories(cas_test_named_pipe_channel PRIVATE + src src/cas) + target_compile_features(cas_test_named_pipe_channel PRIVATE cxx_std_17) + + add_executable(cas_test_win_helpers + tests/unit/test_win_helpers.cpp + src/cas/platform/windows/path_translation.cpp + src/cas/platform/windows/ntstatus_map.cpp) + target_include_directories(cas_test_win_helpers PRIVATE + src src/cas) + target_compile_features(cas_test_win_helpers PRIVATE cxx_std_17) +endif() + if(WIN32 AND AGENTVFS_WINFSP) find_path(WINFSP_INCLUDE_DIR NAMES winfsp/winfsp.h PATHS "$ENV{ProgramFiles}/WinFsp/inc" @@ -106,21 +123,6 @@ if(WIN32 AND AGENTVFS_WINFSP) "AGENTVFS_WINFSP=ON but WinFsp SDK not found. " "Install WinFsp 2.0+ from https://winfsp.dev.") endif() - - add_executable(cas_test_named_pipe_channel - tests/cas/test_named_pipe_channel.cpp - src/cas/platform/windows/named_pipe_channel.cpp) - target_include_directories(cas_test_named_pipe_channel PRIVATE - src src/cas) - target_compile_features(cas_test_named_pipe_channel PRIVATE cxx_std_17) - - add_executable(cas_test_win_helpers - tests/cas/test_win_helpers.cpp - src/cas/platform/windows/path_translation.cpp - src/cas/platform/windows/ntstatus_map.cpp) - target_include_directories(cas_test_win_helpers PRIVATE - src src/cas ${WINFSP_INCLUDE_DIR}) - target_compile_features(cas_test_win_helpers PRIVATE cxx_std_17) endif() # ── cas_core static library (always built) ───────────────────────── @@ -480,7 +482,7 @@ add_custom_target(uninstall if(UNIX) add_executable(cas_test_workspace_cli - tests/cas/test_workspace_cli.cpp + tests/unit/test_workspace_cli.cpp src/cas/workspace_cli.cpp) target_include_directories(cas_test_workspace_cli PRIVATE src/cas) if(NOT MSVC) @@ -497,7 +499,7 @@ endif() # UNIX if(APPLE) add_executable(cas_test_fuse_t_preflight - tests/cas/test_fuse_t_preflight.cpp + tests/unit/test_fuse_t_preflight.cpp src/cas/platform/macos/fuse_t_preflight.cpp) target_include_directories(cas_test_fuse_t_preflight PRIVATE src src/cas include) @@ -509,16 +511,16 @@ endif() endif() # ── CAS unit tests ────────────────────────────────────────────────── -add_executable(cas_test_working_tree tests/cas/test_working_tree.cpp) +add_executable(cas_test_working_tree tests/unit/test_working_tree.cpp) target_link_libraries(cas_test_working_tree PRIVATE cas_core) -add_executable(cas_test_write_buffer tests/cas/test_write_buffer.cpp) +add_executable(cas_test_write_buffer tests/unit/test_write_buffer.cpp) target_link_libraries(cas_test_write_buffer PRIVATE cas_core) # Uses POSIX /mkdtemp/lstat in its harness; gate to UNIX. The # cas_core APIs it exercises are themselves portable. if(UNIX) -add_executable(cas_test_object_store tests/cas/test_object_store.cpp) +add_executable(cas_test_object_store tests/unit/test_object_store.cpp) target_link_libraries(cas_test_object_store PRIVATE cas_core) endif() @@ -527,24 +529,24 @@ endif() # daemon — it cannot meaningfully run on Windows even after cas_core # itself compiles there. if(UNIX) -add_executable(cas_test_fh_lifecycle tests/cas/test_cas_fh_lifecycle.cpp) +add_executable(cas_test_fh_lifecycle tests/system/test_cas_fh_lifecycle.cpp) endif() -add_executable(cas_test_branch_context tests/cas/test_branch_context.cpp) +add_executable(cas_test_branch_context tests/unit/test_branch_context.cpp) target_link_libraries(cas_test_branch_context PRIVATE cas_core) -add_executable(cas_test_branch_merge tests/cas/test_branch_merge.cpp) +add_executable(cas_test_branch_merge tests/unit/test_branch_merge.cpp) target_link_libraries(cas_test_branch_merge PRIVATE cas_core) # Same as cas_test_object_store: harness uses POSIX directory APIs. if(UNIX) -add_executable(cas_test_branch_merge_commit tests/cas/test_branch_merge_commit.cpp) +add_executable(cas_test_branch_merge_commit tests/unit/test_branch_merge_commit.cpp) target_link_libraries(cas_test_branch_merge_commit PRIVATE cas_core) endif() if(UNIX) add_executable(cas_test_branch_merge_daemon - tests/cas/test_branch_merge_daemon.cpp + tests/unit/test_branch_merge_daemon.cpp tests/cas/ebpf_loader_stub.cpp) target_link_libraries(cas_test_branch_merge_daemon PRIVATE cas_core) if(AGENTVFS_EBPF) @@ -552,7 +554,7 @@ if(AGENTVFS_EBPF) endif() add_executable(cas_test_branch_persistence - tests/cas/test_branch_persistence.cpp + tests/unit/test_branch_persistence.cpp tests/cas/ebpf_loader_stub.cpp) target_link_libraries(cas_test_branch_persistence PRIVATE cas_core) if(AGENTVFS_EBPF) @@ -560,25 +562,25 @@ if(AGENTVFS_EBPF) endif() endif() # UNIX -add_executable(cas_test_telemetry_event tests/cas/test_telemetry_event.cpp src/cas/telemetry_event.cpp) +add_executable(cas_test_telemetry_event tests/unit/test_telemetry_event.cpp src/cas/telemetry_event.cpp) target_include_directories(cas_test_telemetry_event PRIVATE include src src/cas) target_compile_features(cas_test_telemetry_event PRIVATE cxx_std_17) # Uses fork()/waitpid() in the harness; gate to UNIX. if(UNIX) -add_executable(cas_test_telemetry_registry tests/cas/test_telemetry_registry.cpp src/cas/telemetry_registry.cpp src/cas/telemetry_event.cpp) +add_executable(cas_test_telemetry_registry tests/unit/test_telemetry_registry.cpp src/cas/telemetry_registry.cpp src/cas/telemetry_event.cpp) target_include_directories(cas_test_telemetry_registry PRIVATE include src src/cas) target_compile_features(cas_test_telemetry_registry PRIVATE cxx_std_17) endif() if(AGENTVFS_BLAKE3_SIMD) -add_executable(cas_test_blake3_simd tests/cas/test_blake3_simd.cpp) +add_executable(cas_test_blake3_simd tests/unit/test_blake3_simd.cpp) target_link_libraries(cas_test_blake3_simd PRIVATE cas_core) endif() if(LINUX) add_executable(cas_test_ebpf_backend - tests/cas/test_ebpf_backend.cpp + tests/unit/test_ebpf_backend.cpp src/cas/backends/ebpf_backend.cpp src/cas/ebpf_loader.cpp) target_include_directories(cas_test_ebpf_backend PRIVATE include src src/cas) @@ -592,7 +594,7 @@ if(AGENTVFS_EBPF) endif() add_executable(cas_test_fanotify_backend - tests/cas/test_fanotify_backend.cpp + tests/unit/test_fanotify_backend.cpp src/cas/backends/fanotify_backend.cpp src/cas/telemetry_event.cpp) target_include_directories(cas_test_fanotify_backend PRIVATE include src src/cas) @@ -603,7 +605,7 @@ if(AGENTVFS_FANOTIFY) endif() add_executable(cas_test_ptrace_backend - tests/cas/test_ptrace_backend.cpp + tests/unit/test_ptrace_backend.cpp src/cas/backends/ptrace_backend.cpp src/cas/telemetry_event.cpp) target_include_directories(cas_test_ptrace_backend PRIVATE include src src/cas) @@ -614,7 +616,7 @@ if(AGENTVFS_PTRACE) endif() add_executable(cas_test_ldpreload_backend - tests/cas/test_ldpreload_backend.cpp + tests/unit/test_ldpreload_backend.cpp src/cas/backends/ldpreload_backend.cpp src/cas/telemetry_event.cpp) target_include_directories(cas_test_ldpreload_backend PRIVATE include src src/cas) @@ -625,7 +627,7 @@ if(AGENTVFS_LDPRELOAD) endif() add_executable(cas_test_bpftime_backend - tests/cas/test_bpftime_backend.cpp + tests/unit/test_bpftime_backend.cpp src/cas/backends/bpftime_backend.cpp) target_include_directories(cas_test_bpftime_backend PRIVATE include src src/cas) target_link_libraries(cas_test_bpftime_backend PRIVATE Threads::Threads) @@ -635,7 +637,7 @@ if(AGENTVFS_BPFTIME) endif() add_executable(cas_test_wasm_backend - tests/cas/test_wasm_backend.cpp + tests/unit/test_wasm_backend.cpp src/cas/backends/wasm_backend.cpp) target_include_directories(cas_test_wasm_backend PRIVATE include src src/cas) target_compile_features(cas_test_wasm_backend PRIVATE cxx_std_17) @@ -644,7 +646,7 @@ if(AGENTVFS_WASM) endif() add_executable(cas_test_lua_backend - tests/cas/test_lua_backend.cpp + tests/unit/test_lua_backend.cpp src/cas/backends/lua_backend.cpp) target_include_directories(cas_test_lua_backend PRIVATE include src src/cas) target_compile_features(cas_test_lua_backend PRIVATE cxx_std_17) @@ -654,7 +656,7 @@ endif() if(AGENTVFS_LDPRELOAD) add_executable(cas_test_ldpreload_preload - tests/cas/test_ldpreload_preload.cpp) + tests/unit/test_ldpreload_preload.cpp) target_include_directories(cas_test_ldpreload_preload PRIVATE include src src/cas) target_link_libraries(cas_test_ldpreload_preload PRIVATE dl Threads::Threads) target_compile_features(cas_test_ldpreload_preload PRIVATE cxx_std_17) diff --git a/tests/cas/test_agentvfs_ctl.sh b/tests/system/test_agentvfs_ctl.sh similarity index 100% rename from tests/cas/test_agentvfs_ctl.sh rename to tests/system/test_agentvfs_ctl.sh diff --git a/tests/cas/test_cas_10cp_ebpf.sh b/tests/system/test_cas_10cp_ebpf.sh similarity index 100% rename from tests/cas/test_cas_10cp_ebpf.sh rename to tests/system/test_cas_10cp_ebpf.sh diff --git a/tests/cas/test_cas_10cp_rollback.sh b/tests/system/test_cas_10cp_rollback.sh similarity index 100% rename from tests/cas/test_cas_10cp_rollback.sh rename to tests/system/test_cas_10cp_rollback.sh diff --git a/tests/cas/test_cas_backend_compare.sh b/tests/system/test_cas_backend_compare.sh similarity index 100% rename from tests/cas/test_cas_backend_compare.sh rename to tests/system/test_cas_backend_compare.sh diff --git a/tests/cas/test_cas_bootstrap.sh b/tests/system/test_cas_bootstrap.sh similarity index 100% rename from tests/cas/test_cas_bootstrap.sh rename to tests/system/test_cas_bootstrap.sh diff --git a/tests/cas/test_cas_bpftime.sh b/tests/system/test_cas_bpftime.sh similarity index 100% rename from tests/cas/test_cas_bpftime.sh rename to tests/system/test_cas_bpftime.sh diff --git a/tests/cas/test_cas_branch_merge.sh b/tests/system/test_cas_branch_merge.sh similarity index 100% rename from tests/cas/test_cas_branch_merge.sh rename to tests/system/test_cas_branch_merge.sh diff --git a/tests/cas/test_cas_branching.sh b/tests/system/test_cas_branching.sh similarity index 100% rename from tests/cas/test_cas_branching.sh rename to tests/system/test_cas_branching.sh diff --git a/tests/cas/test_cas_fanotify.sh b/tests/system/test_cas_fanotify.sh similarity index 100% rename from tests/cas/test_cas_fanotify.sh rename to tests/system/test_cas_fanotify.sh diff --git a/tests/cas/test_cas_fh_lifecycle.cpp b/tests/system/test_cas_fh_lifecycle.cpp similarity index 100% rename from tests/cas/test_cas_fh_lifecycle.cpp rename to tests/system/test_cas_fh_lifecycle.cpp diff --git a/tests/cas/test_cas_fh_lifecycle.sh b/tests/system/test_cas_fh_lifecycle.sh similarity index 100% rename from tests/cas/test_cas_fh_lifecycle.sh rename to tests/system/test_cas_fh_lifecycle.sh diff --git a/tests/cas/test_cas_ldpreload.sh b/tests/system/test_cas_ldpreload.sh similarity index 100% rename from tests/cas/test_cas_ldpreload.sh rename to tests/system/test_cas_ldpreload.sh diff --git a/tests/cas/test_cas_lua.sh b/tests/system/test_cas_lua.sh similarity index 100% rename from tests/cas/test_cas_lua.sh rename to tests/system/test_cas_lua.sh diff --git a/tests/cas/test_cas_multi_backend.sh b/tests/system/test_cas_multi_backend.sh similarity index 100% rename from tests/cas/test_cas_multi_backend.sh rename to tests/system/test_cas_multi_backend.sh diff --git a/tests/cas/test_cas_multi_branch.sh b/tests/system/test_cas_multi_branch.sh similarity index 100% rename from tests/cas/test_cas_multi_branch.sh rename to tests/system/test_cas_multi_branch.sh diff --git a/tests/cas/test_cas_multi_branch_ebpf.sh b/tests/system/test_cas_multi_branch_ebpf.sh similarity index 100% rename from tests/cas/test_cas_multi_branch_ebpf.sh rename to tests/system/test_cas_multi_branch_ebpf.sh diff --git a/tests/cas/test_cas_multi_branch_merge.sh b/tests/system/test_cas_multi_branch_merge.sh similarity index 100% rename from tests/cas/test_cas_multi_branch_merge.sh rename to tests/system/test_cas_multi_branch_merge.sh diff --git a/tests/cas/test_cas_ptrace.sh b/tests/system/test_cas_ptrace.sh similarity index 100% rename from tests/cas/test_cas_ptrace.sh rename to tests/system/test_cas_ptrace.sh diff --git a/tests/cas/test_cas_smoke.sh b/tests/system/test_cas_smoke.sh similarity index 100% rename from tests/cas/test_cas_smoke.sh rename to tests/system/test_cas_smoke.sh diff --git a/tests/cas/test_cas_telemetry.sh b/tests/system/test_cas_telemetry.sh similarity index 100% rename from tests/cas/test_cas_telemetry.sh rename to tests/system/test_cas_telemetry.sh diff --git a/tests/cas/test_cas_telemetry_ramp.sh b/tests/system/test_cas_telemetry_ramp.sh similarity index 100% rename from tests/cas/test_cas_telemetry_ramp.sh rename to tests/system/test_cas_telemetry_ramp.sh diff --git a/tests/cas/test_cas_wasm.sh b/tests/system/test_cas_wasm.sh similarity index 100% rename from tests/cas/test_cas_wasm.sh rename to tests/system/test_cas_wasm.sh diff --git a/tests/cas/test_macos_e2e.sh b/tests/system/test_macos_e2e.sh similarity index 100% rename from tests/cas/test_macos_e2e.sh rename to tests/system/test_macos_e2e.sh diff --git a/tests/cas/test_quickstart_demo_smoke.sh b/tests/system/test_quickstart_demo_smoke.sh similarity index 100% rename from tests/cas/test_quickstart_demo_smoke.sh rename to tests/system/test_quickstart_demo_smoke.sh diff --git a/tests/cas/test_start_sh.sh b/tests/system/test_start_sh.sh similarity index 100% rename from tests/cas/test_start_sh.sh rename to tests/system/test_start_sh.sh diff --git a/tests/cas/test_agentvfs_workspace.sh b/tests/system/test_workspace_cli.sh similarity index 100% rename from tests/cas/test_agentvfs_workspace.sh rename to tests/system/test_workspace_cli.sh diff --git a/tests/cas/workspace_test.sh b/tests/system/test_workspace_multi_branch.sh similarity index 100% rename from tests/cas/workspace_test.sh rename to tests/system/test_workspace_multi_branch.sh diff --git a/tests/cas/windows/test_winfsp_e2e.ps1 b/tests/system/windows/test_winfsp_e2e.ps1 similarity index 100% rename from tests/cas/windows/test_winfsp_e2e.ps1 rename to tests/system/windows/test_winfsp_e2e.ps1 diff --git a/tests/cas/test_blake3_simd.cpp b/tests/unit/test_blake3_simd.cpp similarity index 100% rename from tests/cas/test_blake3_simd.cpp rename to tests/unit/test_blake3_simd.cpp diff --git a/tests/cas/test_bpftime_backend.cpp b/tests/unit/test_bpftime_backend.cpp similarity index 100% rename from tests/cas/test_bpftime_backend.cpp rename to tests/unit/test_bpftime_backend.cpp diff --git a/tests/cas/test_branch_context.cpp b/tests/unit/test_branch_context.cpp similarity index 100% rename from tests/cas/test_branch_context.cpp rename to tests/unit/test_branch_context.cpp diff --git a/tests/cas/test_branch_merge.cpp b/tests/unit/test_branch_merge.cpp similarity index 100% rename from tests/cas/test_branch_merge.cpp rename to tests/unit/test_branch_merge.cpp diff --git a/tests/cas/test_branch_merge_commit.cpp b/tests/unit/test_branch_merge_commit.cpp similarity index 100% rename from tests/cas/test_branch_merge_commit.cpp rename to tests/unit/test_branch_merge_commit.cpp diff --git a/tests/cas/test_branch_merge_daemon.cpp b/tests/unit/test_branch_merge_daemon.cpp similarity index 100% rename from tests/cas/test_branch_merge_daemon.cpp rename to tests/unit/test_branch_merge_daemon.cpp diff --git a/tests/cas/test_branch_persistence.cpp b/tests/unit/test_branch_persistence.cpp similarity index 100% rename from tests/cas/test_branch_persistence.cpp rename to tests/unit/test_branch_persistence.cpp diff --git a/tests/cas/test_ebpf_backend.cpp b/tests/unit/test_ebpf_backend.cpp similarity index 100% rename from tests/cas/test_ebpf_backend.cpp rename to tests/unit/test_ebpf_backend.cpp diff --git a/tests/cas/test_fanotify_backend.cpp b/tests/unit/test_fanotify_backend.cpp similarity index 100% rename from tests/cas/test_fanotify_backend.cpp rename to tests/unit/test_fanotify_backend.cpp diff --git a/tests/cas/test_fuse_t_preflight.cpp b/tests/unit/test_fuse_t_preflight.cpp similarity index 100% rename from tests/cas/test_fuse_t_preflight.cpp rename to tests/unit/test_fuse_t_preflight.cpp diff --git a/tests/cas/test_ldpreload_backend.cpp b/tests/unit/test_ldpreload_backend.cpp similarity index 100% rename from tests/cas/test_ldpreload_backend.cpp rename to tests/unit/test_ldpreload_backend.cpp diff --git a/tests/cas/test_ldpreload_preload.cpp b/tests/unit/test_ldpreload_preload.cpp similarity index 100% rename from tests/cas/test_ldpreload_preload.cpp rename to tests/unit/test_ldpreload_preload.cpp diff --git a/tests/cas/test_lua_backend.cpp b/tests/unit/test_lua_backend.cpp similarity index 100% rename from tests/cas/test_lua_backend.cpp rename to tests/unit/test_lua_backend.cpp diff --git a/tests/cas/test_named_pipe_channel.cpp b/tests/unit/test_named_pipe_channel.cpp similarity index 100% rename from tests/cas/test_named_pipe_channel.cpp rename to tests/unit/test_named_pipe_channel.cpp diff --git a/tests/cas/test_object_store.cpp b/tests/unit/test_object_store.cpp similarity index 100% rename from tests/cas/test_object_store.cpp rename to tests/unit/test_object_store.cpp diff --git a/tests/cas/test_ptrace_backend.cpp b/tests/unit/test_ptrace_backend.cpp similarity index 100% rename from tests/cas/test_ptrace_backend.cpp rename to tests/unit/test_ptrace_backend.cpp diff --git a/tests/cas/test_telemetry_event.cpp b/tests/unit/test_telemetry_event.cpp similarity index 100% rename from tests/cas/test_telemetry_event.cpp rename to tests/unit/test_telemetry_event.cpp diff --git a/tests/cas/test_telemetry_registry.cpp b/tests/unit/test_telemetry_registry.cpp similarity index 100% rename from tests/cas/test_telemetry_registry.cpp rename to tests/unit/test_telemetry_registry.cpp diff --git a/tests/cas/test_wasm_backend.cpp b/tests/unit/test_wasm_backend.cpp similarity index 100% rename from tests/cas/test_wasm_backend.cpp rename to tests/unit/test_wasm_backend.cpp diff --git a/tests/cas/test_win_helpers.cpp b/tests/unit/test_win_helpers.cpp similarity index 100% rename from tests/cas/test_win_helpers.cpp rename to tests/unit/test_win_helpers.cpp diff --git a/tests/cas/test_working_tree.cpp b/tests/unit/test_working_tree.cpp similarity index 100% rename from tests/cas/test_working_tree.cpp rename to tests/unit/test_working_tree.cpp diff --git a/tests/cas/test_workspace_cli.cpp b/tests/unit/test_workspace_cli.cpp similarity index 100% rename from tests/cas/test_workspace_cli.cpp rename to tests/unit/test_workspace_cli.cpp diff --git a/tests/cas/test_write_buffer.cpp b/tests/unit/test_write_buffer.cpp similarity index 100% rename from tests/cas/test_write_buffer.cpp rename to tests/unit/test_write_buffer.cpp From bb48ef9237f121a032f44eba8422c41d2541ea78 Mon Sep 17 00:00:00 2001 From: yz <43207690+yzim@users.noreply.github.com> Date: Mon, 15 Jun 2026 23:21:33 +0800 Subject: [PATCH 02/21] Skip workspace multi-branch test when root is unavailable --- tests/system/test_workspace_multi_branch.sh | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/tests/system/test_workspace_multi_branch.sh b/tests/system/test_workspace_multi_branch.sh index 2af805d..355c055 100755 --- a/tests/system/test_workspace_multi_branch.sh +++ b/tests/system/test_workspace_multi_branch.sh @@ -1,6 +1,6 @@ #!/bin/bash # 5 branches x 5 checkpoints + rollback + merge through `agentvfs workspace`. -# Run: sudo bash workspace_test.sh +# Run: bash tests/system/test_workspace_multi_branch.sh set -euo pipefail BIN_DIR="${BIN_DIR:-$(pwd)/build}" @@ -10,7 +10,10 @@ ROOT="${ROOT:-/tmp/agentvfs-ws-test}" NAME="cas-test" CG_BASE="/sys/fs/cgroup/agentvfs-ws-test-$$" -[[ $EUID -eq 0 ]] || { echo "re-run with sudo: sudo bash $0"; exit 1; } +if [[ $EUID -ne 0 ]]; then + echo "SKIP test_workspace_multi_branch: needs root for cgroup creation" + exit 0 +fi [[ -x "$AGENTVFS" ]] || { echo "missing $AGENTVFS — build first: cmake -B build && cmake --build build -j"; exit 1; } [[ -x "$CTL" ]] || { echo "missing $CTL"; exit 1; } From 741a5030fa9d8f0fc37b32f0e8be9e1b1cd692ae Mon Sep 17 00:00:00 2001 From: yz <43207690+yzim@users.noreply.github.com> Date: Mon, 15 Jun 2026 23:25:39 +0800 Subject: [PATCH 03/21] Fix telemetry ramp test build path --- tests/system/test_cas_telemetry_ramp.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/system/test_cas_telemetry_ramp.sh b/tests/system/test_cas_telemetry_ramp.sh index e43fc2f..68b4e2e 100755 --- a/tests/system/test_cas_telemetry_ramp.sh +++ b/tests/system/test_cas_telemetry_ramp.sh @@ -12,8 +12,8 @@ # pipeline-failure protection while letting `pass`/`fail` count outcomes freely. set -uo pipefail -BIN="${BIN:-$(pwd)/build-all/agentvfs}" -PRELOAD_LIB="${PRELOAD_LIB:-$(pwd)/build-all/libcas_preload.so}" +BIN="${BIN:-$(pwd)/build/agentvfs}" +PRELOAD_LIB="${PRELOAD_LIB:-$(pwd)/build/libcas_preload.so}" ROOT="${ROOT:-/tmp/agentvfs-ramp}" RAMP_LIMIT="${RAMP_LIMIT:-7}" # stop after iteration N (dev/CI smoke) RAMP_NEGATIVE="${RAMP_NEGATIVE:-0}" From a52968e685aa1b64be02ba0775fde32206601ef8 Mon Sep 17 00:00:00 2001 From: yz <43207690+yzim@users.noreply.github.com> Date: Mon, 15 Jun 2026 23:30:32 +0800 Subject: [PATCH 04/21] Use built agentvfs in start.sh system tests --- tests/system/test_quickstart_demo_smoke.sh | 1 + tests/system/test_start_sh.sh | 1 + 2 files changed, 2 insertions(+) diff --git a/tests/system/test_quickstart_demo_smoke.sh b/tests/system/test_quickstart_demo_smoke.sh index 9798bc9..ce0e5a3 100755 --- a/tests/system/test_quickstart_demo_smoke.sh +++ b/tests/system/test_quickstart_demo_smoke.sh @@ -10,6 +10,7 @@ set -euo pipefail REPO_ROOT="$(cd "$(dirname "$0")/../.." && pwd)" SCRIPT="$REPO_ROOT/demo/agentvfs-quickstart.sh" +export PATH="$REPO_ROOT/build:$PATH" if [[ ! -x "$SCRIPT" ]]; then echo "FAIL: $SCRIPT not found or not executable" >&2 diff --git a/tests/system/test_start_sh.sh b/tests/system/test_start_sh.sh index 422bd9f..fe8d136 100755 --- a/tests/system/test_start_sh.sh +++ b/tests/system/test_start_sh.sh @@ -8,6 +8,7 @@ BIN="${BIN:-$REPO/build/agentvfs}" WORK="$(mktemp -d)" export HOME="$WORK/home" export XDG_RUNTIME_DIR="$WORK/xdg" +export PATH="$REPO/build:$PATH" mkdir -p "$HOME" "$XDG_RUNTIME_DIR" cleanup() { From e4706e431830fc2acad38642ce59df3aad912f8b Mon Sep 17 00:00:00 2001 From: yz <43207690+yzim@users.noreply.github.com> Date: Mon, 15 Jun 2026 23:43:49 +0800 Subject: [PATCH 05/21] Extract test CMake targets into tests/CMakeLists.txt --- CMakeLists.txt | 203 +------------------- tests/CMakeLists.txt | 193 +++++++++++++++++++ tests/{cas => }/fixtures/test_filter.wat | 0 tests/{cas => }/fixtures/test_policy.lua | 0 tests/{cas => support}/ebpf_loader_stub.cpp | 0 tests/system/test_cas_lua.sh | 2 +- tests/system/test_cas_telemetry_ramp.sh | 2 +- tests/system/test_cas_wasm.sh | 2 +- tests/unit/test_lua_backend.cpp | 2 +- 9 files changed, 198 insertions(+), 206 deletions(-) create mode 100644 tests/CMakeLists.txt rename tests/{cas => }/fixtures/test_filter.wat (100%) rename tests/{cas => }/fixtures/test_policy.lua (100%) rename tests/{cas => support}/ebpf_loader_stub.cpp (100%) diff --git a/CMakeLists.txt b/CMakeLists.txt index b5044d2..dfcaa77 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -90,23 +90,6 @@ endif() option(AGENTVFS_WINFSP "Build the Windows daemon (requires WinFsp 2.0+ SDK)" ${WIN32}) -if(WIN32) - add_executable(cas_test_named_pipe_channel - tests/unit/test_named_pipe_channel.cpp - src/cas/platform/windows/named_pipe_channel.cpp) - target_include_directories(cas_test_named_pipe_channel PRIVATE - src src/cas) - target_compile_features(cas_test_named_pipe_channel PRIVATE cxx_std_17) - - add_executable(cas_test_win_helpers - tests/unit/test_win_helpers.cpp - src/cas/platform/windows/path_translation.cpp - src/cas/platform/windows/ntstatus_map.cpp) - target_include_directories(cas_test_win_helpers PRIVATE - src src/cas) - target_compile_features(cas_test_win_helpers PRIVATE cxx_std_17) -endif() - if(WIN32 AND AGENTVFS_WINFSP) find_path(WINFSP_INCLUDE_DIR NAMES winfsp/winfsp.h PATHS "$ENV{ProgramFiles}/WinFsp/inc" @@ -480,188 +463,4 @@ add_custom_target(uninstall COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake COMMENT "Removing files listed in install_manifest.txt") -if(UNIX) -add_executable(cas_test_workspace_cli - tests/unit/test_workspace_cli.cpp - src/cas/workspace_cli.cpp) -target_include_directories(cas_test_workspace_cli PRIVATE src/cas) -if(NOT MSVC) - target_compile_options(cas_test_workspace_cli PRIVATE -Wall -Wextra -Wpedantic) -endif() -target_link_libraries(cas_test_workspace_cli PRIVATE Threads::Threads) -if(AGENTVFS_EBPF) - target_compile_definitions(cas_test_workspace_cli PRIVATE AGENTVFS_EBPF=1) -endif() -if(AGENTVFS_FANOTIFY) - target_compile_definitions(cas_test_workspace_cli PRIVATE AGENTVFS_FANOTIFY=1) -endif() -endif() # UNIX - -if(APPLE) -add_executable(cas_test_fuse_t_preflight - tests/unit/test_fuse_t_preflight.cpp - src/cas/platform/macos/fuse_t_preflight.cpp) -target_include_directories(cas_test_fuse_t_preflight PRIVATE - src src/cas include) -target_compile_features(cas_test_fuse_t_preflight PRIVATE cxx_std_17) -if(NOT MSVC) - target_compile_options(cas_test_fuse_t_preflight PRIVATE - -Wall -Wextra -Wpedantic) -endif() -endif() - -# ── CAS unit tests ────────────────────────────────────────────────── -add_executable(cas_test_working_tree tests/unit/test_working_tree.cpp) -target_link_libraries(cas_test_working_tree PRIVATE cas_core) - -add_executable(cas_test_write_buffer tests/unit/test_write_buffer.cpp) -target_link_libraries(cas_test_write_buffer PRIVATE cas_core) - -# Uses POSIX /mkdtemp/lstat in its harness; gate to UNIX. The -# cas_core APIs it exercises are themselves portable. -if(UNIX) -add_executable(cas_test_object_store tests/unit/test_object_store.cpp) -target_link_libraries(cas_test_object_store PRIVATE cas_core) -endif() - -# Harness uses only POSIX syscalls; no cas_core link needed. Gated to -# UNIX because the test is an AF_UNIX integration client of a running -# daemon — it cannot meaningfully run on Windows even after cas_core -# itself compiles there. -if(UNIX) -add_executable(cas_test_fh_lifecycle tests/system/test_cas_fh_lifecycle.cpp) -endif() - -add_executable(cas_test_branch_context tests/unit/test_branch_context.cpp) -target_link_libraries(cas_test_branch_context PRIVATE cas_core) - -add_executable(cas_test_branch_merge tests/unit/test_branch_merge.cpp) -target_link_libraries(cas_test_branch_merge PRIVATE cas_core) - -# Same as cas_test_object_store: harness uses POSIX directory APIs. -if(UNIX) -add_executable(cas_test_branch_merge_commit tests/unit/test_branch_merge_commit.cpp) -target_link_libraries(cas_test_branch_merge_commit PRIVATE cas_core) -endif() - -if(UNIX) -add_executable(cas_test_branch_merge_daemon - tests/unit/test_branch_merge_daemon.cpp - tests/cas/ebpf_loader_stub.cpp) -target_link_libraries(cas_test_branch_merge_daemon PRIVATE cas_core) -if(AGENTVFS_EBPF) - target_link_libraries(cas_test_branch_merge_daemon PRIVATE ${LIBBPF_LIBRARIES} elf z) -endif() - -add_executable(cas_test_branch_persistence - tests/unit/test_branch_persistence.cpp - tests/cas/ebpf_loader_stub.cpp) -target_link_libraries(cas_test_branch_persistence PRIVATE cas_core) -if(AGENTVFS_EBPF) - target_link_libraries(cas_test_branch_persistence PRIVATE ${LIBBPF_LIBRARIES} elf z) -endif() -endif() # UNIX - -add_executable(cas_test_telemetry_event tests/unit/test_telemetry_event.cpp src/cas/telemetry_event.cpp) -target_include_directories(cas_test_telemetry_event PRIVATE include src src/cas) -target_compile_features(cas_test_telemetry_event PRIVATE cxx_std_17) - -# Uses fork()/waitpid() in the harness; gate to UNIX. -if(UNIX) -add_executable(cas_test_telemetry_registry tests/unit/test_telemetry_registry.cpp src/cas/telemetry_registry.cpp src/cas/telemetry_event.cpp) -target_include_directories(cas_test_telemetry_registry PRIVATE include src src/cas) -target_compile_features(cas_test_telemetry_registry PRIVATE cxx_std_17) -endif() - -if(AGENTVFS_BLAKE3_SIMD) -add_executable(cas_test_blake3_simd tests/unit/test_blake3_simd.cpp) -target_link_libraries(cas_test_blake3_simd PRIVATE cas_core) -endif() - -if(LINUX) -add_executable(cas_test_ebpf_backend - tests/unit/test_ebpf_backend.cpp - src/cas/backends/ebpf_backend.cpp - src/cas/ebpf_loader.cpp) -target_include_directories(cas_test_ebpf_backend PRIVATE include src src/cas) -target_link_libraries(cas_test_ebpf_backend PRIVATE cas_core) -target_compile_features(cas_test_ebpf_backend PRIVATE cxx_std_17) -if(AGENTVFS_EBPF) - target_include_directories(cas_test_ebpf_backend PRIVATE - ${LIBBPF_INCLUDE_DIRS} ${CMAKE_CURRENT_BINARY_DIR}) - target_link_libraries(cas_test_ebpf_backend PRIVATE ${LIBBPF_LIBRARIES} elf z) - add_dependencies(cas_test_ebpf_backend cas_bpf_skel) -endif() - -add_executable(cas_test_fanotify_backend - tests/unit/test_fanotify_backend.cpp - src/cas/backends/fanotify_backend.cpp - src/cas/telemetry_event.cpp) -target_include_directories(cas_test_fanotify_backend PRIVATE include src src/cas) -target_link_libraries(cas_test_fanotify_backend PRIVATE Threads::Threads) -target_compile_features(cas_test_fanotify_backend PRIVATE cxx_std_17) -if(AGENTVFS_FANOTIFY) - target_compile_definitions(cas_test_fanotify_backend PRIVATE AGENTVFS_FANOTIFY=1) -endif() - -add_executable(cas_test_ptrace_backend - tests/unit/test_ptrace_backend.cpp - src/cas/backends/ptrace_backend.cpp - src/cas/telemetry_event.cpp) -target_include_directories(cas_test_ptrace_backend PRIVATE include src src/cas) -target_link_libraries(cas_test_ptrace_backend PRIVATE Threads::Threads) -target_compile_features(cas_test_ptrace_backend PRIVATE cxx_std_17) -if(AGENTVFS_PTRACE) - target_compile_definitions(cas_test_ptrace_backend PRIVATE AGENTVFS_PTRACE=1) -endif() - -add_executable(cas_test_ldpreload_backend - tests/unit/test_ldpreload_backend.cpp - src/cas/backends/ldpreload_backend.cpp - src/cas/telemetry_event.cpp) -target_include_directories(cas_test_ldpreload_backend PRIVATE include src src/cas) -target_link_libraries(cas_test_ldpreload_backend PRIVATE Threads::Threads) -target_compile_features(cas_test_ldpreload_backend PRIVATE cxx_std_17) -if(AGENTVFS_LDPRELOAD) - target_compile_definitions(cas_test_ldpreload_backend PRIVATE AGENTVFS_LDPRELOAD=1) -endif() - -add_executable(cas_test_bpftime_backend - tests/unit/test_bpftime_backend.cpp - src/cas/backends/bpftime_backend.cpp) -target_include_directories(cas_test_bpftime_backend PRIVATE include src src/cas) -target_link_libraries(cas_test_bpftime_backend PRIVATE Threads::Threads) -target_compile_features(cas_test_bpftime_backend PRIVATE cxx_std_17) -if(AGENTVFS_BPFTIME) - target_compile_definitions(cas_test_bpftime_backend PRIVATE AGENTVFS_BPFTIME=1) -endif() - -add_executable(cas_test_wasm_backend - tests/unit/test_wasm_backend.cpp - src/cas/backends/wasm_backend.cpp) -target_include_directories(cas_test_wasm_backend PRIVATE include src src/cas) -target_compile_features(cas_test_wasm_backend PRIVATE cxx_std_17) -if(AGENTVFS_WASM) - target_compile_definitions(cas_test_wasm_backend PRIVATE AGENTVFS_WASM=1) -endif() - -add_executable(cas_test_lua_backend - tests/unit/test_lua_backend.cpp - src/cas/backends/lua_backend.cpp) -target_include_directories(cas_test_lua_backend PRIVATE include src src/cas) -target_compile_features(cas_test_lua_backend PRIVATE cxx_std_17) -if(AGENTVFS_LUA) - target_compile_definitions(cas_test_lua_backend PRIVATE AGENTVFS_LUA=1) -endif() - -if(AGENTVFS_LDPRELOAD) - add_executable(cas_test_ldpreload_preload - tests/unit/test_ldpreload_preload.cpp) - target_include_directories(cas_test_ldpreload_preload PRIVATE include src src/cas) - target_link_libraries(cas_test_ldpreload_preload PRIVATE dl Threads::Threads) - target_compile_features(cas_test_ldpreload_preload PRIVATE cxx_std_17) - target_compile_definitions(cas_test_ldpreload_preload PRIVATE - CAS_PRELOAD_LIB="${CMAKE_CURRENT_BINARY_DIR}/libcas_preload.so") - add_dependencies(cas_test_ldpreload_preload cas_preload) -endif() -endif() # LINUX +add_subdirectory(tests) diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt new file mode 100644 index 0000000..07e5f98 --- /dev/null +++ b/tests/CMakeLists.txt @@ -0,0 +1,193 @@ +if(WIN32) + add_executable(cas_test_named_pipe_channel + unit/test_named_pipe_channel.cpp + ../src/cas/platform/windows/named_pipe_channel.cpp) + target_include_directories(cas_test_named_pipe_channel PRIVATE + ../src ../src/cas) + target_compile_features(cas_test_named_pipe_channel PRIVATE cxx_std_17) + + add_executable(cas_test_win_helpers + unit/test_win_helpers.cpp + ../src/cas/platform/windows/path_translation.cpp + ../src/cas/platform/windows/ntstatus_map.cpp) + target_include_directories(cas_test_win_helpers PRIVATE + ../src ../src/cas) + target_compile_features(cas_test_win_helpers PRIVATE cxx_std_17) +endif() + +if(UNIX) +add_executable(cas_test_workspace_cli + unit/test_workspace_cli.cpp + ../src/cas/workspace_cli.cpp) +target_include_directories(cas_test_workspace_cli PRIVATE ../src/cas) +if(NOT MSVC) + target_compile_options(cas_test_workspace_cli PRIVATE -Wall -Wextra -Wpedantic) +endif() +target_link_libraries(cas_test_workspace_cli PRIVATE Threads::Threads) +if(AGENTVFS_EBPF) + target_compile_definitions(cas_test_workspace_cli PRIVATE AGENTVFS_EBPF=1) +endif() +if(AGENTVFS_FANOTIFY) + target_compile_definitions(cas_test_workspace_cli PRIVATE AGENTVFS_FANOTIFY=1) +endif() +endif() # UNIX + +if(APPLE) +add_executable(cas_test_fuse_t_preflight + unit/test_fuse_t_preflight.cpp + ../src/cas/platform/macos/fuse_t_preflight.cpp) +target_include_directories(cas_test_fuse_t_preflight PRIVATE + ../src ../src/cas ../include) +target_compile_features(cas_test_fuse_t_preflight PRIVATE cxx_std_17) +if(NOT MSVC) + target_compile_options(cas_test_fuse_t_preflight PRIVATE + -Wall -Wextra -Wpedantic) +endif() +endif() + +add_executable(cas_test_working_tree unit/test_working_tree.cpp) +target_link_libraries(cas_test_working_tree PRIVATE cas_core) + +add_executable(cas_test_write_buffer unit/test_write_buffer.cpp) +target_link_libraries(cas_test_write_buffer PRIVATE cas_core) + +if(UNIX) +add_executable(cas_test_object_store unit/test_object_store.cpp) +target_link_libraries(cas_test_object_store PRIVATE cas_core) +endif() + +if(UNIX) +add_executable(cas_test_fh_lifecycle system/test_cas_fh_lifecycle.cpp) +endif() + +add_executable(cas_test_branch_context unit/test_branch_context.cpp) +target_link_libraries(cas_test_branch_context PRIVATE cas_core) + +add_executable(cas_test_branch_merge unit/test_branch_merge.cpp) +target_link_libraries(cas_test_branch_merge PRIVATE cas_core) + +if(UNIX) +add_executable(cas_test_branch_merge_commit unit/test_branch_merge_commit.cpp) +target_link_libraries(cas_test_branch_merge_commit PRIVATE cas_core) +endif() + +if(UNIX) +add_executable(cas_test_branch_merge_daemon + unit/test_branch_merge_daemon.cpp + support/ebpf_loader_stub.cpp) +target_link_libraries(cas_test_branch_merge_daemon PRIVATE cas_core) +if(AGENTVFS_EBPF) + target_link_libraries(cas_test_branch_merge_daemon PRIVATE ${LIBBPF_LIBRARIES} elf z) +endif() + +add_executable(cas_test_branch_persistence + unit/test_branch_persistence.cpp + support/ebpf_loader_stub.cpp) +target_link_libraries(cas_test_branch_persistence PRIVATE cas_core) +if(AGENTVFS_EBPF) + target_link_libraries(cas_test_branch_persistence PRIVATE ${LIBBPF_LIBRARIES} elf z) +endif() +endif() # UNIX + +add_executable(cas_test_telemetry_event unit/test_telemetry_event.cpp ../src/cas/telemetry_event.cpp) +target_include_directories(cas_test_telemetry_event PRIVATE ../include ../src ../src/cas) +target_compile_features(cas_test_telemetry_event PRIVATE cxx_std_17) + +if(UNIX) +add_executable(cas_test_telemetry_registry unit/test_telemetry_registry.cpp ../src/cas/telemetry_registry.cpp ../src/cas/telemetry_event.cpp) +target_include_directories(cas_test_telemetry_registry PRIVATE ../include ../src ../src/cas) +target_compile_features(cas_test_telemetry_registry PRIVATE cxx_std_17) +endif() + +if(AGENTVFS_BLAKE3_SIMD) +add_executable(cas_test_blake3_simd unit/test_blake3_simd.cpp) +target_link_libraries(cas_test_blake3_simd PRIVATE cas_core) +endif() + +if(LINUX) +add_executable(cas_test_ebpf_backend + unit/test_ebpf_backend.cpp + ../src/cas/backends/ebpf_backend.cpp + ../src/cas/ebpf_loader.cpp) +target_include_directories(cas_test_ebpf_backend PRIVATE ../include ../src ../src/cas) +target_link_libraries(cas_test_ebpf_backend PRIVATE cas_core) +target_compile_features(cas_test_ebpf_backend PRIVATE cxx_std_17) +if(AGENTVFS_EBPF) + target_include_directories(cas_test_ebpf_backend PRIVATE + ${LIBBPF_INCLUDE_DIRS} ${CMAKE_CURRENT_BINARY_DIR}) + target_link_libraries(cas_test_ebpf_backend PRIVATE ${LIBBPF_LIBRARIES} elf z) + add_dependencies(cas_test_ebpf_backend cas_bpf_skel) +endif() + +add_executable(cas_test_fanotify_backend + unit/test_fanotify_backend.cpp + ../src/cas/backends/fanotify_backend.cpp + ../src/cas/telemetry_event.cpp) +target_include_directories(cas_test_fanotify_backend PRIVATE ../include ../src ../src/cas) +target_link_libraries(cas_test_fanotify_backend PRIVATE Threads::Threads) +target_compile_features(cas_test_fanotify_backend PRIVATE cxx_std_17) +if(AGENTVFS_FANOTIFY) + target_compile_definitions(cas_test_fanotify_backend PRIVATE AGENTVFS_FANOTIFY=1) +endif() + +add_executable(cas_test_ptrace_backend + unit/test_ptrace_backend.cpp + ../src/cas/backends/ptrace_backend.cpp + ../src/cas/telemetry_event.cpp) +target_include_directories(cas_test_ptrace_backend PRIVATE ../include ../src ../src/cas) +target_link_libraries(cas_test_ptrace_backend PRIVATE Threads::Threads) +target_compile_features(cas_test_ptrace_backend PRIVATE cxx_std_17) +if(AGENTVFS_PTRACE) + target_compile_definitions(cas_test_ptrace_backend PRIVATE AGENTVFS_PTRACE=1) +endif() + +add_executable(cas_test_ldpreload_backend + unit/test_ldpreload_backend.cpp + ../src/cas/backends/ldpreload_backend.cpp + ../src/cas/telemetry_event.cpp) +target_include_directories(cas_test_ldpreload_backend PRIVATE ../include ../src ../src/cas) +target_link_libraries(cas_test_ldpreload_backend PRIVATE Threads::Threads) +target_compile_features(cas_test_ldpreload_backend PRIVATE cxx_std_17) +if(AGENTVFS_LDPRELOAD) + target_compile_definitions(cas_test_ldpreload_backend PRIVATE AGENTVFS_LDPRELOAD=1) +endif() + +add_executable(cas_test_bpftime_backend + unit/test_bpftime_backend.cpp + ../src/cas/backends/bpftime_backend.cpp) +target_include_directories(cas_test_bpftime_backend PRIVATE ../include ../src ../src/cas) +target_link_libraries(cas_test_bpftime_backend PRIVATE Threads::Threads) +target_compile_features(cas_test_bpftime_backend PRIVATE cxx_std_17) +if(AGENTVFS_BPFTIME) + target_compile_definitions(cas_test_bpftime_backend PRIVATE AGENTVFS_BPFTIME=1) +endif() + +add_executable(cas_test_wasm_backend + unit/test_wasm_backend.cpp + ../src/cas/backends/wasm_backend.cpp) +target_include_directories(cas_test_wasm_backend PRIVATE ../include ../src ../src/cas) +target_compile_features(cas_test_wasm_backend PRIVATE cxx_std_17) +if(AGENTVFS_WASM) + target_compile_definitions(cas_test_wasm_backend PRIVATE AGENTVFS_WASM=1) +endif() + +add_executable(cas_test_lua_backend + unit/test_lua_backend.cpp + ../src/cas/backends/lua_backend.cpp) +target_include_directories(cas_test_lua_backend PRIVATE ../include ../src ../src/cas) +target_compile_features(cas_test_lua_backend PRIVATE cxx_std_17) +if(AGENTVFS_LUA) + target_compile_definitions(cas_test_lua_backend PRIVATE AGENTVFS_LUA=1) +endif() + +if(AGENTVFS_LDPRELOAD) + add_executable(cas_test_ldpreload_preload + unit/test_ldpreload_preload.cpp) + target_include_directories(cas_test_ldpreload_preload PRIVATE ../include ../src ../src/cas) + target_link_libraries(cas_test_ldpreload_preload PRIVATE dl Threads::Threads) + target_compile_features(cas_test_ldpreload_preload PRIVATE cxx_std_17) + target_compile_definitions(cas_test_ldpreload_preload PRIVATE + CAS_PRELOAD_LIB="${CMAKE_CURRENT_BINARY_DIR}/libcas_preload.so") + add_dependencies(cas_test_ldpreload_preload cas_preload) +endif() +endif() # LINUX diff --git a/tests/cas/fixtures/test_filter.wat b/tests/fixtures/test_filter.wat similarity index 100% rename from tests/cas/fixtures/test_filter.wat rename to tests/fixtures/test_filter.wat diff --git a/tests/cas/fixtures/test_policy.lua b/tests/fixtures/test_policy.lua similarity index 100% rename from tests/cas/fixtures/test_policy.lua rename to tests/fixtures/test_policy.lua diff --git a/tests/cas/ebpf_loader_stub.cpp b/tests/support/ebpf_loader_stub.cpp similarity index 100% rename from tests/cas/ebpf_loader_stub.cpp rename to tests/support/ebpf_loader_stub.cpp diff --git a/tests/system/test_cas_lua.sh b/tests/system/test_cas_lua.sh index 7f2e851..424a9b6 100755 --- a/tests/system/test_cas_lua.sh +++ b/tests/system/test_cas_lua.sh @@ -2,7 +2,7 @@ set -euo pipefail BIN="${BIN:-$(pwd)/build/agentvfs}" -FIXTURE="$(pwd)/tests/cas/fixtures/test_policy.lua" +FIXTURE="$(pwd)/tests/fixtures/test_policy.lua" if [[ ! -x "$BIN" ]]; then echo "SKIP test_cas_lua: $BIN is not built" diff --git a/tests/system/test_cas_telemetry_ramp.sh b/tests/system/test_cas_telemetry_ramp.sh index 68b4e2e..4b7ecd2 100755 --- a/tests/system/test_cas_telemetry_ramp.sh +++ b/tests/system/test_cas_telemetry_ramp.sh @@ -1,5 +1,5 @@ #!/bin/bash -# tests/cas/test_cas_telemetry_ramp.sh — cumulative multi-backend telemetry ramp. +# tests/system/test_cas_telemetry_ramp.sh — cumulative multi-backend telemetry ramp. # # For each K in 1..7, spawn agentvfs with the first K backends from the canonical # order (sources before processors), run 5 checkpoints + reverse rollback, verify diff --git a/tests/system/test_cas_wasm.sh b/tests/system/test_cas_wasm.sh index 1f61849..507e395 100755 --- a/tests/system/test_cas_wasm.sh +++ b/tests/system/test_cas_wasm.sh @@ -2,7 +2,7 @@ set -euo pipefail BIN="${BIN:-$(pwd)/build/agentvfs}" -FIXTURE="$(pwd)/tests/cas/fixtures/test_filter.wat" +FIXTURE="$(pwd)/tests/fixtures/test_filter.wat" if [[ ! -x "$BIN" ]]; then echo "SKIP test_cas_wasm: $BIN is not built" diff --git a/tests/unit/test_lua_backend.cpp b/tests/unit/test_lua_backend.cpp index bd6eef6..e64687e 100644 --- a/tests/unit/test_lua_backend.cpp +++ b/tests/unit/test_lua_backend.cpp @@ -82,7 +82,7 @@ static void test_start_with_script_fails_without_runtime_callbacks() { cas::BackendConfig cfg{}; bool callback_called = false; - cfg.params["script_path"] = "tests/cas/fixtures/test_policy.lua"; + cfg.params["script_path"] = "tests/fixtures/test_policy.lua"; CHECK(!backend.start(cfg, [&](cas::TelemetryEvent) { callback_called = true; })); From b6bd579ca2c674b59550cadfced117c61dc30c43 Mon Sep 17 00:00:00 2001 From: yz <43207690+yzim@users.noreply.github.com> Date: Mon, 15 Jun 2026 23:46:21 +0800 Subject: [PATCH 06/21] Preserve test binary output paths after CMake split --- tests/CMakeLists.txt | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 07e5f98..8778f1e 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -1,3 +1,8 @@ +set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}) +foreach(cfg IN ITEMS Debug Release RelWithDebInfo MinSizeRel) + set("CMAKE_RUNTIME_OUTPUT_DIRECTORY_${cfg}" "${CMAKE_BINARY_DIR}") +endforeach() + if(WIN32) add_executable(cas_test_named_pipe_channel unit/test_named_pipe_channel.cpp From 400972d60cbb21d526c419e8085772d7569ac0f7 Mon Sep 17 00:00:00 2001 From: yz <43207690+yzim@users.noreply.github.com> Date: Mon, 15 Jun 2026 23:47:39 +0800 Subject: [PATCH 07/21] Run test binaries from build/tests in CI --- .github/workflows/ci.yml | 78 ++++++++++++++++++++-------------------- tests/CMakeLists.txt | 5 --- 2 files changed, 39 insertions(+), 44 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3f1afe0..228e8c2 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -21,26 +21,26 @@ jobs: run: cmake --build build -j - name: Unit tests run: | - ./build/cas_test_working_tree - ./build/cas_test_write_buffer - ./build/cas_test_object_store - ./build/cas_test_branch_context - ./build/cas_test_branch_merge - ./build/cas_test_branch_merge_commit - ./build/cas_test_branch_merge_daemon || true - ./build/cas_test_branch_persistence || true - ./build/cas_test_blake3_simd - ./build/cas_test_telemetry_event - ./build/cas_test_telemetry_registry - ./build/cas_test_workspace_cli - ./build/cas_test_ebpf_backend - ./build/cas_test_fanotify_backend - ./build/cas_test_ptrace_backend - ./build/cas_test_ldpreload_backend - ./build/cas_test_bpftime_backend - ./build/cas_test_wasm_backend - ./build/cas_test_lua_backend - ./build/cas_test_ldpreload_preload + ./build/tests/cas_test_working_tree + ./build/tests/cas_test_write_buffer + ./build/tests/cas_test_object_store + ./build/tests/cas_test_branch_context + ./build/tests/cas_test_branch_merge + ./build/tests/cas_test_branch_merge_commit + ./build/tests/cas_test_branch_merge_daemon || true + ./build/tests/cas_test_branch_persistence || true + ./build/tests/cas_test_blake3_simd + ./build/tests/cas_test_telemetry_event + ./build/tests/cas_test_telemetry_registry + ./build/tests/cas_test_workspace_cli + ./build/tests/cas_test_ebpf_backend + ./build/tests/cas_test_fanotify_backend + ./build/tests/cas_test_ptrace_backend + ./build/tests/cas_test_ldpreload_backend + ./build/tests/cas_test_bpftime_backend + ./build/tests/cas_test_wasm_backend + ./build/tests/cas_test_lua_backend + ./build/tests/cas_test_ldpreload_preload macos-unit-tests: runs-on: macos-latest @@ -56,17 +56,17 @@ jobs: run: cmake --build build -j - name: Unit tests run: | - ./build/cas_test_working_tree - ./build/cas_test_write_buffer - ./build/cas_test_object_store - ./build/cas_test_branch_context - ./build/cas_test_branch_merge - ./build/cas_test_branch_merge_commit - ./build/cas_test_blake3_simd - ./build/cas_test_telemetry_event - ./build/cas_test_telemetry_registry - ./build/cas_test_workspace_cli - ./build/cas_test_fuse_t_preflight + ./build/tests/cas_test_working_tree + ./build/tests/cas_test_write_buffer + ./build/tests/cas_test_object_store + ./build/tests/cas_test_branch_context + ./build/tests/cas_test_branch_merge + ./build/tests/cas_test_branch_merge_commit + ./build/tests/cas_test_blake3_simd + ./build/tests/cas_test_telemetry_event + ./build/tests/cas_test_telemetry_registry + ./build/tests/cas_test_workspace_cli + ./build/tests/cas_test_fuse_t_preflight windows-unit-tests: runs-on: windows-latest @@ -81,14 +81,14 @@ jobs: run: cmake --build build --config Release -j - name: Unit tests run: | - .\build\Release\cas_test_working_tree.exe - .\build\Release\cas_test_write_buffer.exe - .\build\Release\cas_test_branch_context.exe - .\build\Release\cas_test_branch_merge.exe - .\build\Release\cas_test_blake3_simd.exe - .\build\Release\cas_test_telemetry_event.exe - .\build\Release\cas_test_win_helpers.exe - .\build\Release\cas_test_named_pipe_channel.exe + .\build\tests\Release\cas_test_working_tree.exe + .\build\tests\Release\cas_test_write_buffer.exe + .\build\tests\Release\cas_test_branch_context.exe + .\build\tests\Release\cas_test_branch_merge.exe + .\build\tests\Release\cas_test_blake3_simd.exe + .\build\tests\Release\cas_test_telemetry_event.exe + .\build\tests\Release\cas_test_win_helpers.exe + .\build\tests\Release\cas_test_named_pipe_channel.exe linux-system-tests: runs-on: ubuntu-latest diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 8778f1e..07e5f98 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -1,8 +1,3 @@ -set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}) -foreach(cfg IN ITEMS Debug Release RelWithDebInfo MinSizeRel) - set("CMAKE_RUNTIME_OUTPUT_DIRECTORY_${cfg}" "${CMAKE_BINARY_DIR}") -endforeach() - if(WIN32) add_executable(cas_test_named_pipe_channel unit/test_named_pipe_channel.cpp From d91a4301a0048fc08fbe8490b8f6a9253d8d1c1c Mon Sep 17 00:00:00 2001 From: yz <43207690+yzim@users.noreply.github.com> Date: Mon, 15 Jun 2026 23:53:31 +0800 Subject: [PATCH 08/21] Fix Linux test paths after CMake split --- .github/workflows/ci.yml | 45 +++++++++++++++------------ tests/system/test_cas_fh_lifecycle.sh | 2 +- 2 files changed, 26 insertions(+), 21 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 228e8c2..53255a1 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -21,26 +21,31 @@ jobs: run: cmake --build build -j - name: Unit tests run: | - ./build/tests/cas_test_working_tree - ./build/tests/cas_test_write_buffer - ./build/tests/cas_test_object_store - ./build/tests/cas_test_branch_context - ./build/tests/cas_test_branch_merge - ./build/tests/cas_test_branch_merge_commit - ./build/tests/cas_test_branch_merge_daemon || true - ./build/tests/cas_test_branch_persistence || true - ./build/tests/cas_test_blake3_simd - ./build/tests/cas_test_telemetry_event - ./build/tests/cas_test_telemetry_registry - ./build/tests/cas_test_workspace_cli - ./build/tests/cas_test_ebpf_backend - ./build/tests/cas_test_fanotify_backend - ./build/tests/cas_test_ptrace_backend - ./build/tests/cas_test_ldpreload_backend - ./build/tests/cas_test_bpftime_backend - ./build/tests/cas_test_wasm_backend - ./build/tests/cas_test_lua_backend - ./build/tests/cas_test_ldpreload_preload + run_test() { + echo "==> $1" + "$1" + } + + run_test ./build/tests/cas_test_working_tree + run_test ./build/tests/cas_test_write_buffer + run_test ./build/tests/cas_test_object_store + run_test ./build/tests/cas_test_branch_context + run_test ./build/tests/cas_test_branch_merge + run_test ./build/tests/cas_test_branch_merge_commit + run_test ./build/tests/cas_test_branch_merge_daemon || true + run_test ./build/tests/cas_test_branch_persistence || true + run_test ./build/tests/cas_test_blake3_simd + run_test ./build/tests/cas_test_telemetry_event + run_test ./build/tests/cas_test_telemetry_registry + run_test ./build/tests/cas_test_workspace_cli + run_test ./build/tests/cas_test_ebpf_backend + run_test ./build/tests/cas_test_fanotify_backend + run_test ./build/tests/cas_test_ptrace_backend + run_test ./build/tests/cas_test_ldpreload_backend + run_test ./build/tests/cas_test_bpftime_backend + run_test ./build/tests/cas_test_wasm_backend + run_test ./build/tests/cas_test_lua_backend + run_test ./build/tests/cas_test_ldpreload_preload macos-unit-tests: runs-on: macos-latest diff --git a/tests/system/test_cas_fh_lifecycle.sh b/tests/system/test_cas_fh_lifecycle.sh index 46ba66f..d11c71c 100755 --- a/tests/system/test_cas_fh_lifecycle.sh +++ b/tests/system/test_cas_fh_lifecycle.sh @@ -7,7 +7,7 @@ MNT="$ROOT/mnt" STORE="$ROOT/store" SOCK="$ROOT/control.sock" BIN="$(pwd)/build/agentvfs" -HARNESS="$(pwd)/build/cas_test_fh_lifecycle" +HARNESS="$(pwd)/build/tests/cas_test_fh_lifecycle" cleanup() { fusermount3 -u "$MNT" 2>/dev/null || true From 20d8756f3839f9e12fb47315d3a1735c217479eb Mon Sep 17 00:00:00 2001 From: yz <43207690+yzim@users.noreply.github.com> Date: Mon, 15 Jun 2026 23:58:34 +0800 Subject: [PATCH 09/21] Fix ldpreload test library path after CMake split --- tests/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 07e5f98..539b74b 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -187,7 +187,7 @@ if(AGENTVFS_LDPRELOAD) target_link_libraries(cas_test_ldpreload_preload PRIVATE dl Threads::Threads) target_compile_features(cas_test_ldpreload_preload PRIVATE cxx_std_17) target_compile_definitions(cas_test_ldpreload_preload PRIVATE - CAS_PRELOAD_LIB="${CMAKE_CURRENT_BINARY_DIR}/libcas_preload.so") + CAS_PRELOAD_LIB="$") add_dependencies(cas_test_ldpreload_preload cas_preload) endif() endif() # LINUX From 9e639e521d920772499da1dd5f3bad583c05a7ac Mon Sep 17 00:00:00 2001 From: yz <43207690+yzim@users.noreply.github.com> Date: Tue, 16 Jun 2026 00:03:33 +0800 Subject: [PATCH 10/21] Run Linux system tests with sudo in CI --- .github/workflows/ci.yml | 59 ++++++++++++++++++++++------------------ 1 file changed, 32 insertions(+), 27 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 53255a1..c5084fd 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -32,8 +32,8 @@ jobs: run_test ./build/tests/cas_test_branch_context run_test ./build/tests/cas_test_branch_merge run_test ./build/tests/cas_test_branch_merge_commit - run_test ./build/tests/cas_test_branch_merge_daemon || true - run_test ./build/tests/cas_test_branch_persistence || true + run_test ./build/tests/cas_test_branch_merge_daemon + run_test ./build/tests/cas_test_branch_persistence run_test ./build/tests/cas_test_blake3_simd run_test ./build/tests/cas_test_telemetry_event run_test ./build/tests/cas_test_telemetry_registry @@ -109,31 +109,36 @@ jobs: run: cmake --build build -j - name: System tests run: | - bash tests/system/test_agentvfs_ctl.sh - bash tests/system/test_workspace_cli.sh - bash tests/system/test_cas_smoke.sh - bash tests/system/test_cas_bootstrap.sh - bash tests/system/test_cas_fh_lifecycle.sh - bash tests/system/test_cas_branching.sh - bash tests/system/test_cas_branch_merge.sh - bash tests/system/test_cas_multi_branch.sh - bash tests/system/test_cas_multi_branch_merge.sh - bash tests/system/test_workspace_multi_branch.sh - bash tests/system/test_cas_10cp_rollback.sh - bash tests/system/test_cas_10cp_ebpf.sh - bash tests/system/test_cas_telemetry.sh - bash tests/system/test_cas_telemetry_ramp.sh - bash tests/system/test_cas_backend_compare.sh - bash tests/system/test_cas_multi_backend.sh - bash tests/system/test_cas_multi_branch_ebpf.sh - bash tests/system/test_cas_fanotify.sh - bash tests/system/test_cas_ptrace.sh - bash tests/system/test_cas_ldpreload.sh - bash tests/system/test_cas_bpftime.sh - bash tests/system/test_cas_lua.sh - bash tests/system/test_cas_wasm.sh - bash tests/system/test_start_sh.sh - bash tests/system/test_quickstart_demo_smoke.sh + run_system_test() { + echo "==> $1" + sudo -E env "PATH=$PATH" bash "$1" + } + + run_system_test tests/system/test_agentvfs_ctl.sh + run_system_test tests/system/test_workspace_cli.sh + run_system_test tests/system/test_cas_smoke.sh + run_system_test tests/system/test_cas_bootstrap.sh + run_system_test tests/system/test_cas_fh_lifecycle.sh + run_system_test tests/system/test_cas_branching.sh + run_system_test tests/system/test_cas_branch_merge.sh + run_system_test tests/system/test_cas_multi_branch.sh + run_system_test tests/system/test_cas_multi_branch_merge.sh + run_system_test tests/system/test_workspace_multi_branch.sh + run_system_test tests/system/test_cas_10cp_rollback.sh + run_system_test tests/system/test_cas_10cp_ebpf.sh + run_system_test tests/system/test_cas_telemetry.sh + run_system_test tests/system/test_cas_telemetry_ramp.sh + run_system_test tests/system/test_cas_backend_compare.sh + run_system_test tests/system/test_cas_multi_backend.sh + run_system_test tests/system/test_cas_multi_branch_ebpf.sh + run_system_test tests/system/test_cas_fanotify.sh + run_system_test tests/system/test_cas_ptrace.sh + run_system_test tests/system/test_cas_ldpreload.sh + run_system_test tests/system/test_cas_bpftime.sh + run_system_test tests/system/test_cas_lua.sh + run_system_test tests/system/test_cas_wasm.sh + run_system_test tests/system/test_start_sh.sh + run_system_test tests/system/test_quickstart_demo_smoke.sh windows-system-tests: runs-on: windows-latest From 3f216a36178f4cc2df32c9ccc11d13f6fa5992f2 Mon Sep 17 00:00:00 2001 From: yz <43207690+yzim@users.noreply.github.com> Date: Tue, 16 Jun 2026 00:06:36 +0800 Subject: [PATCH 11/21] Run only root-dependent Linux tests with sudo --- .github/workflows/ci.yml | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c5084fd..491d3b2 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -111,6 +111,11 @@ jobs: run: | run_system_test() { echo "==> $1" + bash "$1" + } + + run_root_system_test() { + echo "==> $1 (root)" sudo -E env "PATH=$PATH" bash "$1" } @@ -119,19 +124,19 @@ jobs: run_system_test tests/system/test_cas_smoke.sh run_system_test tests/system/test_cas_bootstrap.sh run_system_test tests/system/test_cas_fh_lifecycle.sh - run_system_test tests/system/test_cas_branching.sh - run_system_test tests/system/test_cas_branch_merge.sh - run_system_test tests/system/test_cas_multi_branch.sh - run_system_test tests/system/test_cas_multi_branch_merge.sh - run_system_test tests/system/test_workspace_multi_branch.sh + run_root_system_test tests/system/test_cas_branching.sh + run_root_system_test tests/system/test_cas_branch_merge.sh + run_root_system_test tests/system/test_cas_multi_branch.sh + run_root_system_test tests/system/test_cas_multi_branch_merge.sh + run_root_system_test tests/system/test_workspace_multi_branch.sh run_system_test tests/system/test_cas_10cp_rollback.sh - run_system_test tests/system/test_cas_10cp_ebpf.sh - run_system_test tests/system/test_cas_telemetry.sh + run_root_system_test tests/system/test_cas_10cp_ebpf.sh + run_root_system_test tests/system/test_cas_telemetry.sh run_system_test tests/system/test_cas_telemetry_ramp.sh run_system_test tests/system/test_cas_backend_compare.sh run_system_test tests/system/test_cas_multi_backend.sh - run_system_test tests/system/test_cas_multi_branch_ebpf.sh - run_system_test tests/system/test_cas_fanotify.sh + run_root_system_test tests/system/test_cas_multi_branch_ebpf.sh + run_root_system_test tests/system/test_cas_fanotify.sh run_system_test tests/system/test_cas_ptrace.sh run_system_test tests/system/test_cas_ldpreload.sh run_system_test tests/system/test_cas_bpftime.sh From 371f9582eb589f30985b51f8880f43ad3fa0acf7 Mon Sep 17 00:00:00 2001 From: yz <43207690+yzim@users.noreply.github.com> Date: Tue, 16 Jun 2026 00:42:18 +0800 Subject: [PATCH 12/21] Adjust CI environment for system tests --- .github/workflows/ci.yml | 29 ++++++++++++++++++++++------- 1 file changed, 22 insertions(+), 7 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 491d3b2..83225a7 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -14,7 +14,7 @@ jobs: steps: - uses: actions/checkout@v4 - name: Install dependencies - run: sudo apt-get update && sudo apt-get install -y libfuse3-dev fuse3 + run: sudo apt-get update && sudo apt-get install -y libfuse3-dev fuse3 libelf-dev zlib1g-dev - name: Configure run: cmake -B build -DAGENTVFS_EBPF=OFF -DAGENTVFS_LDPRELOAD=ON - name: Build @@ -102,9 +102,22 @@ jobs: steps: - uses: actions/checkout@v4 - name: Install dependencies - run: sudo apt-get update && sudo apt-get install -y libfuse3-dev fuse3 netcat-openbsd + run: | + sudo apt-get update + sudo apt-get install -y \ + libfuse3-dev \ + fuse3 \ + netcat-openbsd \ + clang \ + bpftool \ + libbpf-dev \ + libelf-dev \ + zlib1g-dev \ + liblua5.4-dev \ + lua5.4 \ + wabt - name: Configure - run: cmake -B build -DAGENTVFS_EBPF=OFF -DAGENTVFS_FANOTIFY=ON -DAGENTVFS_PTRACE=ON -DAGENTVFS_LDPRELOAD=ON -DAGENTVFS_BPFTIME=ON -DAGENTVFS_WASM=ON -DAGENTVFS_LUA=ON + run: cmake -B build -DAGENTVFS_EBPF=ON -DAGENTVFS_FANOTIFY=ON -DAGENTVFS_PTRACE=ON -DAGENTVFS_LDPRELOAD=ON -DAGENTVFS_BPFTIME=ON -DAGENTVFS_WASM=ON -DAGENTVFS_LUA=ON - name: Build run: cmake --build build -j - name: System tests @@ -119,6 +132,8 @@ jobs: sudo -E env "PATH=$PATH" bash "$1" } + sudo sysctl -w kernel.yama.ptrace_scope=0 + run_system_test tests/system/test_agentvfs_ctl.sh run_system_test tests/system/test_workspace_cli.sh run_system_test tests/system/test_cas_smoke.sh @@ -132,12 +147,12 @@ jobs: run_system_test tests/system/test_cas_10cp_rollback.sh run_root_system_test tests/system/test_cas_10cp_ebpf.sh run_root_system_test tests/system/test_cas_telemetry.sh - run_system_test tests/system/test_cas_telemetry_ramp.sh - run_system_test tests/system/test_cas_backend_compare.sh - run_system_test tests/system/test_cas_multi_backend.sh + run_root_system_test tests/system/test_cas_telemetry_ramp.sh + run_root_system_test tests/system/test_cas_backend_compare.sh + run_root_system_test tests/system/test_cas_multi_backend.sh run_root_system_test tests/system/test_cas_multi_branch_ebpf.sh run_root_system_test tests/system/test_cas_fanotify.sh - run_system_test tests/system/test_cas_ptrace.sh + run_root_system_test tests/system/test_cas_ptrace.sh run_system_test tests/system/test_cas_ldpreload.sh run_system_test tests/system/test_cas_bpftime.sh run_system_test tests/system/test_cas_lua.sh From ea06578baf75a8765e5d994c41a9d7d1fe9743dd Mon Sep 17 00:00:00 2001 From: yz <43207690+yzim@users.noreply.github.com> Date: Tue, 16 Jun 2026 00:43:57 +0800 Subject: [PATCH 13/21] Rename intentionally skipped system tests --- .github/workflows/ci.yml | 4 ++-- .../{test_cas_lua.sh => test_cas_lua_actually_skipped.sh} | 0 .../{test_cas_wasm.sh => test_cas_wasm_actually_skipped.sh} | 0 3 files changed, 2 insertions(+), 2 deletions(-) rename tests/system/{test_cas_lua.sh => test_cas_lua_actually_skipped.sh} (100%) rename tests/system/{test_cas_wasm.sh => test_cas_wasm_actually_skipped.sh} (100%) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 83225a7..b6b0e03 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -155,8 +155,8 @@ jobs: run_root_system_test tests/system/test_cas_ptrace.sh run_system_test tests/system/test_cas_ldpreload.sh run_system_test tests/system/test_cas_bpftime.sh - run_system_test tests/system/test_cas_lua.sh - run_system_test tests/system/test_cas_wasm.sh + run_system_test tests/system/test_cas_lua_actually_skipped.sh + run_system_test tests/system/test_cas_wasm_actually_skipped.sh run_system_test tests/system/test_start_sh.sh run_system_test tests/system/test_quickstart_demo_smoke.sh diff --git a/tests/system/test_cas_lua.sh b/tests/system/test_cas_lua_actually_skipped.sh similarity index 100% rename from tests/system/test_cas_lua.sh rename to tests/system/test_cas_lua_actually_skipped.sh diff --git a/tests/system/test_cas_wasm.sh b/tests/system/test_cas_wasm_actually_skipped.sh similarity index 100% rename from tests/system/test_cas_wasm.sh rename to tests/system/test_cas_wasm_actually_skipped.sh From ecfccb8616377a52b92192e07661ca546f346323 Mon Sep 17 00:00:00 2001 From: yz <43207690+yzim@users.noreply.github.com> Date: Tue, 16 Jun 2026 00:45:46 +0800 Subject: [PATCH 14/21] Fix Linux CI bpftool package install --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b6b0e03..998e73a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -109,7 +109,7 @@ jobs: fuse3 \ netcat-openbsd \ clang \ - bpftool \ + linux-tools-common \ libbpf-dev \ libelf-dev \ zlib1g-dev \ From 25607e7d0deb45790a5a4e8b81fce48154bd224a Mon Sep 17 00:00:00 2001 From: yz <43207690+yzim@users.noreply.github.com> Date: Tue, 16 Jun 2026 00:47:48 +0800 Subject: [PATCH 15/21] Install Azure kernel tools for eBPF CI --- .github/workflows/ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 998e73a..4bb2b76 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -110,6 +110,7 @@ jobs: netcat-openbsd \ clang \ linux-tools-common \ + linux-tools-azure \ libbpf-dev \ libelf-dev \ zlib1g-dev \ From cb56c3d375d8c22a29c7f4c88a90894e1ebfc95a Mon Sep 17 00:00:00 2001 From: yz <43207690+yzim@users.noreply.github.com> Date: Tue, 16 Jun 2026 00:49:33 +0800 Subject: [PATCH 16/21] Install kernel-matched eBPF tools in CI --- .github/workflows/ci.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4bb2b76..0e602dd 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -111,12 +111,15 @@ jobs: clang \ linux-tools-common \ linux-tools-azure \ + linux-cloud-tools-azure \ libbpf-dev \ libelf-dev \ zlib1g-dev \ liblua5.4-dev \ lua5.4 \ wabt + sudo apt-get install -y "linux-tools-$(uname -r)" "linux-cloud-tools-$(uname -r)" + echo "/usr/lib/linux-tools/$(uname -r)" >> "$GITHUB_PATH" - name: Configure run: cmake -B build -DAGENTVFS_EBPF=ON -DAGENTVFS_FANOTIFY=ON -DAGENTVFS_PTRACE=ON -DAGENTVFS_LDPRELOAD=ON -DAGENTVFS_BPFTIME=ON -DAGENTVFS_WASM=ON -DAGENTVFS_LUA=ON - name: Build From e7f9c6a67206588b3ee898e510152d0f9629b0e7 Mon Sep 17 00:00:00 2001 From: yz <43207690+yzim@users.noreply.github.com> Date: Tue, 16 Jun 2026 09:57:34 +0800 Subject: [PATCH 17/21] Force kernel bpftool onto CI PATH --- .github/workflows/ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0e602dd..237cd5b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -120,6 +120,7 @@ jobs: wabt sudo apt-get install -y "linux-tools-$(uname -r)" "linux-cloud-tools-$(uname -r)" echo "/usr/lib/linux-tools/$(uname -r)" >> "$GITHUB_PATH" + sudo ln -sf "/usr/lib/linux-tools/$(uname -r)/bpftool" /usr/local/bin/bpftool - name: Configure run: cmake -B build -DAGENTVFS_EBPF=ON -DAGENTVFS_FANOTIFY=ON -DAGENTVFS_PTRACE=ON -DAGENTVFS_LDPRELOAD=ON -DAGENTVFS_BPFTIME=ON -DAGENTVFS_WASM=ON -DAGENTVFS_LUA=ON - name: Build From fbe06c9a597cd056175a682f4136868d43367447 Mon Sep 17 00:00:00 2001 From: yz <43207690+yzim@users.noreply.github.com> Date: Tue, 16 Jun 2026 10:35:59 +0800 Subject: [PATCH 18/21] Pin bpftool path in Linux CI configure step --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 237cd5b..82c09c9 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -122,7 +122,7 @@ jobs: echo "/usr/lib/linux-tools/$(uname -r)" >> "$GITHUB_PATH" sudo ln -sf "/usr/lib/linux-tools/$(uname -r)/bpftool" /usr/local/bin/bpftool - name: Configure - run: cmake -B build -DAGENTVFS_EBPF=ON -DAGENTVFS_FANOTIFY=ON -DAGENTVFS_PTRACE=ON -DAGENTVFS_LDPRELOAD=ON -DAGENTVFS_BPFTIME=ON -DAGENTVFS_WASM=ON -DAGENTVFS_LUA=ON + run: cmake -B build -DBPFTOOL_BIN="/usr/lib/linux-tools/$(uname -r)/bpftool" -DAGENTVFS_EBPF=ON -DAGENTVFS_FANOTIFY=ON -DAGENTVFS_PTRACE=ON -DAGENTVFS_LDPRELOAD=ON -DAGENTVFS_BPFTIME=ON -DAGENTVFS_WASM=ON -DAGENTVFS_LUA=ON - name: Build run: cmake --build build -j - name: System tests From 6c3cec16ce26e218fdd199655477f59911cae154 Mon Sep 17 00:00:00 2001 From: yz <43207690+yzim@users.noreply.github.com> Date: Tue, 16 Jun 2026 11:50:38 +0800 Subject: [PATCH 19/21] Resolve bpftool path from installed package --- .github/workflows/ci.yml | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 82c09c9..105d3dc 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -118,11 +118,22 @@ jobs: liblua5.4-dev \ lua5.4 \ wabt - sudo apt-get install -y "linux-tools-$(uname -r)" "linux-cloud-tools-$(uname -r)" - echo "/usr/lib/linux-tools/$(uname -r)" >> "$GITHUB_PATH" - sudo ln -sf "/usr/lib/linux-tools/$(uname -r)/bpftool" /usr/local/bin/bpftool + kernel_tools_pkg="linux-tools-$(uname -r)" + sudo apt-get install -y "$kernel_tools_pkg" "linux-cloud-tools-$(uname -r)" + bpftool_path="$(dpkg -L "$kernel_tools_pkg" | grep '/bpftool$' | head -n1 || true)" + if [[ -z "$bpftool_path" ]]; then + bpftool_path="$(find /usr/lib -path "*/$(uname -r)*/bpftool" -type f 2>/dev/null | head -n1 || true)" + fi + if [[ -z "$bpftool_path" ]]; then + echo "bpftool binary not found after installing $kernel_tools_pkg" >&2 + exit 1 + fi + echo "Resolved bpftool: $bpftool_path" + echo "BPFTOOL_PATH=$bpftool_path" >> "$GITHUB_ENV" + echo "$(dirname "$bpftool_path")" >> "$GITHUB_PATH" + sudo ln -sf "$bpftool_path" /usr/local/bin/bpftool - name: Configure - run: cmake -B build -DBPFTOOL_BIN="/usr/lib/linux-tools/$(uname -r)/bpftool" -DAGENTVFS_EBPF=ON -DAGENTVFS_FANOTIFY=ON -DAGENTVFS_PTRACE=ON -DAGENTVFS_LDPRELOAD=ON -DAGENTVFS_BPFTIME=ON -DAGENTVFS_WASM=ON -DAGENTVFS_LUA=ON + run: cmake -B build -DBPFTOOL_BIN="$BPFTOOL_PATH" -DAGENTVFS_EBPF=ON -DAGENTVFS_FANOTIFY=ON -DAGENTVFS_PTRACE=ON -DAGENTVFS_LDPRELOAD=ON -DAGENTVFS_BPFTIME=ON -DAGENTVFS_WASM=ON -DAGENTVFS_LUA=ON - name: Build run: cmake --build build -j - name: System tests From 9095b480a0f0a7b8d0c3be5a22a2c8e8bc62de33 Mon Sep 17 00:00:00 2001 From: yz <43207690+yzim@users.noreply.github.com> Date: Tue, 16 Jun 2026 11:54:52 +0800 Subject: [PATCH 20/21] Disable eBPF-only Linux CI on hosted runner --- .github/workflows/ci.yml | 24 ++---------------------- 1 file changed, 2 insertions(+), 22 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 105d3dc..f03489c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -109,31 +109,14 @@ jobs: fuse3 \ netcat-openbsd \ clang \ - linux-tools-common \ - linux-tools-azure \ - linux-cloud-tools-azure \ libbpf-dev \ libelf-dev \ zlib1g-dev \ liblua5.4-dev \ lua5.4 \ wabt - kernel_tools_pkg="linux-tools-$(uname -r)" - sudo apt-get install -y "$kernel_tools_pkg" "linux-cloud-tools-$(uname -r)" - bpftool_path="$(dpkg -L "$kernel_tools_pkg" | grep '/bpftool$' | head -n1 || true)" - if [[ -z "$bpftool_path" ]]; then - bpftool_path="$(find /usr/lib -path "*/$(uname -r)*/bpftool" -type f 2>/dev/null | head -n1 || true)" - fi - if [[ -z "$bpftool_path" ]]; then - echo "bpftool binary not found after installing $kernel_tools_pkg" >&2 - exit 1 - fi - echo "Resolved bpftool: $bpftool_path" - echo "BPFTOOL_PATH=$bpftool_path" >> "$GITHUB_ENV" - echo "$(dirname "$bpftool_path")" >> "$GITHUB_PATH" - sudo ln -sf "$bpftool_path" /usr/local/bin/bpftool - name: Configure - run: cmake -B build -DBPFTOOL_BIN="$BPFTOOL_PATH" -DAGENTVFS_EBPF=ON -DAGENTVFS_FANOTIFY=ON -DAGENTVFS_PTRACE=ON -DAGENTVFS_LDPRELOAD=ON -DAGENTVFS_BPFTIME=ON -DAGENTVFS_WASM=ON -DAGENTVFS_LUA=ON + run: cmake -B build -DAGENTVFS_EBPF=OFF -DAGENTVFS_FANOTIFY=ON -DAGENTVFS_PTRACE=ON -DAGENTVFS_LDPRELOAD=ON -DAGENTVFS_BPFTIME=ON -DAGENTVFS_WASM=ON -DAGENTVFS_LUA=ON - name: Build run: cmake --build build -j - name: System tests @@ -161,12 +144,9 @@ jobs: run_root_system_test tests/system/test_cas_multi_branch_merge.sh run_root_system_test tests/system/test_workspace_multi_branch.sh run_system_test tests/system/test_cas_10cp_rollback.sh - run_root_system_test tests/system/test_cas_10cp_ebpf.sh - run_root_system_test tests/system/test_cas_telemetry.sh - run_root_system_test tests/system/test_cas_telemetry_ramp.sh + # eBPF-specific coverage is not runnable on the hosted Ubuntu kernel/tooling image. run_root_system_test tests/system/test_cas_backend_compare.sh run_root_system_test tests/system/test_cas_multi_backend.sh - run_root_system_test tests/system/test_cas_multi_branch_ebpf.sh run_root_system_test tests/system/test_cas_fanotify.sh run_root_system_test tests/system/test_cas_ptrace.sh run_system_test tests/system/test_cas_ldpreload.sh From b2286644f6d28df66c7b9e6d692e009da83c10de Mon Sep 17 00:00:00 2001 From: yz <43207690+yzim@users.noreply.github.com> Date: Tue, 16 Jun 2026 12:04:53 +0800 Subject: [PATCH 21/21] Restore non-root Linux system test execution --- .github/workflows/ci.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f03489c..109d6ce 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -145,10 +145,10 @@ jobs: run_root_system_test tests/system/test_workspace_multi_branch.sh run_system_test tests/system/test_cas_10cp_rollback.sh # eBPF-specific coverage is not runnable on the hosted Ubuntu kernel/tooling image. - run_root_system_test tests/system/test_cas_backend_compare.sh - run_root_system_test tests/system/test_cas_multi_backend.sh + run_system_test tests/system/test_cas_backend_compare.sh + run_system_test tests/system/test_cas_multi_backend.sh run_root_system_test tests/system/test_cas_fanotify.sh - run_root_system_test tests/system/test_cas_ptrace.sh + run_system_test tests/system/test_cas_ptrace.sh run_system_test tests/system/test_cas_ldpreload.sh run_system_test tests/system/test_cas_bpftime.sh run_system_test tests/system/test_cas_lua_actually_skipped.sh