Skip to content

Set correct build directory for codegen-units #61807

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/tools/compiletest/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -484,6 +484,11 @@ pub fn run_tests(config: &Config) {

// FIXME(#33435) Avoid spurious failures in codegen-units/partitioning tests.
if let Mode::CodegenUnits = config.mode {
// codegen-units tests use wrong directory, for more info see
// https://github.com/rust-lang/rust/issues/34586#issuecomment-501681886
if let Ok(build_dir) = env::var("BUILD_DIR") {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, if the problem is that we are passing -Zincremental=tmp/foo, maybe it would be better to have some way to alter the command-line flags to include the correct directory?

I'm imagining:

// compile-flags:-Zincremental=$BUILD_DIR/tmp/...

for example? (We'd have to replace that $BUILD_DIR of course.)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm a bit worried about side-effects from changing the current directory in a narrow range of cases.

Copy link
Contributor Author

@mati865 mati865 Jun 14, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Environment variables doesn't seem to be expanded in compile-flags and that results in $VARIABLE/tmp/... directory.

I'm a bit worried about side-effects from changing the current directory in a narrow range of cases.

When I enabled it for everything only 3 rustdoc tests broke(I was building with --no-fail-fast), I haven't investigated further but they should be fixable.

let _ = env::set_current_dir(build_dir);
}
let _ = fs::remove_dir_all("tmp/partitioning-tests");
}

Expand Down