# SPDX-License-Identifier: GPL-3.0-or-later # SPDX-FileCopyrightText: 2025 ai-ad4 and the FreePDFEditor contributors # test/CMakeLists.txt # # Unit and gate tests. The M0 scaffold ships a single smoke test that proves # the build produces a runnable artefact and the spike runner emits the # contract JSON the CI pipeline parses. As the layers land (L1–L6), each gets # its own test executable under here, all registered with CTest. # We do not pull GoogleTest yet — the first tests are plain freestanding mains # returning non-zero on failure, which keeps the M0 scaffold dependency-free # and lets CI on all three platforms run ctest without a vcpkg build of gtest. # A later milestone swaps in GTest once there is real C++ logic to assert on. add_executable(test_spike_runner_contract test_spike_runner_contract.cpp ../spike/common/SpikeRunner.cpp) target_include_directories(test_spike_runner_contract PRIVATE ${CMAKE_SOURCE_DIR}/spike) target_compile_features(test_spike_runner_contract PRIVATE cxx_std_20) freepdfeditor_apply_warnings(test_spike_runner_contract) freepdfeditor_apply_hardening(test_spike_runner_contract) add_test(NAME spike_runner_contract COMMAND test_spike_runner_contract) # --- M1 IPC end-to-end test (§2.1, ADR-0004) -------------------------------- # Launches the sandboxed document process, opens a real PDF via the RPC client, # and verifies the page count + ping round-trip. Proves the process split, the # Cap'n Proto RPC over a socketpair, the seccomp sandbox, the SCM_RIGHTS fd # handoff, and the QPDF read-from-handed-fd path all work together. if(TARGET freepdfeditor_ipc) add_executable(test_ipc test_ipc.cpp) target_link_libraries(test_ipc PRIVATE freepdfeditor_ipc) target_compile_features(test_ipc PRIVATE cxx_std_20) freepdfeditor_apply_warnings(test_ipc) freepdfeditor_apply_hardening(test_ipc) add_test(NAME ipc_end_to_end COMMAND test_ipc) endif() # Pixel-diff harness scaffolding (§8.2 gate: render vs Ghostscript+PDFium # reference). The actual comparison runs against a corpus that lives in the # separate freepdfeditor-corpus repo (§13.2 rule 5); this scaffold is a # self-contained Python script that CI invokes with paths to the corpus and # the reference binaries. install(FILES "${CMAKE_CURRENT_SOURCE_DIR}/../ci/pixel-diff/run_pixel_diff.py" DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/freepdfeditor/ci")