Skip to content

Revisit the rust_test_helpers setup #140680

Open
@jieyouxu

Description

@jieyouxu

ui, incremental test suites all have implicit access to a C helper static library built for the host/target platforms, called rust_test_helpers.

EDIT: two copies, one for host, one for target, see

// Provide `rust_test_helpers` for both host and target.
if suite == "ui" || suite == "incremental" {
builder.ensure(TestHelpers { target: compiler.host });
builder.ensure(TestHelpers { target });
hostflags
.push(format!("-Lnative={}", builder.test_helpers_out(compiler.host).display()));
targetflags.push(format!("-Lnative={}", builder.test_helpers_out(target).display()));
}
.

https://github.com/rust-lang/rust/blob/master/tests/auxiliary/rust_test_helpers.c

https://github.com/search?q=repo%3Arust-lang%2Frust%20rust_test_helpers&type=code

This is kinda strange for a few reasons:

  • All tests/{ui,incremental} tests implicitly have the built C static lib in the linker search paths, even if the test doesn't need it
  • A test might not need rust_test_helpers, but during bootstrap, it will be unconditionally built for the target anyway (requires a working target C compiler toolchain).
  • You can't specify or override what C compiler flags rust_test_helpers is built with. Notably, this includes optimization levels or debuginfo levels, or sanitizers or whatever. Every tests/{ui,incremental} gets access to the same prebuilt copy.

I'm not looking to change this any time soon, since it needs some surveying on what use cases tests using rust_test_helpers are exercising to come up with more robust alternative designs.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-test-infraArea: test infrastructure (may span bootstrap/compiletest/more)A-testsuiteArea: The testsuite used to check the correctness of rustcC-bugCategory: This is a bug.T-bootstrapRelevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap)T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions