Skip to content

Commit

Permalink
Auto merge of rust-lang#125886 - GuillaumeGomez:migrate-run-make-issu…
Browse files Browse the repository at this point in the history
…e-15460, r=<try>

Migrate run make issue 15460

Part of rust-lang#121876.

r? `@jieyouxu`

try-job: x86_64-msvc
try-job: aarch64-apple
try-job: x86_64-gnu-llvm-18
  • Loading branch information
bors committed Jul 22, 2024
2 parents 20f23ab + 7ad48c7 commit 90029d3
Show file tree
Hide file tree
Showing 8 changed files with 31 additions and 9 deletions.
2 changes: 2 additions & 0 deletions src/tools/compiletest/src/runtest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3382,6 +3382,7 @@ impl<'test> TestCx<'test> {
cmd.env("IS_MSVC", "1")
.env("IS_WINDOWS", "1")
.env("MSVC_LIB", format!("'{}' -nologo", lib.display()))
.env("MSVC_LIB_PATH", format!("{}", lib.display()))
.env("CC", format!("'{}' {}", self.config.cc, cflags))
.env("CXX", format!("'{}' {}", &self.config.cxx, cxxflags));
} else {
Expand Down Expand Up @@ -3752,6 +3753,7 @@ impl<'test> TestCx<'test> {
cmd.env("IS_MSVC", "1")
.env("IS_WINDOWS", "1")
.env("MSVC_LIB", format!("'{}' -nologo", lib.display()))
.env("MSVC_LIB_PATH", format!("{}", lib.display()))
// Note: we diverge from legacy run_make and don't lump `CC` the compiler and
// default flags together.
.env("CC_DEFAULT_FLAGS", &cflags)
Expand Down
16 changes: 15 additions & 1 deletion src/tools/run-make-support/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,21 @@ pub use python::python_command;
pub use rustc::{aux_build, bare_rustc, rustc, Rustc};
pub use rustdoc::{bare_rustdoc, rustdoc, Rustdoc};

/// [`diff`][mod@diff] is implemented in terms of the [similar] library.
/// Implement common helpers for command wrappers. This assumes that the command wrapper is a struct
/// containing a `cmd: Command` field and a `output` function. The provided helpers are:
///
/// 1. Generic argument acceptors: `arg` and `args` (delegated to [`Command`]). These are intended
/// to be *fallback* argument acceptors, when specific helpers don't make sense. Prefer to add
/// new specific helper methods over relying on these generic argument providers.
/// 2. Environment manipulation methods: `env`, `env_remove` and `env_clear`: these delegate to
/// methods of the same name on [`Command`].
/// 3. Output and execution: `output`, `run` and `run_fail` are provided. `output` waits for the
/// command to finish running and returns the process's [`Output`]. `run` and `run_fail` are
/// higher-level convenience methods which waits for the command to finish running and assert
/// that the command successfully ran or failed as expected. Prefer `run` and `run_fail` when
/// possible.
///
/// Example usage:
///
/// [similar]: https://github.com/mitsuhiko/similar
pub use diff::{diff, Diff};
Expand Down
1 change: 0 additions & 1 deletion src/tools/tidy/src/allowed_run_make_makefiles.txt
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ run-make/incr-foreign-head-span/Makefile
run-make/interdependent-c-libraries/Makefile
run-make/issue-107094/Makefile
run-make/issue-14698/Makefile
run-make/issue-15460/Makefile
run-make/issue-33329/Makefile
run-make/issue-35164/Makefile
run-make/issue-36710/Makefile
Expand Down
7 changes: 0 additions & 7 deletions tests/run-make/issue-15460/Makefile

This file was deleted.

File renamed without changes.
File renamed without changes.
File renamed without changes.
14 changes: 14 additions & 0 deletions tests/run-make/link-native-static-lib-to-dylib/rmake.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
// Regression test for <https://github.com/rust-lang/rust/issues/15460>.

//@ ignore-cross-compile

use run_make_support::{build_native_static_lib, run, rustc};

fn main() {
build_native_static_lib("foo");

rustc().input("foo.rs").extra_filename("-383hf8").arg("-Cprefer-dynamic").run();
rustc().input("bar.rs").run();

run("bar");
}

0 comments on commit 90029d3

Please sign in to comment.