Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
8a850cd
std/time: avoid divisions in Duration::new
utkarshgupta137 Jan 24, 2024
8148053
Add supporting infrastructure for `run-make` V2 tests
jieyouxu Jan 20, 2024
e1826bf
Point to stage1-std when in stage2 rustc
jieyouxu Feb 2, 2024
c2a0d11
Fix incorrect stage std paths
jieyouxu Feb 2, 2024
0ac1195
Invert diagnostic lints.
nnethercote Feb 5, 2024
ad3d04c
A drive-by rewrite of give_region_a_name()
amandasystems Feb 6, 2024
0f323b2
Associated types in traits don't necessarily have a type that we can …
oli-obk Feb 7, 2024
0b97d18
extern types don't have any types to visit
oli-obk Feb 7, 2024
b998b51
Actually walk fields of Adt definitions
oli-obk Feb 7, 2024
4389a1c
Stop using `hir_ty_to_ty` in rustc_privacy
oli-obk Jul 18, 2023
5c25de6
Remove now-useless method override
oli-obk Feb 7, 2024
e867886
Remove dead code
oli-obk Feb 7, 2024
795be51
Make `RegionName` `Copy` by (transitively) interning the few string v…
amandasystems Feb 7, 2024
d80d7ea
Add some tests for associated type normalization edge cases
oli-obk Feb 8, 2024
d70d320
Use `transmute_unchecked` in `NonZero::new`.
reitermarkus Feb 8, 2024
698a3c7
Don't ICE in ByMoveBody when coroutine is tainted
compiler-errors Feb 8, 2024
e32c1dd
Don't ice in validation when error body is created
compiler-errors Feb 9, 2024
7619792
Fix `ErrorGuaranteed` unsoundness with stash/steal.
nnethercote Feb 8, 2024
575e0aa
Startup objects disappearing from sysroot
Nikokrock Feb 9, 2024
163510f
Rollup merge of #113026 - jieyouxu:run-make-v2, r=bjorn3
matthiaskrgr Feb 9, 2024
8bc0462
Rollup merge of #113671 - oli-obk:normalize_weak_tys, r=petrochenkov
matthiaskrgr Feb 9, 2024
e34ea3e
Rollup merge of #120308 - utkarshgupta137:duration-opt, r=m-ou-se
matthiaskrgr Feb 9, 2024
16a17e6
Rollup merge of #120693 - nnethercote:invert-diagnostic-lints, r=davi…
matthiaskrgr Feb 9, 2024
c8d7eda
Rollup merge of #120704 - amandasystems:silly-region-name-rewrite, r=…
matthiaskrgr Feb 9, 2024
8ebe9f0
Rollup merge of #120809 - reitermarkus:generic-nonzero-constructors, …
matthiaskrgr Feb 9, 2024
8946437
Rollup merge of #120817 - compiler-errors:more-mir-errors, r=oli-obk
matthiaskrgr Feb 9, 2024
f90cac5
Rollup merge of #120828 - nnethercote:fix-stash-steal, r=oli-obk
matthiaskrgr Feb 9, 2024
e0d1c15
Rollup merge of #120831 - Nikokrock:pr/disappearing_startup_objects, …
matthiaskrgr Feb 9, 2024
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
Prev Previous commit
Next Next commit
Add supporting infrastructure for run-make V2 tests
  • Loading branch information
jieyouxu committed Feb 1, 2024
commit 8148053e55f799e91af10766841b593e38b07752
13 changes: 13 additions & 0 deletions Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3258,6 +3258,13 @@ dependencies = [
"serde_json",
]

[[package]]
name = "run_make_support"
version = "0.0.0"
dependencies = [
"shell-words",
]

[[package]]
name = "rust-demangler"
version = "0.0.1"
Expand Down Expand Up @@ -4968,6 +4975,12 @@ version = "0.1.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "45bb67a18fa91266cc7807181f62f9178a6873bfad7dc788c42e6430db40184f"

[[package]]
name = "shell-words"
version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "24188a676b6ae68c3b2cb3a01be17fbf7240ce009799bb56d5b1409051e78fde"

[[package]]
name = "shlex"
version = "1.1.0"
Expand Down
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ members = [
"src/tools/clippy",
"src/tools/clippy/clippy_dev",
"src/tools/compiletest",
"src/tools/run-make-support",
"src/tools/error_index_generator",
"src/tools/linkchecker",
"src/tools/lint-docs",
Expand Down
83 changes: 82 additions & 1 deletion src/bootstrap/src/core/build_steps/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ use crate::core::config::flags::Subcommand;
use crate::core::config::TargetSelection;
use crate::utils;
use crate::utils::cache::{Interned, INTERNER};
use crate::utils::dylib::shared_lib_name;
use crate::utils::exec::BootstrapCommand;
use crate::utils::helpers::{
self, add_link_lib_path, add_rustdoc_cargo_linker_args, dylib_path, dylib_path_var,
Expand Down Expand Up @@ -1344,6 +1345,53 @@ macro_rules! coverage_test_alias {
};
}

#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq, Ord, PartialOrd)]
pub struct RunMakeSupport {
pub compiler: Compiler,
pub target: TargetSelection,
}

impl Step for RunMakeSupport {
type Output = PathBuf;
const DEFAULT: bool = true;

fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> {
run.never()
}

fn make_run(run: RunConfig<'_>) {
let compiler = run.builder.compiler(run.builder.top_stage, run.build_triple());
run.builder.ensure(RunMakeSupport { compiler, target: run.target });
}

fn run(self, builder: &Builder<'_>) -> PathBuf {
builder.ensure(compile::Std::new(self.compiler, self.target));

let cargo = tool::prepare_tool_cargo(
builder,
self.compiler,
Mode::ToolStd,
self.target,
"build",
"src/tools/run-make-support",
SourceType::InTree,
&[],
);

let mut cargo = Command::from(cargo);
cargo.env("RUSTFLAGS", "-C prefer-dynamic");
builder.run(&mut cargo);

let lib_name = shared_lib_name("run_make_support", &self.target.to_string());
let lib = builder.tools_dir(self.compiler).join(&lib_name);

let cargo_out =
builder.cargo_out(self.compiler, Mode::ToolStd, self.target).join(&lib_name);
builder.copy(&cargo_out, &lib);
lib
}
}

default_test!(Ui { path: "tests/ui", mode: "ui", suite: "ui" });

default_test!(RunPassValgrind {
Expand Down Expand Up @@ -1378,7 +1426,40 @@ host_test!(RustdocJson { path: "tests/rustdoc-json", mode: "rustdoc-json", suite

host_test!(Pretty { path: "tests/pretty", mode: "pretty", suite: "pretty" });

default_test!(RunMake { path: "tests/run-make", mode: "run-make", suite: "run-make" });
// Special-handling is needed for `run-make`, so don't use `default_test` for defining `RunMake`
// tests.
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
pub struct RunMake {
pub compiler: Compiler,
pub target: TargetSelection,
}

impl Step for RunMake {
type Output = ();
const DEFAULT: bool = true;
const ONLY_HOSTS: bool = false;

fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> {
run.suite_path("tests/run-make")
}

fn make_run(run: RunConfig<'_>) {
let compiler = run.builder.compiler(run.builder.top_stage, run.build_triple());
run.builder.ensure(RunMakeSupport { compiler, target: run.target });
run.builder.ensure(RunMake { compiler, target: run.target });
}

fn run(self, builder: &Builder<'_>) {
builder.ensure(Compiletest {
compiler: self.compiler,
target: self.target,
mode: "run-make",
suite: "run-make",
path: "tests/run-make",
compare_mode: None,
});
}
}

host_test!(RunMakeFullDeps {
path: "tests/run-make-fulldeps",
Expand Down
13 changes: 13 additions & 0 deletions src/bootstrap/src/utils/dylib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,16 @@ pub fn exe(name: &str, target: &str) -> String {
name.to_string()
}
}

/// Given a shared library called `name`, return the filename for the
/// shared library for a particular target.
#[allow(dead_code)]
pub fn shared_lib_name(name: &str, target: &str) -> String {
if target.contains("windows") {
format!("lib{name}.dll")
} else if target.contains("apple") {
format!("lib{name}.dylib")
} else {
format!("lib{name}.so")
}
}
35 changes: 26 additions & 9 deletions src/tools/compiletest/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -655,13 +655,21 @@ fn collect_tests_from_dir(
return Ok(());
}

if config.mode == Mode::RunMake && dir.join("Makefile").exists() {
let paths = TestPaths {
file: dir.to_path_buf(),
relative_dir: relative_dir_path.parent().unwrap().to_path_buf(),
};
tests.extend(make_test(config, cache, &paths, inputs, poisoned));
return Ok(());
if 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() {
let paths = TestPaths {
file: dir.to_path_buf(),
relative_dir: relative_dir_path.parent().unwrap().to_path_buf(),
};
tests.extend(make_test(config, cache, &paths, inputs, poisoned));
return Ok(());
}
}

// If we find a test foo/bar.rs, we have to build the
Expand Down Expand Up @@ -731,8 +739,17 @@ fn make_test(
poisoned: &mut bool,
) -> Vec<test::TestDescAndFn> {
let test_path = if config.mode == Mode::RunMake {
// Parse directives in the Makefile
testpaths.file.join("Makefile")
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")
}
} else {
PathBuf::from(&testpaths.file)
};
Expand Down
Loading