Skip to content

test/internals is not wired into any build.w test target #559

Closed

Description

@ehartford

Problem

test/internals/ holds compiler-internal unit tests (intern_pool_test.w, arena_test.w, source_map_*.w, and now conan_recipe_link_metadata_test.w from #550), but no target in build.w or build/*.w references the directory — with build :test runs behavior/compile-error/codegen/spec/phase/CLI-selfhost/emit-C only. The internals tests run fine manually (with run test/internals/<file>.w from the repo root resolves use compiler.*), they just never run in CI.

A test that exists but never runs reads as coverage that isn't there.

Proposed fix

Add an internals-tests Test target (test/internals/*.w) to build.w and hook it into the test group. First run may surface stale tests — fix or remove them rather than excluding the target.

Found while adding parser unit tests for #550.

Activity

  1. ehartford commented on Jun 12, 2026

    @ehartford
    ContributorAuthor

    Investigation results (against current HEAD):

    Status: 1 of 11 internals tests passes today. All use //! expect-stdout: ok and run via the standard external-test path (<compiler> test --quiet <file>), so the harness works — the test programs no longer compile.

    Two distinct root causes for the 10 failures:

    1. 0c06fbd4 "Enforce module pub visibility" (2026-06-10) broke 10/11. None of src/compiler/foundation/*.w mark any symbol pub (grep -c "^pub" = 0 across Ids/Arena/SourceMap/Types/Values), so every test importing them gets symbol '...' is private to module .... The compiler itself still builds because the live build only imports compiler.foundation.Types/Values in type-annotation position. This is exactly the silent rot this issue predicted: enforcement landed, the tests never ran, nobody noticed.
    2. Latent bug at src/compiler/foundation/InternPool.w:10: extern fn with_hashmap_new_at(base: &T, ...) — T is undefined (live src/InternPool.w:11 uses &i8). Never caught because nothing in the live build imports compiler.foundation.InternPool.

    History note: the exclusion was deliberate once — d5ec2f11 ("Reorganize test directory") excluded lexer/parser/internals citing "known codegen bugs with compiler internal APIs". That claim is stale: today's failures are visibility + one bad extern decl, and conan_recipe_link_metadata_test.w passes, proving the path works.

    Fix shape (one logical change):

    1. Fix &T → &i8 in src/compiler/foundation/InternPool.w:10.
    2. Add pub to the consumed API surface of src/compiler/foundation/*.w (these modules are the Wave-1 internal API surface per src/compiler/README.md, so pub matches intent — normal pub, not @[c_export]).
    3. In build.w, add after native-phase-tests (~line 847), following the existing pattern:
      var internals_tests = target_new(.Test, "internals-tests", "test/internals/*.w")
      internals_tests = internals_tests.arg("compiler=" ++ release_compiler_bin("with"))
      internals_tests = internals_tests.dep("build")
      internals_tests = internals_tests.dep("selfcheck")
      out = out.add_target(internals_tests)
      
      and tests = tests.dep("internals-tests") in the test group (~line 948). The selfcheck dep matches the other compiler-source-touching targets.
    4. Steps 1–2 touch files compiled into the compiler, so the full build/fixpoint chain must be re-verified.

    test/lexer/ and test/parser/ have the same disease (sampled: parser test passes, lexer test fails on the same new visibility rule) — filed separately.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions