diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 31db148..15bbc01 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -70,6 +70,27 @@ jobs: --runtime-c build/clang18-matrix/runtime_c/libquarry_runtime_c.a \ --work build/interop-clang18 --require-all' + # #85: run this fixture under Clang, not only the default GCC suite. + # Checked optional preconditions also catch invalid metadata lookups reliably. + - name: Clang 18 generic runtime conformance + run: | + docker compose run --rm dev sh -ec ' + cmake --build build/clang18-matrix --parallel \ + --target generic_runtime_conformance_test generic_runtime_conformance_fixture_generator + ctest --test-dir build/clang18-matrix --output-on-failure \ + -R "^generic_runtime_conformance_(test|fixture_check)$" + cmake -S . -B build/clang18-conformance-sanitized \ + -DCMAKE_BUILD_TYPE=Debug -DCMAKE_C_COMPILER=clang-18 -DCMAKE_CXX_COMPILER=clang++-18 \ + "-DCMAKE_C_FLAGS=-fsanitize=address,undefined -fno-omit-frame-pointer" \ + "-DCMAKE_CXX_FLAGS=-fsanitize=address,undefined -fno-omit-frame-pointer -D_GLIBCXX_ASSERTIONS" \ + -DCMAKE_EXE_LINKER_FLAGS=-fsanitize=address,undefined + cmake --build build/clang18-conformance-sanitized --parallel \ + --target generic_runtime_conformance_test generic_runtime_conformance_fixture_generator + ASAN_OPTIONS=detect_leaks=1:halt_on_error=1 \ + UBSAN_OPTIONS=halt_on_error=1:print_stacktrace=1 \ + ctest --test-dir build/clang18-conformance-sanitized --output-on-failure \ + -R "^generic_runtime_conformance_(test|fixture_check)$"' + # 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. diff --git a/Dockerfile b/Dockerfile index 073f7f2..952254f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -22,6 +22,7 @@ RUN apt-get update && apt-get install -y --no-install-recommends \ git \ golang-go \ libabsl-dev \ + libclang-rt-18-dev \ libnewlib-arm-none-eabi \ libprotobuf-dev \ libyaml-dev \ diff --git a/tests/runtime/generic_runtime_conformance_test.cpp b/tests/runtime/generic_runtime_conformance_test.cpp index e34e93e..ee9bb41 100644 --- a/tests/runtime/generic_runtime_conformance_test.cpp +++ b/tests/runtime/generic_runtime_conformance_test.cpp @@ -176,7 +176,12 @@ TEST(GenericRuntimeConformance, ValidFixture) { EXPECT_EQ(view->record_array(10)->element(0)->field(0)->as_signed(), -4); EXPECT_EQ(view->record_array(10)->element(1)->field(0)->as_signed(), 8); EXPECT_EQ(view->record_array(10)->element(0)->nested_record(1)->field(0)->as_unsigned(), 101U); - EXPECT_FALSE(view->is_present(*schema->find_field(parent->record_id, 11U))); + // find_field takes a QBS table index, not Parent's wire record ID. + ASSERT_FALSE(schema->find_field(parent->record_id, 11U).has_value()); + const auto absent_field = view->field_metadata(11U); + ASSERT_TRUE(absent_field.has_value()); + EXPECT_FALSE(view->is_present(*absent_field)); + EXPECT_FALSE(view->field(11U).has_value()); ASSERT_TRUE(view->array(12)); EXPECT_EQ(view->array(12)->size(), 0U); }