From 8c268600d84e0e006dbb448aa809b2c46a9916db Mon Sep 17 00:00:00 2001 From: Dale Wijnand Date: Mon, 11 Feb 2019 21:06:42 +0000 Subject: [PATCH] Test cases proving RUSTC_WRAPPER can be a relative path --- tests/testsuite/build.rs | 34 ++++++++++++++++++++++++---------- 1 file changed, 24 insertions(+), 10 deletions(-) diff --git a/tests/testsuite/build.rs b/tests/testsuite/build.rs index 892b7c9e277..ce071e92f33 100644 --- a/tests/testsuite/build.rs +++ b/tests/testsuite/build.rs @@ -3954,23 +3954,37 @@ fn run_proper_binary_main_rs_as_foo() { } #[test] +#[cfg(not(windows))] // We don't have /usr/bin/env on Windows. fn rustc_wrapper() { - // We don't have /usr/bin/env on Windows. - if cfg!(windows) { - return; - } - - let p = project() - .file("Cargo.toml", &basic_bin_manifest("foo")) - .file("src/foo.rs", &main_file(r#""i am foo""#, &[])) - .build(); - + let p = project().file("src/lib.rs", "").build(); p.cargo("build -v") .env("RUSTC_WRAPPER", "/usr/bin/env") .with_stderr_contains("[RUNNING] `/usr/bin/env rustc --crate-name foo [..]") .run(); } +#[test] +#[cfg(not(windows))] +fn rustc_wrapper_relative() { + let p = project().file("src/lib.rs", "").build(); + p.cargo("build -v") + .env("RUSTC_WRAPPER", "./sccache") + .with_status(101) + .with_stderr_contains("[..]/foo/./sccache rustc[..]") + .run(); +} + +#[test] +#[cfg(not(windows))] +fn rustc_wrapper_from_path() { + let p = project().file("src/lib.rs", "").build(); + p.cargo("build -v") + .env("RUSTC_WRAPPER", "wannabe_sccache") + .with_status(101) + .with_stderr_contains("[..]`wannabe_sccache rustc [..]") + .run(); +} + #[test] fn cdylib_not_lifted() { let p = project()