mirror of
https://github.com/rust-lang/rust.git
synced 2025-04-16 14:07:04 +00:00
Rollup merge of #136581 - jieyouxu:makefile-be-gone, r=Kobzol
Retire the legacy `Makefile`-based `run-make` test infra The final piece of [porting run-make tests to use Rust #121876](https://github.com/rust-lang/rust/issues/121876). Closes #121876. Closes #40713. Closes #81791 (no longer using `wc`). Closes #56475 (no longer a problem in current form of that test; we don't ignore the test on `aarch64-unknown-linux-gnu`). ### Summary This PR removes the legacy `Makefile`-based `run-make` test infra which has served us well over the years. The legacy infra is no longer needed since we ported all of `Makefile`-based `run-make` tests to the new `rmake.rs` infra. Additionally, this PR: - Removes `tests/run-make/tools.mk` since no more `Makefile`-based tests remain. - Updates `tests/run-make/README.md` and rustc-dev-guide docs to remove mention about `Makefile`-based `run-make` tests - Update test suite requirements in rustc-dev-guide on Windows to no longer need MSYS2 (they should also now run successfully on native Windows MSVC). - Update `triagebot.toml` to stop backlinking to #121876. **Thanks to everyone who helped in this effort to modernize the `run-make` test infra and test suite!** r? bootstrap
This commit is contained in:
commit
65da1ffe41
@ -74,8 +74,7 @@ The following test suites are available, with links for more information:
|
||||
|
||||
### General purpose test suite
|
||||
|
||||
[`run-make`](#run-make-tests) are general purpose tests using Rust programs (or
|
||||
Makefiles (legacy)).
|
||||
[`run-make`](#run-make-tests) are general purpose tests using Rust programs.
|
||||
|
||||
### Rustdoc test suites
|
||||
|
||||
@ -396,14 +395,6 @@ your test, causing separate files to be generated for 32bit and 64bit systems.
|
||||
|
||||
### `run-make` tests
|
||||
|
||||
> **Note on phasing out `Makefile`s**
|
||||
>
|
||||
> We are planning to migrate all existing Makefile-based `run-make` tests
|
||||
> to Rust programs. You should not be adding new Makefile-based `run-make`
|
||||
> tests.
|
||||
>
|
||||
> See <https://github.com/rust-lang/rust/issues/121876>.
|
||||
|
||||
The tests in [`tests/run-make`] are general-purpose tests using Rust *recipes*,
|
||||
which are small programs (`rmake.rs`) allowing arbitrary Rust code such as
|
||||
`rustc` invocations, and is supported by a [`run_make_support`] library. Using
|
||||
@ -424,11 +415,6 @@ Compiletest directives like `//@ only-<target>` or `//@ ignore-<target>` are
|
||||
supported in `rmake.rs`, like in UI tests. However, revisions or building
|
||||
auxiliary via directives are not currently supported.
|
||||
|
||||
Two `run-make` tests are ported over to Rust recipes as examples:
|
||||
|
||||
- <https://github.com/rust-lang/rust/tree/master/tests/run-make/CURRENT_RUSTC_VERSION>
|
||||
- <https://github.com/rust-lang/rust/tree/master/tests/run-make/a-b-a-linker-guard>
|
||||
|
||||
#### Quickly check if `rmake.rs` tests can be compiled
|
||||
|
||||
You can quickly check if `rmake.rs` tests can be compiled without having to
|
||||
@ -481,20 +467,6 @@ Then add a corresponding entry to `"rust-analyzer.linkedProjects"`
|
||||
],
|
||||
```
|
||||
|
||||
#### Using Makefiles (legacy)
|
||||
|
||||
<div class="warning">
|
||||
You should avoid writing new Makefile-based `run-make` tests.
|
||||
</div>
|
||||
|
||||
Each test should be in a separate directory with a `Makefile` indicating the
|
||||
commands to run.
|
||||
|
||||
There is a [`tools.mk`] Makefile which you can include which provides a bunch of
|
||||
utilities to make it easier to run commands and compare outputs. Take a look at
|
||||
some of the other tests for some examples on how to get started.
|
||||
|
||||
[`tools.mk`]: https://github.com/rust-lang/rust/blob/master/tests/run-make/tools.mk
|
||||
[`tests/run-make`]: https://github.com/rust-lang/rust/tree/master/tests/run-make
|
||||
[`run_make_support`]: https://github.com/rust-lang/rust/tree/master/src/tools/run-make-support
|
||||
|
||||
|
@ -6,10 +6,7 @@
|
||||
FIXME(jieyouxu) completely revise this chapter.
|
||||
-->
|
||||
|
||||
Directives are special comments that tell compiletest how to build and interpret
|
||||
a test. They must appear before the Rust source in the test. They may also
|
||||
appear in `rmake.rs` or legacy Makefiles for [run-make
|
||||
tests](compiletest.md#run-make-tests).
|
||||
Directives are special comments that tell compiletest how to build and interpret a test. They must appear before the Rust source in the test. They may also appear in `rmake.rs` [run-make tests](compiletest.md#run-make-tests).
|
||||
|
||||
They are normally put after the short comment that explains the point of this
|
||||
test. Compiletest test suites use `//@` to signal that a comment is a directive.
|
||||
@ -222,8 +219,6 @@ The following directives will check LLVM support:
|
||||
[`aarch64-gnu-debug`]), which only runs a
|
||||
subset of `run-make` tests. Other tests with this directive will not
|
||||
run at all, which is usually not what you want.
|
||||
- Notably, the [`aarch64-gnu-debug`] CI job *currently* only runs `run-make`
|
||||
tests which additionally contain `clang` in their test name.
|
||||
|
||||
See also [Debuginfo tests](compiletest.md#debuginfo-tests) for directives for
|
||||
ignoring debuggers.
|
||||
|
@ -238,30 +238,6 @@ This is much faster, but doesn't always work. For example, some tests include
|
||||
directives that specify specific compiler flags, or which rely on other crates,
|
||||
and they may not run the same without those options.
|
||||
|
||||
## Running `run-make` tests
|
||||
|
||||
### Windows
|
||||
|
||||
Running the `run-make` test suite on Windows is a currently bit more involved.
|
||||
There are numerous prerequisites and environmental requirements:
|
||||
|
||||
- Install msys2: <https://www.msys2.org/>
|
||||
- Specify `MSYS2_PATH_TYPE=inherit` in `msys2.ini` in the msys2 installation directory, run the
|
||||
following with `MSYS2 MSYS`:
|
||||
- `pacman -Syuu`
|
||||
- `pacman -S make`
|
||||
- `pacman -S diffutils`
|
||||
- `pacman -S binutils`
|
||||
- `./x test run-make` (`./x test tests/run-make` doesn't work)
|
||||
|
||||
There is [on-going work][port-run-make] to not rely on `Makefile`s in the
|
||||
run-make test suite. Once this work is completed, you can run the entire
|
||||
`run-make` test suite on native Windows inside `cmd` or `PowerShell` without
|
||||
needing to install and use MSYS2. As of <!--date-check --> Oct 2024, it is
|
||||
already possible to run the vast majority of the `run-make` test suite outside
|
||||
of MSYS2, but there will be failures for the tests that still use `Makefile`s
|
||||
due to not finding `make`.
|
||||
|
||||
## Running tests on a remote machine
|
||||
|
||||
Tests may be run on a remote machine (e.g. to test builds for a different
|
||||
@ -406,4 +382,3 @@ If you encounter bugs or problems, don't hesitate to open issues on the
|
||||
repository](https://github.com/rust-lang/rustc_codegen_gcc/).
|
||||
|
||||
[`tests/ui`]: https://github.com/rust-lang/rust/tree/master/tests/ui
|
||||
[port-run-make]: https://github.com/rust-lang/rust/issues/121876
|
||||
|
@ -709,11 +709,11 @@ impl TestProps {
|
||||
/// returns a struct containing various parts of the directive.
|
||||
fn line_directive<'line>(
|
||||
line_number: usize,
|
||||
comment: &str,
|
||||
original_line: &'line str,
|
||||
) -> Option<DirectiveLine<'line>> {
|
||||
// Ignore lines that don't start with the comment prefix.
|
||||
let after_comment = original_line.trim_start().strip_prefix(comment)?.trim_start();
|
||||
let after_comment =
|
||||
original_line.trim_start().strip_prefix(COMPILETEST_DIRECTIVE_PREFIX)?.trim_start();
|
||||
|
||||
let revision;
|
||||
let raw_directive;
|
||||
@ -722,7 +722,7 @@ fn line_directive<'line>(
|
||||
// A comment like `//@[foo]` only applies to revision `foo`.
|
||||
let Some((line_revision, after_close_bracket)) = after_open_bracket.split_once(']') else {
|
||||
panic!(
|
||||
"malformed condition directive: expected `{comment}[foo]`, found `{original_line}`"
|
||||
"malformed condition directive: expected `{COMPILETEST_DIRECTIVE_PREFIX}[foo]`, found `{original_line}`"
|
||||
)
|
||||
};
|
||||
|
||||
@ -836,6 +836,8 @@ pub(crate) fn check_directive<'a>(
|
||||
CheckDirectiveResult { is_known_directive: is_known(&directive_name), trailing_directive }
|
||||
}
|
||||
|
||||
const COMPILETEST_DIRECTIVE_PREFIX: &str = "//@";
|
||||
|
||||
fn iter_header(
|
||||
mode: Mode,
|
||||
_suite: &str,
|
||||
@ -849,8 +851,7 @@ fn iter_header(
|
||||
}
|
||||
|
||||
// Coverage tests in coverage-run mode always have these extra directives, without needing to
|
||||
// specify them manually in every test file. (Some of the comments below have been copied over
|
||||
// from the old `tests/run-make/coverage-reports/Makefile`, which no longer exists.)
|
||||
// specify them manually in every test file.
|
||||
//
|
||||
// FIXME(jieyouxu): I feel like there's a better way to do this, leaving for later.
|
||||
if mode == Mode::CoverageRun {
|
||||
@ -867,9 +868,6 @@ fn iter_header(
|
||||
}
|
||||
}
|
||||
|
||||
// NOTE(jieyouxu): once we get rid of `Makefile`s we can unconditionally check for `//@`.
|
||||
let comment = if testfile.extension().is_some_and(|e| e == "rs") { "//@" } else { "#" };
|
||||
|
||||
let mut rdr = BufReader::with_capacity(1024, rdr);
|
||||
let mut ln = String::new();
|
||||
let mut line_number = 0;
|
||||
@ -882,7 +880,7 @@ fn iter_header(
|
||||
}
|
||||
let ln = ln.trim();
|
||||
|
||||
let Some(directive_line) = line_directive(line_number, comment, ln) else {
|
||||
let Some(directive_line) = line_directive(line_number, ln) else {
|
||||
continue;
|
||||
};
|
||||
|
||||
|
@ -239,11 +239,6 @@ fn check_ignore(config: &Config, contents: &str) -> bool {
|
||||
d.ignore
|
||||
}
|
||||
|
||||
fn parse_makefile(config: &Config, contents: &str) -> EarlyProps {
|
||||
let bytes = contents.as_bytes();
|
||||
EarlyProps::from_reader(config, Path::new("Makefile"), bytes)
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn should_fail() {
|
||||
let config: Config = cfg().build();
|
||||
@ -261,10 +256,6 @@ fn revisions() {
|
||||
let config: Config = cfg().build();
|
||||
|
||||
assert_eq!(parse_rs(&config, "//@ revisions: a b c").revisions, vec!["a", "b", "c"],);
|
||||
assert_eq!(
|
||||
parse_makefile(&config, "# revisions: hello there").revisions,
|
||||
vec!["hello", "there"],
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
@ -21,7 +21,7 @@ pub mod util;
|
||||
|
||||
use core::panic;
|
||||
use std::collections::HashSet;
|
||||
use std::ffi::{OsStr, OsString};
|
||||
use std::ffi::OsString;
|
||||
use std::io::{self, ErrorKind};
|
||||
use std::path::{Path, PathBuf};
|
||||
use std::process::{Command, Stdio};
|
||||
@ -274,12 +274,8 @@ pub fn parse_config(args: Vec<String>) -> Config {
|
||||
let path = Path::new(f);
|
||||
let mut iter = path.iter().skip(1);
|
||||
|
||||
// We skip the test folder and check if the user passed `rmake.rs` or `Makefile`.
|
||||
if iter
|
||||
.next()
|
||||
.is_some_and(|s| s == OsStr::new("rmake.rs") || s == OsStr::new("Makefile"))
|
||||
&& iter.next().is_none()
|
||||
{
|
||||
// We skip the test folder and check if the user passed `rmake.rs`.
|
||||
if iter.next().is_some_and(|s| s == "rmake.rs") && iter.next().is_none() {
|
||||
path.parent().unwrap().to_str().unwrap().to_string()
|
||||
} else {
|
||||
f.to_string()
|
||||
@ -783,16 +779,9 @@ fn collect_tests_from_dir(
|
||||
return Ok(());
|
||||
}
|
||||
|
||||
// For run-make tests, a "test file" is actually a directory that contains
|
||||
// an `rmake.rs` or `Makefile`"
|
||||
// For run-make tests, a "test file" is actually a directory that contains an `rmake.rs`.
|
||||
if cx.config.mode == Mode::RunMake {
|
||||
if dir.join("Makefile").exists() && dir.join("rmake.rs").exists() {
|
||||
return Err(io::Error::other(
|
||||
"run-make tests cannot have both `Makefile` and `rmake.rs`",
|
||||
));
|
||||
}
|
||||
|
||||
if dir.join("Makefile").exists() || dir.join("rmake.rs").exists() {
|
||||
if dir.join("rmake.rs").exists() {
|
||||
let paths = TestPaths {
|
||||
file: dir.to_path_buf(),
|
||||
relative_dir: relative_dir_path.parent().unwrap().to_path_buf(),
|
||||
@ -861,24 +850,14 @@ pub fn is_test(file_name: &OsString) -> bool {
|
||||
!invalid_prefixes.iter().any(|p| file_name.starts_with(p))
|
||||
}
|
||||
|
||||
/// For a single test file, creates one or more test structures (one per revision)
|
||||
/// that can be handed over to libtest to run, possibly in parallel.
|
||||
/// For a single test file, creates one or more test structures (one per revision) that can be
|
||||
/// handed over to libtest to run, possibly in parallel.
|
||||
fn make_test(cx: &TestCollectorCx, collector: &mut TestCollector, testpaths: &TestPaths) {
|
||||
// For run-make tests, each "test file" is actually a _directory_ containing
|
||||
// an `rmake.rs` or `Makefile`. But for the purposes of directive parsing,
|
||||
// we want to look at that recipe file, not the directory itself.
|
||||
// For run-make tests, each "test file" is actually a _directory_ containing an `rmake.rs`. But
|
||||
// for the purposes of directive parsing, we want to look at that recipe file, not the directory
|
||||
// itself.
|
||||
let test_path = if cx.config.mode == Mode::RunMake {
|
||||
if testpaths.file.join("rmake.rs").exists() && testpaths.file.join("Makefile").exists() {
|
||||
panic!("run-make tests cannot have both `rmake.rs` and `Makefile`");
|
||||
}
|
||||
|
||||
if testpaths.file.join("rmake.rs").exists() {
|
||||
// Parse directives in rmake.rs.
|
||||
testpaths.file.join("rmake.rs")
|
||||
} else {
|
||||
// Parse directives in the Makefile.
|
||||
testpaths.file.join("Makefile")
|
||||
}
|
||||
testpaths.file.join("rmake.rs")
|
||||
} else {
|
||||
PathBuf::from(&testpaths.file)
|
||||
};
|
||||
|
@ -9,168 +9,6 @@ use crate::util::{copy_dir_all, dylib_env_var};
|
||||
|
||||
impl TestCx<'_> {
|
||||
pub(super) fn run_rmake_test(&self) {
|
||||
let test_dir = &self.testpaths.file;
|
||||
if test_dir.join("rmake.rs").exists() {
|
||||
self.run_rmake_v2_test();
|
||||
} else if test_dir.join("Makefile").exists() {
|
||||
self.run_rmake_legacy_test();
|
||||
} else {
|
||||
self.fatal("failed to find either `rmake.rs` or `Makefile`")
|
||||
}
|
||||
}
|
||||
|
||||
fn run_rmake_legacy_test(&self) {
|
||||
let cwd = env::current_dir().unwrap();
|
||||
|
||||
// FIXME(Zalathar): This should probably be `output_base_dir` to avoid
|
||||
// an unnecessary extra subdirectory, but since legacy Makefile tests
|
||||
// are hopefully going away, it seems safer to leave this perilous code
|
||||
// as-is until it can all be deleted.
|
||||
let tmpdir = cwd.join(self.output_base_name());
|
||||
ignore_not_found(|| recursive_remove(&tmpdir)).unwrap();
|
||||
|
||||
fs::create_dir_all(&tmpdir).unwrap();
|
||||
|
||||
let host = &self.config.host;
|
||||
let make = if host.contains("dragonfly")
|
||||
|| host.contains("freebsd")
|
||||
|| host.contains("netbsd")
|
||||
|| host.contains("openbsd")
|
||||
|| host.contains("aix")
|
||||
{
|
||||
"gmake"
|
||||
} else {
|
||||
"make"
|
||||
};
|
||||
|
||||
let mut cmd = Command::new(make);
|
||||
cmd.current_dir(&self.testpaths.file)
|
||||
.stdout(Stdio::piped())
|
||||
.stderr(Stdio::piped())
|
||||
.env("TARGET", &self.config.target)
|
||||
.env("PYTHON", &self.config.python)
|
||||
.env("S", &self.config.src_root)
|
||||
.env("RUST_BUILD_STAGE", &self.config.stage_id)
|
||||
.env("RUSTC", cwd.join(&self.config.rustc_path))
|
||||
.env("TMPDIR", &tmpdir)
|
||||
.env("LD_LIB_PATH_ENVVAR", dylib_env_var())
|
||||
.env("HOST_RPATH_DIR", cwd.join(&self.config.compile_lib_path))
|
||||
.env("TARGET_RPATH_DIR", cwd.join(&self.config.run_lib_path))
|
||||
.env("LLVM_COMPONENTS", &self.config.llvm_components)
|
||||
// We for sure don't want these tests to run in parallel, so make
|
||||
// sure they don't have access to these vars if we run via `make`
|
||||
// at the top level
|
||||
.env_remove("MAKEFLAGS")
|
||||
.env_remove("MFLAGS")
|
||||
.env_remove("CARGO_MAKEFLAGS");
|
||||
|
||||
if let Some(ref cargo) = self.config.cargo_path {
|
||||
cmd.env("CARGO", cwd.join(cargo));
|
||||
}
|
||||
|
||||
if let Some(ref rustdoc) = self.config.rustdoc_path {
|
||||
cmd.env("RUSTDOC", cwd.join(rustdoc));
|
||||
}
|
||||
|
||||
if let Some(ref node) = self.config.nodejs {
|
||||
cmd.env("NODE", node);
|
||||
}
|
||||
|
||||
if let Some(ref linker) = self.config.target_linker {
|
||||
cmd.env("RUSTC_LINKER", linker);
|
||||
}
|
||||
|
||||
if let Some(ref clang) = self.config.run_clang_based_tests_with {
|
||||
cmd.env("CLANG", clang);
|
||||
}
|
||||
|
||||
if let Some(ref filecheck) = self.config.llvm_filecheck {
|
||||
cmd.env("LLVM_FILECHECK", filecheck);
|
||||
}
|
||||
|
||||
if let Some(ref llvm_bin_dir) = self.config.llvm_bin_dir {
|
||||
cmd.env("LLVM_BIN_DIR", llvm_bin_dir);
|
||||
}
|
||||
|
||||
if let Some(ref remote_test_client) = self.config.remote_test_client {
|
||||
cmd.env("REMOTE_TEST_CLIENT", remote_test_client);
|
||||
}
|
||||
|
||||
// We don't want RUSTFLAGS set from the outside to interfere with
|
||||
// compiler flags set in the test cases:
|
||||
cmd.env_remove("RUSTFLAGS");
|
||||
|
||||
// Use dynamic musl for tests because static doesn't allow creating dylibs
|
||||
if self.config.host.contains("musl") {
|
||||
cmd.env("RUSTFLAGS", "-Ctarget-feature=-crt-static").env("IS_MUSL_HOST", "1");
|
||||
}
|
||||
|
||||
if self.config.bless {
|
||||
cmd.env("RUSTC_BLESS_TEST", "--bless");
|
||||
// Assume this option is active if the environment variable is "defined", with _any_ value.
|
||||
// As an example, a `Makefile` can use this option by:
|
||||
//
|
||||
// ifdef RUSTC_BLESS_TEST
|
||||
// cp "$(TMPDIR)"/actual_something.ext expected_something.ext
|
||||
// else
|
||||
// $(DIFF) expected_something.ext "$(TMPDIR)"/actual_something.ext
|
||||
// endif
|
||||
}
|
||||
|
||||
if self.config.target.contains("msvc") && !self.config.cc.is_empty() {
|
||||
// We need to pass a path to `lib.exe`, so assume that `cc` is `cl.exe`
|
||||
// and that `lib.exe` lives next to it.
|
||||
let lib = Path::new(&self.config.cc).parent().unwrap().join("lib.exe");
|
||||
|
||||
// MSYS doesn't like passing flags of the form `/foo` as it thinks it's
|
||||
// a path and instead passes `C:\msys64\foo`, so convert all
|
||||
// `/`-arguments to MSVC here to `-` arguments.
|
||||
let cflags = self
|
||||
.config
|
||||
.cflags
|
||||
.split(' ')
|
||||
.map(|s| s.replace("/", "-"))
|
||||
.collect::<Vec<_>>()
|
||||
.join(" ");
|
||||
let cxxflags = self
|
||||
.config
|
||||
.cxxflags
|
||||
.split(' ')
|
||||
.map(|s| s.replace("/", "-"))
|
||||
.collect::<Vec<_>>()
|
||||
.join(" ");
|
||||
|
||||
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 {
|
||||
cmd.env("CC", format!("{} {}", self.config.cc, self.config.cflags))
|
||||
.env("CXX", format!("{} {}", self.config.cxx, self.config.cxxflags))
|
||||
.env("AR", &self.config.ar);
|
||||
|
||||
if self.config.target.contains("windows") {
|
||||
cmd.env("IS_WINDOWS", "1");
|
||||
}
|
||||
}
|
||||
|
||||
let (output, truncated) =
|
||||
self.read2_abbreviated(cmd.spawn().expect("failed to spawn `make`"));
|
||||
if !output.status.success() {
|
||||
let res = ProcRes {
|
||||
status: output.status,
|
||||
stdout: String::from_utf8_lossy(&output.stdout).into_owned(),
|
||||
stderr: String::from_utf8_lossy(&output.stderr).into_owned(),
|
||||
truncated,
|
||||
cmdline: format!("{:?}", cmd),
|
||||
};
|
||||
self.fatal_proc_rec("make failed", &res);
|
||||
}
|
||||
}
|
||||
|
||||
fn run_rmake_v2_test(&self) {
|
||||
// For `run-make` V2, we need to perform 2 steps to build and run a `run-make` V2 recipe
|
||||
// (`rmake.rs`) to run the actual tests. The support library is already built as a tool rust
|
||||
// library and is available under
|
||||
@ -192,8 +30,6 @@ impl TestCx<'_> {
|
||||
// recipes to `remove_dir_all($TMPDIR)` without running into issues related trying to remove
|
||||
// a currently running executable because the recipe executable is not under the
|
||||
// `rmake_out/` directory.
|
||||
//
|
||||
// This setup intentionally diverges from legacy Makefile run-make tests.
|
||||
let base_dir = self.output_base_dir();
|
||||
ignore_not_found(|| recursive_remove(&base_dir)).unwrap();
|
||||
|
||||
|
@ -8,23 +8,6 @@ use crate::targets::is_msvc;
|
||||
/// Construct the static library name based on the target.
|
||||
#[must_use]
|
||||
pub fn static_lib_name(name: &str) -> String {
|
||||
// See tools.mk (irrelevant lines omitted):
|
||||
//
|
||||
// ```makefile
|
||||
// ifeq ($(UNAME),Darwin)
|
||||
// STATICLIB = $(TMPDIR)/lib$(1).a
|
||||
// else
|
||||
// ifdef IS_WINDOWS
|
||||
// ifdef IS_MSVC
|
||||
// STATICLIB = $(TMPDIR)/$(1).lib
|
||||
// else
|
||||
// STATICLIB = $(TMPDIR)/lib$(1).a
|
||||
// endif
|
||||
// else
|
||||
// STATICLIB = $(TMPDIR)/lib$(1).a
|
||||
// endif
|
||||
// endif
|
||||
// ```
|
||||
assert!(!name.contains(char::is_whitespace), "static library name cannot contain whitespace");
|
||||
|
||||
if is_msvc() { format!("{name}.lib") } else { format!("lib{name}.a") }
|
||||
|
@ -80,17 +80,6 @@ impl Cc {
|
||||
|
||||
/// Specify `-o` or `-Fe`/`-Fo` depending on platform/compiler.
|
||||
pub fn out_exe(&mut self, name: &str) -> &mut Self {
|
||||
// Ref: tools.mk (irrelevant lines omitted):
|
||||
//
|
||||
// ```makefile
|
||||
// ifdef IS_MSVC
|
||||
// OUT_EXE=-Fe:`cygpath -w $(TMPDIR)/$(call BIN,$(1))` \
|
||||
// -Fo:`cygpath -w $(TMPDIR)/$(1).obj`
|
||||
// else
|
||||
// OUT_EXE=-o $(TMPDIR)/$(1)
|
||||
// endif
|
||||
// ```
|
||||
|
||||
let mut path = std::path::PathBuf::from(name);
|
||||
|
||||
if is_msvc() {
|
||||
|
@ -2,36 +2,6 @@ use crate::{is_msvc, is_windows, uname};
|
||||
|
||||
/// `EXTRACFLAGS`
|
||||
pub fn extra_c_flags() -> Vec<&'static str> {
|
||||
// Adapted from tools.mk (trimmed):
|
||||
//
|
||||
// ```makefile
|
||||
// ifdef IS_WINDOWS
|
||||
// ifdef IS_MSVC
|
||||
// EXTRACFLAGS := ws2_32.lib userenv.lib advapi32.lib bcrypt.lib ntdll.lib synchronization.lib
|
||||
// else
|
||||
// EXTRACFLAGS := -lws2_32 -luserenv -lbcrypt -lntdll -lsynchronization
|
||||
// endif
|
||||
// else
|
||||
// ifeq ($(UNAME),Darwin)
|
||||
// EXTRACFLAGS := -lresolv
|
||||
// else
|
||||
// ifeq ($(UNAME),FreeBSD)
|
||||
// EXTRACFLAGS := -lm -lpthread -lgcc_s
|
||||
// else
|
||||
// ifeq ($(UNAME),SunOS)
|
||||
// EXTRACFLAGS := -lm -lpthread -lposix4 -lsocket -lresolv
|
||||
// else
|
||||
// ifeq ($(UNAME),OpenBSD)
|
||||
// EXTRACFLAGS := -lm -lpthread -lc++abi
|
||||
// else
|
||||
// EXTRACFLAGS := -lm -lrt -ldl -lpthread
|
||||
// endif
|
||||
// endif
|
||||
// endif
|
||||
// endif
|
||||
// endif
|
||||
// ```
|
||||
|
||||
if is_windows() {
|
||||
if is_msvc() {
|
||||
vec![
|
||||
@ -60,31 +30,6 @@ pub fn extra_c_flags() -> Vec<&'static str> {
|
||||
|
||||
/// `EXTRACXXFLAGS`
|
||||
pub fn extra_cxx_flags() -> Vec<&'static str> {
|
||||
// Adapted from tools.mk (trimmed):
|
||||
//
|
||||
// ```makefile
|
||||
// ifdef IS_WINDOWS
|
||||
// ifdef IS_MSVC
|
||||
// else
|
||||
// EXTRACXXFLAGS := -lstdc++
|
||||
// endif
|
||||
// else
|
||||
// ifeq ($(UNAME),Darwin)
|
||||
// EXTRACXXFLAGS := -lc++
|
||||
// else
|
||||
// ifeq ($(UNAME),FreeBSD)
|
||||
// else
|
||||
// ifeq ($(UNAME),SunOS)
|
||||
// else
|
||||
// ifeq ($(UNAME),OpenBSD)
|
||||
// else
|
||||
// EXTRACXXFLAGS := -lstdc++
|
||||
// endif
|
||||
// endif
|
||||
// endif
|
||||
// endif
|
||||
// endif
|
||||
// ```
|
||||
if is_windows() {
|
||||
if is_msvc() { vec![] } else { vec!["-lstdc++"] }
|
||||
} else {
|
||||
|
@ -365,31 +365,6 @@ impl Rustc {
|
||||
|
||||
/// `EXTRARSCXXFLAGS`
|
||||
pub fn extra_rs_cxx_flags(&mut self) -> &mut Self {
|
||||
// Adapted from tools.mk (trimmed):
|
||||
//
|
||||
// ```makefile
|
||||
// ifdef IS_WINDOWS
|
||||
// ifdef IS_MSVC
|
||||
// else
|
||||
// EXTRARSCXXFLAGS := -lstatic:-bundle=stdc++
|
||||
// endif
|
||||
// else
|
||||
// ifeq ($(UNAME),Darwin)
|
||||
// EXTRARSCXXFLAGS := -lc++
|
||||
// else
|
||||
// ifeq ($(UNAME),FreeBSD)
|
||||
// else
|
||||
// ifeq ($(UNAME),SunOS)
|
||||
// else
|
||||
// ifeq ($(UNAME),OpenBSD)
|
||||
// else
|
||||
// EXTRARSCXXFLAGS := -lstdc++
|
||||
// endif
|
||||
// endif
|
||||
// endif
|
||||
// endif
|
||||
// endif
|
||||
// ```
|
||||
if is_windows() {
|
||||
// So this is a bit hacky: we can't use the DLL version of libstdc++ because
|
||||
// it pulls in the DLL version of libgcc, which means that we end up with 2
|
||||
|
@ -79,7 +79,6 @@ pub(crate) mod iter_header;
|
||||
pub mod known_bug;
|
||||
pub mod mir_opt_tests;
|
||||
pub mod pal;
|
||||
pub mod run_make_tests;
|
||||
pub mod rustdoc_css_themes;
|
||||
pub mod rustdoc_gui_tests;
|
||||
pub mod rustdoc_templates;
|
||||
|
@ -103,8 +103,6 @@ fn main() {
|
||||
check!(tests_revision_unpaired_stdout_stderr, &tests_path);
|
||||
check!(debug_artifacts, &tests_path);
|
||||
check!(ui_tests, &root_path, bless);
|
||||
// FIXME(jieyouxu): remove this check once all run-make tests are ported over to rmake.rs.
|
||||
check!(run_make_tests, &tests_path, &src_path, bless);
|
||||
check!(mir_opt_tests, &tests_path, bless);
|
||||
check!(rustdoc_gui_tests, &tests_path);
|
||||
check!(rustdoc_css_themes, &librustdoc_path);
|
||||
|
@ -1,104 +0,0 @@
|
||||
//! Tidy check to ensure that no new Makefiles are added under `tests/run-make/`.
|
||||
|
||||
use std::collections::BTreeSet;
|
||||
use std::fs::File;
|
||||
use std::io::Write;
|
||||
use std::path::{Path, PathBuf};
|
||||
|
||||
pub fn check(tests_path: &Path, src_path: &Path, bless: bool, bad: &mut bool) {
|
||||
let mut is_sorted = true;
|
||||
|
||||
let allowed_makefiles = {
|
||||
let mut total_lines = 0;
|
||||
let mut prev_line = "";
|
||||
let allowed_makefiles: BTreeSet<&str> = include_str!("allowed_run_make_makefiles.txt")
|
||||
.lines()
|
||||
.map(|line| {
|
||||
total_lines += 1;
|
||||
|
||||
if prev_line > line {
|
||||
is_sorted = false;
|
||||
}
|
||||
|
||||
prev_line = line;
|
||||
|
||||
line
|
||||
})
|
||||
.collect();
|
||||
|
||||
if !is_sorted && !bless {
|
||||
tidy_error!(
|
||||
bad,
|
||||
"`src/tools/tidy/src/allowed_run_make_makefiles.txt` is not in order, likely \
|
||||
because you modified it manually, please only update it with command \
|
||||
`x test tidy --bless`"
|
||||
);
|
||||
}
|
||||
if allowed_makefiles.len() != total_lines {
|
||||
tidy_error!(
|
||||
bad,
|
||||
"`src/tools/tidy/src/allowed_run_make_makefiles.txt` contains duplicate entries, \
|
||||
likely because you modified it manually, please only update it with command \
|
||||
`x test tidy --bless`"
|
||||
);
|
||||
}
|
||||
|
||||
allowed_makefiles
|
||||
};
|
||||
|
||||
let mut remaining_makefiles = allowed_makefiles.clone();
|
||||
|
||||
crate::walk::walk_no_read(
|
||||
&[tests_path.join("run-make").as_ref()],
|
||||
|_, _| false,
|
||||
&mut |entry| {
|
||||
if entry.file_type().map_or(true, |t| t.is_dir()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if entry.file_name().to_str().map_or(true, |f| f != "Makefile") {
|
||||
return;
|
||||
}
|
||||
|
||||
let makefile_path = entry.path().strip_prefix(&tests_path).unwrap();
|
||||
let makefile_path = makefile_path.to_str().unwrap().replace('\\', "/");
|
||||
|
||||
if !remaining_makefiles.remove(makefile_path.as_str()) {
|
||||
tidy_error!(
|
||||
bad,
|
||||
"found run-make Makefile not permitted in \
|
||||
`src/tools/tidy/src/allowed_run_make_makefiles.txt`, please write new run-make \
|
||||
tests with `rmake.rs` instead: {}",
|
||||
entry.path().display()
|
||||
);
|
||||
}
|
||||
},
|
||||
);
|
||||
|
||||
// If there are any expected Makefiles remaining, they were moved or deleted.
|
||||
// Our data must remain up to date, so they must be removed from
|
||||
// `src/tools/tidy/src/allowed_run_make_makefiles.txt`.
|
||||
// This can be done automatically on --bless, or else a tidy error will be issued.
|
||||
if bless && (!remaining_makefiles.is_empty() || !is_sorted) {
|
||||
let tidy_src = src_path.join("tools").join("tidy").join("src");
|
||||
let org_file_path = tidy_src.join("allowed_run_make_makefiles.txt");
|
||||
let temp_file_path = tidy_src.join("blessed_allowed_run_make_makefiles.txt");
|
||||
let mut temp_file = t!(File::create_new(&temp_file_path));
|
||||
for file in allowed_makefiles.difference(&remaining_makefiles) {
|
||||
t!(writeln!(temp_file, "{file}"));
|
||||
}
|
||||
t!(std::fs::rename(&temp_file_path, &org_file_path));
|
||||
} else {
|
||||
for file in remaining_makefiles {
|
||||
let mut p = PathBuf::from(tests_path);
|
||||
p.push(file);
|
||||
tidy_error!(
|
||||
bad,
|
||||
"Makefile `{}` no longer exists and should be removed from the exclusions in \
|
||||
`src/tools/tidy/src/allowed_run_make_makefiles.txt`, you can run `x test tidy --bless` to update \
|
||||
the allow list",
|
||||
p.display()
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
@ -1,32 +1,17 @@
|
||||
# The `run-make` test suite
|
||||
|
||||
The `run-make` test suite contains tests which are the most flexible out of all
|
||||
the [rust-lang/rust](https://github.com/rust-lang/rust) test suites. `run-make`
|
||||
tests can basically contain arbitrary code, and are supported by the
|
||||
[`run_make_support`] library.
|
||||
The `run-make` test suite contains tests which are the most flexible out of all the [rust-lang/rust](https://github.com/rust-lang/rust) test suites. `run-make` tests can basically contain arbitrary code, and are supported by the [`run_make_support`] library.
|
||||
|
||||
## Infrastructure
|
||||
|
||||
There are two kinds of run-make tests:
|
||||
A `run-make` test is a test recipe source file `rmake.rs` accompanied by its parent directory (e.g. `tests/run-make/foo/rmake.rs` is the `foo` `run-make` test).
|
||||
|
||||
1. The new `rmake.rs` version: this allows run-make tests to be written in Rust
|
||||
(with `rmake.rs` as the main test file).
|
||||
2. The legacy `Makefile` version: this is what run-make tests were written with
|
||||
before support for `rmake.rs` was introduced.
|
||||
The implementation for collecting and building the `rmake.rs` recipes are in [`src/tools/compiletest/src/runtest.rs`](../../src/tools/compiletest/src/runtest.rs), in `run_rmake_test`.
|
||||
|
||||
The implementation for collecting and building the `rmake.rs` recipes (or
|
||||
`Makefile`s) are in
|
||||
[`src/tools/compiletest/src/runtest.rs`](../../src/tools/compiletest/src/runtest.rs),
|
||||
in `run_rmake_v2_test` and `run_rmake_legacy_test`.
|
||||
|
||||
### Rust-based `run-make` tests: `rmake.rs`
|
||||
|
||||
The setup for the `rmake.rs` version is a 3-stage process:
|
||||
The setup for the `rmake.rs` can be summarized as a 3-stage process:
|
||||
|
||||
1. First, we build the [`run_make_support`] library in bootstrap as a tool lib.
|
||||
2. Then, we compile the `rmake.rs` "recipe" linking the support library and its
|
||||
dependencies in, and provide a bunch of env vars. We setup a directory
|
||||
structure within `build/<target>/test/run-make/`
|
||||
2. Then, we compile the `rmake.rs` "recipe" linking the support library and its dependencies in, and provide a bunch of env vars. We setup a directory structure within `build/<target>/test/run-make/`
|
||||
|
||||
```
|
||||
<test-name>/
|
||||
@ -34,15 +19,8 @@ The setup for the `rmake.rs` version is a 3-stage process:
|
||||
rmake_out/ # sources from test sources copied over
|
||||
```
|
||||
|
||||
and copy non-`rmake.rs` input support files over to `rmake_out/`. The
|
||||
support library is made available as an [*extern prelude*][extern_prelude].
|
||||
3. Finally, we run the recipe binary and set `rmake_out/` as the working
|
||||
directory.
|
||||
and copy non-`rmake.rs` input support files over to `rmake_out/`. The support library is made available as an [*extern prelude*][extern_prelude].
|
||||
3. Finally, we run the recipe binary and set `rmake_out/` as the working directory.
|
||||
|
||||
[`run_make_support`]: ../../src/tools/run-make-support
|
||||
[extern_prelude]: https://doc.rust-lang.org/reference/names/preludes.html#extern-prelude
|
||||
|
||||
### Formatting
|
||||
|
||||
Note that files under `tests/` are not formatted by `./x fmt`,
|
||||
use `rustfmt tests/path/to/file.rs` to format a specific file if desired.
|
||||
|
@ -1,209 +0,0 @@
|
||||
# These deliberately use `=` and not `:=` so that client makefiles can
|
||||
# augment HOST_RPATH_DIR / TARGET_RPATH_DIR.
|
||||
HOST_RPATH_ENV = \
|
||||
$(LD_LIB_PATH_ENVVAR)="$(TMPDIR):$(HOST_RPATH_DIR):$($(LD_LIB_PATH_ENVVAR))"
|
||||
TARGET_RPATH_ENV = \
|
||||
$(LD_LIB_PATH_ENVVAR)="$(TMPDIR):$(TARGET_RPATH_DIR):$($(LD_LIB_PATH_ENVVAR))"
|
||||
|
||||
RUSTC_ORIGINAL := $(RUSTC)
|
||||
BARE_RUSTC := $(HOST_RPATH_ENV) '$(RUSTC)'
|
||||
BARE_RUSTDOC := $(HOST_RPATH_ENV) '$(RUSTDOC)'
|
||||
RUSTC := $(BARE_RUSTC) --out-dir $(TMPDIR) -L $(TMPDIR) $(RUSTFLAGS) -Ainternal_features
|
||||
RUSTDOC := $(BARE_RUSTDOC) -L $(TARGET_RPATH_DIR)
|
||||
ifdef RUSTC_LINKER
|
||||
RUSTC := $(RUSTC) -Clinker='$(RUSTC_LINKER)'
|
||||
RUSTDOC := $(RUSTDOC) -Clinker='$(RUSTC_LINKER)'
|
||||
endif
|
||||
#CC := $(CC) -L $(TMPDIR)
|
||||
HTMLDOCCK := '$(PYTHON)' '$(S)/src/etc/htmldocck.py'
|
||||
CGREP := "$(S)/src/etc/cat-and-grep.sh"
|
||||
|
||||
# diff with common flags for multi-platform diffs against text output
|
||||
DIFF := diff -u --strip-trailing-cr
|
||||
|
||||
# With RUSTC_TEST_OP you can elegantly support blessing of run-make tests. Do
|
||||
# like this in a Makefile recipe:
|
||||
#
|
||||
# "$(TMPDIR)"/your-test > "$(TMPDIR)"/your-test.run.stdout
|
||||
# $(RUSTC_TEST_OP) "$(TMPDIR)"/your-test.run.stdout your-test.run.stdout
|
||||
#
|
||||
# When running the test normally with
|
||||
#
|
||||
# ./x test tests/run-make/your-test
|
||||
#
|
||||
# the actual output will be diffed against the expected output. When running in
|
||||
# bless-mode with
|
||||
#
|
||||
# ./x test --bless tests/run-make/your-test
|
||||
#
|
||||
# the actual output will be blessed as the expected output.
|
||||
ifdef RUSTC_BLESS_TEST
|
||||
RUSTC_TEST_OP = cp
|
||||
else
|
||||
RUSTC_TEST_OP = $(DIFF)
|
||||
endif
|
||||
|
||||
# Some of the Rust CI platforms use `/bin/dash` to run `shell` script in
|
||||
# Makefiles. Other platforms, including many developer platforms, default to
|
||||
# `/bin/bash`. (In many cases, `make` is actually using `/bin/sh`, but `sh`
|
||||
# is configured to execute one or the other shell binary). `dash` features
|
||||
# support only a small subset of `bash` features, so `dash` can be thought of as
|
||||
# the lowest common denominator, and tests should be validated against `dash`
|
||||
# whenever possible. Most developer platforms include `/bin/dash`, but to ensure
|
||||
# tests still work when `/bin/dash`, if not available, this `SHELL` override is
|
||||
# conditional:
|
||||
ifndef IS_WINDOWS # dash interprets backslashes in executable paths incorrectly
|
||||
ifneq (,$(wildcard /bin/dash))
|
||||
SHELL := /bin/dash
|
||||
endif
|
||||
endif
|
||||
|
||||
# This is the name of the binary we will generate and run; use this
|
||||
# e.g. for `$(CC) -o $(RUN_BINFILE)`.
|
||||
RUN_BINFILE = $(TMPDIR)/$(1)
|
||||
|
||||
# Invoke the generated binary on the remote machine if compiletest was
|
||||
# configured to use a remote test device, otherwise run it on the current host.
|
||||
ifdef REMOTE_TEST_CLIENT
|
||||
# FIXME: if a test requires additional files, this will need to be changed to
|
||||
# also push them (by changing the 0 to the number of additional files, and
|
||||
# providing the path of the additional files as the last arguments).
|
||||
EXECUTE = $(REMOTE_TEST_CLIENT) run 0 $(RUN_BINFILE)
|
||||
else
|
||||
EXECUTE = $(RUN_BINFILE)
|
||||
endif
|
||||
|
||||
# RUN and FAIL are basic way we will invoke the generated binary. On
|
||||
# non-windows platforms, they set the LD_LIBRARY_PATH environment
|
||||
# variable before running the binary.
|
||||
|
||||
RLIB_GLOB = lib$(1)*.rlib
|
||||
BIN = $(1)
|
||||
|
||||
UNAME = $(shell uname)
|
||||
|
||||
ifeq ($(UNAME),Darwin)
|
||||
RUN = $(TARGET_RPATH_ENV) $(EXECUTE)
|
||||
FAIL = $(TARGET_RPATH_ENV) $(EXECUTE) && exit 1 || exit 0
|
||||
DYLIB_GLOB = lib$(1)*.dylib
|
||||
DYLIB = $(TMPDIR)/lib$(1).dylib
|
||||
STATICLIB = $(TMPDIR)/lib$(1).a
|
||||
STATICLIB_GLOB = lib$(1)*.a
|
||||
else
|
||||
ifdef IS_WINDOWS
|
||||
RUN = PATH="$(PATH):$(TARGET_RPATH_DIR)" $(EXECUTE)
|
||||
FAIL = PATH="$(PATH):$(TARGET_RPATH_DIR)" $(EXECUTE) && exit 1 || exit 0
|
||||
DYLIB_GLOB = $(1)*.dll
|
||||
DYLIB = $(TMPDIR)/$(1).dll
|
||||
ifdef IS_MSVC
|
||||
STATICLIB = $(TMPDIR)/$(1).lib
|
||||
STATICLIB_GLOB = $(1)*.lib
|
||||
else
|
||||
IMPLIB = $(TMPDIR)/lib$(1).dll.a
|
||||
STATICLIB = $(TMPDIR)/lib$(1).a
|
||||
STATICLIB_GLOB = lib$(1)*.a
|
||||
endif
|
||||
BIN = $(1).exe
|
||||
LLVM_FILECHECK := $(shell cygpath -u "$(LLVM_FILECHECK)")
|
||||
else
|
||||
RUN = $(TARGET_RPATH_ENV) $(EXECUTE)
|
||||
FAIL = $(TARGET_RPATH_ENV) $(EXECUTE) && exit 1 || exit 0
|
||||
DYLIB_GLOB = lib$(1)*.so
|
||||
DYLIB = $(TMPDIR)/lib$(1).so
|
||||
STATICLIB = $(TMPDIR)/lib$(1).a
|
||||
STATICLIB_GLOB = lib$(1)*.a
|
||||
endif
|
||||
endif
|
||||
|
||||
ifdef IS_MSVC
|
||||
COMPILE_OBJ = $(CC) -c -Fo:`cygpath -w $(1)` $(2)
|
||||
COMPILE_OBJ_CXX = $(CXX) -EHs -c -Fo:`cygpath -w $(1)` $(2)
|
||||
NATIVE_STATICLIB_FILE = $(1).lib
|
||||
NATIVE_STATICLIB = $(TMPDIR)/$(call NATIVE_STATICLIB_FILE,$(1))
|
||||
OUT_EXE=-Fe:`cygpath -w $(TMPDIR)/$(call BIN,$(1))` \
|
||||
-Fo:`cygpath -w $(TMPDIR)/$(1).obj`
|
||||
else
|
||||
COMPILE_OBJ = $(CC) -v -c -o $(1) $(2)
|
||||
COMPILE_OBJ_CXX = $(CXX) -c -o $(1) $(2)
|
||||
NATIVE_STATICLIB_FILE = lib$(1).a
|
||||
NATIVE_STATICLIB = $(call STATICLIB,$(1))
|
||||
OUT_EXE=-o $(TMPDIR)/$(1)
|
||||
endif
|
||||
|
||||
|
||||
# Extra flags needed to compile a working executable with the standard library
|
||||
ifdef IS_WINDOWS
|
||||
ifdef IS_MSVC
|
||||
EXTRACFLAGS := ws2_32.lib userenv.lib advapi32.lib bcrypt.lib ntdll.lib synchronization.lib
|
||||
else
|
||||
EXTRACFLAGS := -lws2_32 -luserenv -lbcrypt -lntdll -lsynchronization
|
||||
EXTRACXXFLAGS := -lstdc++
|
||||
# So this is a bit hacky: we can't use the DLL version of libstdc++ because
|
||||
# it pulls in the DLL version of libgcc, which means that we end up with 2
|
||||
# instances of the DW2 unwinding implementation. This is a problem on
|
||||
# i686-pc-windows-gnu because each module (DLL/EXE) needs to register its
|
||||
# unwind information with the unwinding implementation, and libstdc++'s
|
||||
# __cxa_throw won't see the unwinding info we registered with our statically
|
||||
# linked libgcc.
|
||||
#
|
||||
# Now, simply statically linking libstdc++ would fix this problem, except
|
||||
# that it is compiled with the expectation that pthreads is dynamically
|
||||
# linked as a DLL and will fail to link with a statically linked libpthread.
|
||||
#
|
||||
# So we end up with the following hack: we link use static:-bundle to only
|
||||
# link the parts of libstdc++ that we actually use, which doesn't include
|
||||
# the dependency on the pthreads DLL.
|
||||
EXTRARSCXXFLAGS := -l static:-bundle=stdc++
|
||||
endif
|
||||
else
|
||||
ifeq ($(UNAME),Darwin)
|
||||
EXTRACFLAGS := -lresolv
|
||||
EXTRACXXFLAGS := -lc++
|
||||
EXTRARSCXXFLAGS := -lc++
|
||||
else
|
||||
ifeq ($(UNAME),FreeBSD)
|
||||
EXTRACFLAGS := -lm -lpthread -lgcc_s
|
||||
else
|
||||
ifeq ($(UNAME),SunOS)
|
||||
EXTRACFLAGS := -lm -lpthread -lposix4 -lsocket -lresolv
|
||||
else
|
||||
ifeq ($(UNAME),OpenBSD)
|
||||
EXTRACFLAGS := -lm -lpthread -lc++abi
|
||||
RUSTC := $(RUSTC) -C linker="$(word 1,$(CC:ccache=))"
|
||||
else
|
||||
EXTRACFLAGS := -lm -lrt -ldl -lpthread
|
||||
EXTRACXXFLAGS := -lstdc++
|
||||
EXTRARSCXXFLAGS := -lstdc++
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
|
||||
REMOVE_DYLIBS = rm $(TMPDIR)/$(call DYLIB_GLOB,$(1))
|
||||
REMOVE_RLIBS = rm $(TMPDIR)/$(call RLIB_GLOB,$(1))
|
||||
|
||||
%.a: %.o
|
||||
$(AR) crus $@ $<
|
||||
ifdef IS_MSVC
|
||||
%.lib: lib%.o
|
||||
$(MSVC_LIB) -out:`cygpath -w $@` $<
|
||||
else
|
||||
%.lib: lib%.o
|
||||
$(AR) crus $@ $<
|
||||
endif
|
||||
%.dylib: %.o
|
||||
$(CC) -dynamiclib -Wl,-dylib -o $@ $<
|
||||
%.so: %.o
|
||||
$(CC) -o $@ $< -shared
|
||||
|
||||
ifdef IS_MSVC
|
||||
%.dll: lib%.o
|
||||
$(CC) $< -link -dll -out:`cygpath -w $@`
|
||||
else
|
||||
%.dll: lib%.o
|
||||
$(CC) -o $@ $< -shared -Wl,--out-implib=$@.a
|
||||
endif
|
||||
|
||||
$(TMPDIR)/lib%.o: %.c
|
||||
$(call COMPILE_OBJ,$@,$<)
|
@ -838,13 +838,7 @@ message = "Some changes occurred in GUI tests."
|
||||
cc = ["@GuillaumeGomez"]
|
||||
|
||||
[mentions."tests/run-make/"]
|
||||
message = """
|
||||
This PR modifies `tests/run-make/`. If this PR is trying to port a Makefile
|
||||
run-make test to use rmake.rs, please update the
|
||||
[run-make port tracking issue](https://github.com/rust-lang/rust/issues/121876)
|
||||
so we can track our progress. You can either modify the tracking issue
|
||||
directly, or you can comment on the tracking issue and link this PR.
|
||||
"""
|
||||
message = "This PR modifies `run-make` tests."
|
||||
cc = ["@jieyouxu"]
|
||||
|
||||
[mentions."src/rustdoc-json-types"]
|
||||
|
Loading…
Reference in New Issue
Block a user