Skip to content

harness-scratch is red on master: corpus_zig_bodies.rs keys its scratch dir by pid #2968

Description

@gHashTag

tri harness scratch --gate has been red on master since 994f3c8a3:

test binaries whose tests share one scratch directory
    bootstrap/tests/corpus_zig_bodies.rs     3 tests   key t27-corpuscols-{}

bootstrap/tests/corpus_zig_bodies.rs:86 is

let dir = std::env::temp_dir().join(format!("t27-corpuscols-{}", std::process::id()));

A pid is one value per process, so every test in the binary resolves the same
directory, and the test that uses it ends with remove_dir_all(&dir).

What is measured, and what is not. Only one of the three tests in that file
creates or deletes the directory today, so there is no collision on this tree --
the gate is structural, and correctly so: the second test to use that key would
collide, and it would pass the first time it ran.

The fix is the one the gate's own message prescribes: key by an AtomicUsize
counter, unique per call, rather than by the pid.

Master runs: 994f3c8a3 failure, 494265fbb success, d7fdb4f1d success.

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