Skip to content

specs: rename the 185 duplicated test names -- their bodies differ, so deleting either loses a case #3483

Description

@gHashTag

#3482 removed the 188 duplicate test blocks whose bodies were byte-identical. This handles the 144 names left, and the measurement refuted the cheap plan.

The hypothesis, and what killed it

The plan filed with #3481 was: check whether the later copy is systematically the revised one, and if so keep the last and drop the first. It is not.

Every remaining pair's bodies differ, and they differ in inputs and expectations:

spec name first says later says
igla/race/cordic_fixed.t27 cordic_fixed_sin_half_pi then s > 32000 then s > 9000 && s < 10000
igla/race/adder_tree.t27 adder_tree_4_zero_plus_any_identity given a = 7 given a = 0, b = 42, c = 0
igla/race/bram_weights.t27 bram_weights_flatten_addr_zero_zero depth: 3, width: 3 depth: 4, width: 4

Distribution over the 144 names: 45 differ in length, 34 differ by one line, 31 by two, 28 by three, 6 by four or more, and exactly 1 is a superset of its twin.

Deleting either copy loses a real test case. The name is the only thing that was ever wrong.

What was done

185 duplicated test names renamed — the 2nd and later occurrence gains _2, _3, …, skipping any suffix already taken. 25 specs, 185 insertions and 185 deletions: a pure rename, nothing added and nothing lost.

The suffix carries no meaning and does not pretend to. A better name is a reading of what each case actually covers, and that is a human's to write; this makes the generated code compile without losing a single case, and it is reversible.

Measured

before after
corpus errors, -ferror-limit=0 11 780 11 642 (−138)
redefinition of 'X' 204 66 (−138)
duplicate-declaration baseline 27 specs / 172 names 5 / 28

The two deltas are equal, so the repair produced no cascade in either direction.

The control

A before/after diff of the generated C, not of the specs. Across all 582 headers: 25 changed — exactly the specs edited — 370 lines differ, every one a test_ identifier gaining a _N suffix, and nothing else. 185 renames × 2 (prototype and definition) = 370. The test-count summary line did not move, which is the check that nothing was deleted.

A new class found on the way, filed not fixed

Two of the remaining redefinition of 'test_…' are not duplicate tests at all:

fn test_booth_encode_zero() { ... }     // a FUNCTION with that name
test booth_encode_zero                  // and a test block -> void test_booth_encode_zero(void)

Both lower to the same C identifier. 66 functions in the corpus are literally named test_*, and 4 of them collide with a test block of the matching name, in 2 specs (igla/race/backend.t27, math/property_test_template.t27). This is the same law as #3479 — two t27 declarations colliding after lowering — in a pair the gate does not yet compare, because in t27 they are in different namespaces and only the test_ prefix brings them together.

Activity

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

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions