Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 44 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
run: docker compose build

- name: Configure
run: docker compose run --rm dev cmake --preset docker-debug
run: docker compose run --rm dev cmake --preset docker-debug -DQUARRY_INTEROP_REQUIRE_ALL=ON

- name: Build
run: docker compose run --rm dev cmake --build --preset docker-debug --parallel
Expand Down Expand Up @@ -52,6 +52,49 @@ jobs:
- name: Test
run: docker compose run --rm dev ctest --preset docker-debug --output-on-failure

# The same black-box matrix under Linux Clang 18, including its C runtime
# and generic C++ tooling probe. No second whole-project CTest suite.
- name: Clang 18 interoperability matrix
run: |
docker compose run --rm dev sh -ec '
clang-18 --version
cmake --preset docker-debug -B build/clang18-matrix \
-DCMAKE_C_COMPILER=clang-18 -DCMAKE_CXX_COMPILER=clang++-18 \
-DQUARRY_INTEROP_REQUIRE_ALL=ON
cmake --build build/clang18-matrix --target quarry_runtime_c interop_matrix_generic_cpp --parallel
python3 tests/interop/matrix/run.py \
--source . \
--generic-cpp build/clang18-matrix/tests/interop_matrix_generic_cpp \
--cc clang-18 --cxx clang++-18 \
--build-dir build/docker-debug \
--runtime-c build/clang18-matrix/runtime_c/libquarry_runtime_c.a \
--work build/interop-clang18 --require-all'

# Docker creates private temporary directories and Go's BRF files are
# mode 0600. Give the host runner ownership before upload-artifact walks
# the evidence; keep the test's normal file permissions intact.
- name: Make interoperability evidence readable
if: always()
run: |
for path in build/docker-debug/interop-matrix build/interop-clang18; do
if [ -d "$path" ]; then
sudo chown -R "$USER":"$USER" "$path"
fi
done

- name: Upload interoperability matrix evidence
if: always()
uses: actions/upload-artifact@v4
with:
name: quarry-interop-matrix
path: |
build/docker-debug/interop-matrix/report.json
build/docker-debug/interop-matrix/run-*/commands.log
build/docker-debug/interop-matrix/run-*/*.brf
build/interop-clang18/report.json
build/interop-clang18/run-*/commands.log
build/interop-clang18/run-*/*.brf

# Small secondary diagnostic; runtime assertions are still required.
- name: GCC LTO generated identity validation
run: >-
Expand Down
29 changes: 29 additions & 0 deletions tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,33 @@ add_quarry_gtest(backend_python_test backend_python/backend_python_test.cpp
target_link_libraries(backend_python_test PRIVATE quarry_compiler_schema_ir)
target_link_libraries(backend_python_test PRIVATE quarry_schema_ir_warning_tweaks)

option(QUARRY_INTEROP_REQUIRE_ALL "Require all five A5 matrix toolchains" OFF)

# Black-box A5 matrix: generated codecs see only public runtime headers;
# the generic tooling probe deliberately links the existing QBS parser API.
add_executable(interop_matrix_generic_cpp interop/matrix/generic_cpp.cpp)
target_link_libraries(interop_matrix_generic_cpp PRIVATE quarry_compiler_qbs quarry_project_options)

find_program(QUARRY_PYTHON3_EXECUTABLE python3)
if(QUARRY_INTEROP_REQUIRE_ALL AND NOT QUARRY_PYTHON3_EXECUTABLE)
message(FATAL_ERROR "A5 matrix requires Python orchestration/runtime")
endif()
set(quarry_interop_required_flags)
if(QUARRY_INTEROP_REQUIRE_ALL)
list(APPEND quarry_interop_required_flags --require-all)
endif()
if(QUARRY_PYTHON3_EXECUTABLE)
add_test(NAME interop_matrix
COMMAND ${QUARRY_PYTHON3_EXECUTABLE}
"${CMAKE_CURRENT_SOURCE_DIR}/interop/matrix/run.py"
--source "${CMAKE_SOURCE_DIR}"
--generic-cpp "$<TARGET_FILE:interop_matrix_generic_cpp>"
--build-dir "${CMAKE_BINARY_DIR}" --cmake "${CMAKE_COMMAND}"
--cc "${CMAKE_C_COMPILER}" --cxx "${CMAKE_CXX_COMPILER}"
--runtime-c "$<TARGET_FILE:quarry_runtime_c>" --coverage "$<BOOL:${QUARRY_ENABLE_COVERAGE}>"
--work "${CMAKE_BINARY_DIR}/interop-matrix"
${quarry_interop_required_flags})
set_tests_properties(interop_matrix PROPERTIES LABELS "interop;black-box" TIMEOUT 600)
add_test(NAME name_prefix_test
COMMAND ${QUARRY_PYTHON3_EXECUTABLE}
"${CMAKE_CURRENT_SOURCE_DIR}/tools/name_prefix_test.py"
Expand Down Expand Up @@ -135,6 +160,10 @@ if(QUARRY_PYTHON3_EXECUTABLE)
--script "${CMAKE_SOURCE_DIR}/scripts/quarry-validate"
--resolver "${CMAKE_SOURCE_DIR}/cmake/QuarryVersion.cmake"
--version-template "${CMAKE_SOURCE_DIR}/include/quarry/version.hpp.in")
else()
add_test(NAME interop_matrix COMMAND ${CMAKE_COMMAND} -E echo
"SKIP: A5 matrix requires Python orchestration/runtime")
set_tests_properties(interop_matrix PROPERTIES SKIP_REGULAR_EXPRESSION "SKIP:")
endif()
add_quarry_gtest(python_execution_test backend_python/python_execution_test.cpp
quarry_compiler_support)
Expand Down
14 changes: 14 additions & 0 deletions tests/fixtures/interop_matrix/enum.brd
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Companion coverage only: the authoritative truck configuration stays unchanged.
namespace: matrix
record: EnumSample
version: 1
type: data
enums:
Mode:
values:
off: 0
low: 3
high: 300
fields:
mode:
type: Mode
92 changes: 92 additions & 0 deletions tests/interop/matrix/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
# A5 black-box interoperability matrix

`ctest --preset debug -R '^interop_matrix$' --output-on-failure` runs the
five-by-five producer/consumer grid. Each producer writes real binary files;
every consumer verifies populated/default fields and re-encodes to the identical
bytes. The adapters are rendered from one explicit expected-value model, using
only generated binding APIs. No compiler layout or identity implementation is
used as an oracle.

The authoritative root is `examples/truck/schemas/configuration.brd`. Its eight
records cover signed/unsigned integers, boolean values, bounded strings, fixed
nested records, variable nested records, and two-element record arrays with
distinct values. Empty/default records cover absence independently. GearState → EngineStatus → Timestamp and VehicleSnapshot →
GearState → EngineStatus exercise depth two; arrays add deeper paths. Every
actual nested span, including every record-array element, is extracted using
the public C generic view, compared with a standalone encoding, then exchanged
through the same full grid. The companion `enum.brd` fixture adds enum coverage
without changing the truck root or its pinned schema identity.

C99 and C++20 adapters compile with `-Wall -Wextra -Wpedantic -Wshadow -Werror`.
C-storage encode/decode calls go through the C++ wrapper. Python and Go use
their public generated codecs. Go builds without network/toolchain downloads.
A missing Go toolchain yields visible SKIP cells; those cells are never passes.
`-DQUARRY_INTEROP_REQUIRE_ALL=ON` makes missing toolchains fatal in Linux CI.
Python is the orchestration host, and the source Python runtime is mandatory
when this CTest is registered.

The C generic QBS/BRF API checks every populated producer while extracting
nested spans. For the representative C producer it checks populated/default
records in both QBS modes; the inspector checks the same cases and must expose
the expected RPM, temperature and fault values. Every other producer's bytes
must match these streams. Python generic checks the complete populated/default
model for every producer in both modes. A separate C++ QBS tooling probe checks
EngineStatus, timestamps and its two fault records for every producer in both
modes. Repeated CLI launches on identical bytes are avoided.
The C++
probe links the existing QBS parser/tooling library; it does not suggest that
this source-tree tooling API is an independently installed header-only runtime.
The driver stages an actual CMake installation and uses its CLI tools and
public runtime headers for all native generated adapters, generic C probes and
negative compilation controls. The library comes from the selected build, so
the extended run still exercises a Clang-built C runtime. The separate C++ QBS
tooling probe retains its existing source-tree API boundary.

The driver compares the complete stored 128-bit truck schema_id from each
binding, CLI queries and both QBS images. Dependency replacement tests reject
incompatible configurations in all five languages. A separate wire-identical
field rename tests native gid guards. Python and Go do not expose the native
per-namespace gid mechanism; this distinction is reported as N/A, not a pass.
The existing `public_examples_test` runs the A4.5 truck revision A/B coexistence
application in all five variants, including EngineStatus's shared ID and rev
B's additional MirrorFold record. It is reused rather than duplicated here.

Legacy controls replace each expected type's ID with its RC3 local component
below 0x00010000 and require rejection by every available generated consumer
and the inspector. These are mapping-specific checks, not an assertion that
all small numeric IDs are intrinsically invalid. Positive controls use the
unmodified streams in the full grid.

Mutation controls route an altered header ID, valid differently populated bytes,
and a valid record delivered to the wrong type through the same consumer
entry points and value checks. The changed-value and misrouted streams must also
pass with their correct values/type, proving that the intended assertions fail.
Truncation, trailing bytes, invalid UTF-8, unknown enums and a legacy nested ID
are rejected by generated decoders, generic C/Python and both inspector modes.
Rejections require the expected normal error exit (including inspector exit 6);
signal exits and runtime-fault diagnostics cannot count as success. A fourth
control changes the last nibble of the observed schema_id and requires the same
full-width identity assertion to fail. The separate dependency
mixing checks must fail on the generated configuration guard's diagnostics,
not on missing includes or unrelated application errors.

Repeated generation, a new output directory, and selected/full generation must
agree on shared source bytes. Reordered root imports, selection and prefixing
must preserve the pinned IDs, schema_id and both complete QBS byte streams.
Source-byte equality after import reordering is deliberately not required
(issue #90). Every populated/default producer fixture is also encoded through prefixed APIs
and compared byte for byte with its original stream. Existing `name_prefix_test`
retains additional native storage-policy coverage.

Evidence is written to `<build>/interop-matrix/report.json` and retained
`run-*/commands.log` files. Reports include each fixture, producer, consumer,
expected/observed ID, byte comparison and decode result, toolchain versions,
checks, mutation results and elapsed wall time. Linux CI uploads these and
executes all five rows. Its additional Clang 18 run builds the C runtime and
C++ QBS probe with Clang 18, then compiles all native generated adapters with
that toolchain. The existing GCC-built compiler and inspector supply the same
black-box CLI boundary. This is a targeted matrix run, not a claim that the
unrelated full Clang 18 conformance suite (#85) passes.

No BRF/QBS/IR, record allocation, identity encoding, runtime API or epoch changes
are part of this test stage. The experimental FQN-hash branch is untouched.
Loading
Loading