Skip to content
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

Rollup of 10 pull requests #137988

Closed
wants to merge 34 commits into from
Closed
Changes from 8 commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
1cac5fa
Look for `python3` first on MacOS, not `py`
jyn514 Feb 13, 2025
477a2ee
std::fs: slightly reformat `remove_dir_all` error docs
jieyouxu Feb 18, 2025
2c752bc
Undeprecate env::home_dir
arlosi Feb 20, 2025
9323ba5
Remove MaybeForgetReturn suggestion
compiler-errors Feb 20, 2025
b340545
[illumos] attempt to use posix_spawn to spawn processes
sunshowers Feb 11, 2025
a8bff87
Stabilize [T]::split_off... methods
cramertj Feb 28, 2025
ea13ff7
add exclude to config.toml
Shourya742 Feb 16, 2025
d9ceab9
add test for exclude feature
Shourya742 Feb 16, 2025
9206960
Add change info to change tracker
Shourya742 Feb 16, 2025
3998690
compiletest: remove legacy `Makefile`-based `run-make` support
jieyouxu Feb 5, 2025
413b824
run-make: remove `tools.mk`
jieyouxu Feb 5, 2025
9b17c98
run-make: update test suite README
jieyouxu Feb 5, 2025
ed168e7
run-make-support: remove outdated comments
jieyouxu Mar 1, 2025
efec638
tidy: remove legacy `Makefile` checks
jieyouxu Feb 5, 2025
b0d6a84
rustc-dev-guide: remove mentions of legacy `Makefile` run-make infra
jieyouxu Feb 5, 2025
95b030f
triagebot: stop backlinking to the test porting tracking issue
jieyouxu Feb 5, 2025
a0ed304
float: Update some constants to `pub(crate)`
tgross35 Dec 9, 2024
5a2da96
dec2flt: Update documentation of existing methods
tgross35 Dec 9, 2024
49a2d4c
dec2flt: Rename `Decimal` to `DecimalSeq`
tgross35 Dec 9, 2024
626d2c5
dec2flt: Rename `Number` to `Decimal`
tgross35 Dec 9, 2024
6c34daf
dec2flt: Rename fields to be consistent with documented notation
tgross35 Dec 9, 2024
19a909a
dec2flt: Refactor float traits
tgross35 Dec 9, 2024
37e223c
dec2flt: Refactor the fast path
tgross35 Dec 9, 2024
133705c
[rustdoc] hide item that is not marked as doc(inline) and whose src i…
xizheyin Feb 27, 2025
1f930e7
Rollup merge of #134063 - tgross35:dec2flt-refactoring, r=Noratrieb
tgross35 Mar 4, 2025
a0e1ffa
Rollup merge of #136581 - jieyouxu:makefile-be-gone, r=Kobzol
tgross35 Mar 4, 2025
9d3bbb5
Rollup merge of #136975 - jyn514:macos-x, r=Mark-Simulacrum
tgross35 Mar 4, 2025
b74c6d3
Rollup merge of #137147 - Shourya742:2025-02-16-support-exclude-in-co…
tgross35 Mar 4, 2025
1396b94
Rollup merge of #137240 - jieyouxu:remove_dir_all, r=Mark-Simulacrum
tgross35 Mar 4, 2025
1a13de3
Rollup merge of #137303 - compiler-errors:maybe-forgor, r=cjgillot
tgross35 Mar 4, 2025
99d631c
Rollup merge of #137327 - arlosi:home-dir, r=Mark-Simulacrum
tgross35 Mar 4, 2025
5d8da22
Rollup merge of #137463 - sunshowers:illumos-posix-spawn, r=Mark-Simu…
tgross35 Mar 4, 2025
b4ae140
Rollup merge of #137534 - xizheyin:issue-137342, r=GuillaumeGomez
tgross35 Mar 4, 2025
acdf367
Rollup merge of #137829 - cramertj:stabilize-split-off, r=jhpratt
tgross35 Mar 4, 2025
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
30 changes: 1 addition & 29 deletions src/doc/rustc-dev-guide/src/tests/compiletest.md
Original file line number Diff line number Diff line change
@@ -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

7 changes: 1 addition & 6 deletions src/doc/rustc-dev-guide/src/tests/directives.md
Original file line number Diff line number Diff line change
@@ -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.
@@ -221,8 +218,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.
25 changes: 0 additions & 25 deletions src/doc/rustc-dev-guide/src/tests/running.md
Original file line number Diff line number Diff line change
@@ -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
16 changes: 7 additions & 9 deletions src/tools/compiletest/src/header.rs
Original file line number Diff line number Diff line change
@@ -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;
};

9 changes: 0 additions & 9 deletions src/tools/compiletest/src/header/tests.rs
Original file line number Diff line number Diff line change
@@ -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]
43 changes: 11 additions & 32 deletions src/tools/compiletest/src/lib.rs
Original file line number Diff line number Diff line change
@@ -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};
@@ -268,12 +268,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()
@@ -776,16 +772,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(),
@@ -854,24 +843,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)
};
164 changes: 0 additions & 164 deletions src/tools/compiletest/src/runtest/run_make.rs
Original file line number Diff line number Diff line change
@@ -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 `build/$TARGET/stageN-tools-bin/librun_make_support.rlib`.
@@ -191,8 +29,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();

17 changes: 0 additions & 17 deletions src/tools/run-make-support/src/artifact_names.rs
Original file line number Diff line number Diff line change
@@ -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") }
11 changes: 0 additions & 11 deletions src/tools/run-make-support/src/external_deps/c_cxx_compiler/cc.rs
Original file line number Diff line number Diff line change
@@ -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() {
Original file line number Diff line number Diff line change
@@ -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 {
25 changes: 0 additions & 25 deletions src/tools/run-make-support/src/external_deps/rustc.rs
Original file line number Diff line number Diff line change
@@ -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
Empty file.
1 change: 0 additions & 1 deletion src/tools/tidy/src/lib.rs
Original file line number Diff line number Diff line change
@@ -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;
2 changes: 0 additions & 2 deletions src/tools/tidy/src/main.rs
Original file line number Diff line number Diff line change
@@ -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);
104 changes: 0 additions & 104 deletions src/tools/tidy/src/run_make_tests.rs

This file was deleted.

36 changes: 7 additions & 29 deletions tests/run-make/README.md
Original file line number Diff line number Diff line change
@@ -1,48 +1,26 @@
# 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>/
rmake.exe # recipe binary
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.
209 changes: 0 additions & 209 deletions tests/run-make/tools.mk

This file was deleted.

8 changes: 1 addition & 7 deletions triagebot.toml
Original file line number Diff line number Diff line change
@@ -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"]