Skip to content

Commit

Permalink
Rollup merge of rust-lang#125683 - Oneirical:patience-testing-test, r…
Browse files Browse the repository at this point in the history
…=jieyouxu

Rewrite `suspicious-library`, `resolve-rename` and `incr-prev-body-beyond-eof` `run-make` tests in `rmake.rs` format

Part of rust-lang#121876 and the associated [Google Summer of Code project](https://blog.rust-lang.org/2024/05/01/gsoc-2024-selected-projects.html).

Some oddly specific ignore flags in `incr-prev-body-beyond-eof`:

```rs
// ignore-none
// ignore-nvptx64-nvidia-cuda
```

it could be interesting to run a try job, but it seems there is no nvidia-cuda in the CI settings (`jobs.yml`).
  • Loading branch information
GuillaumeGomez authored Jun 1, 2024
2 parents 2e5b1d1 + a9f8f7d commit 9001245
Show file tree
Hide file tree
Showing 9 changed files with 71 additions and 37 deletions.
1 change: 1 addition & 0 deletions src/tools/compiletest/src/header.rs
Original file line number Diff line number Diff line change
Expand Up @@ -799,6 +799,7 @@ const KNOWN_DIRECTIVE_NAMES: &[&str] = &[
"ignore-none",
"ignore-nto",
"ignore-nvptx64",
"ignore-nvptx64-nvidia-cuda",
"ignore-openbsd",
"ignore-pass",
"ignore-remote",
Expand Down
6 changes: 6 additions & 0 deletions src/tools/run-make-support/src/rustc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,12 @@ impl Rustc {
self
}

/// Add a suffix in each output filename.
pub fn extra_filename(&mut self, suffix: &str) -> &mut Self {
self.cmd.arg(format!("-Cextra-filename={suffix}"));
self
}

/// Specify type(s) of output files to generate.
pub fn emit(&mut self, kinds: &str) -> &mut Self {
self.cmd.arg(format!("--emit={kinds}"));
Expand Down
3 changes: 0 additions & 3 deletions src/tools/tidy/src/allowed_run_make_makefiles.txt
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,6 @@ run-make/inaccessible-temp-dir/Makefile
run-make/include_bytes_deps/Makefile
run-make/incr-add-rust-src-component/Makefile
run-make/incr-foreign-head-span/Makefile
run-make/incr-prev-body-beyond-eof/Makefile
run-make/incremental-debugger-visualizer/Makefile
run-make/incremental-session-fail/Makefile
run-make/inline-always-many-cgu/Makefile
Expand Down Expand Up @@ -208,7 +207,6 @@ run-make/remap-path-prefix-dwarf/Makefile
run-make/remap-path-prefix/Makefile
run-make/reproducible-build-2/Makefile
run-make/reproducible-build/Makefile
run-make/resolve-rename/Makefile
run-make/return-non-c-like-enum-from-c/Makefile
run-make/return-non-c-like-enum/Makefile
run-make/rlib-chain/Makefile
Expand Down Expand Up @@ -238,7 +236,6 @@ run-make/static-pie/Makefile
run-make/staticlib-blank-lib/Makefile
run-make/staticlib-dylib-linkage/Makefile
run-make/std-core-cycle/Makefile
run-make/suspicious-library/Makefile
run-make/symbol-mangling-hashed/Makefile
run-make/symbol-visibility/Makefile
run-make/symbols-include-type-name/Makefile
Expand Down
19 changes: 0 additions & 19 deletions tests/run-make/incr-prev-body-beyond-eof/Makefile

This file was deleted.

34 changes: 34 additions & 0 deletions tests/run-make/incr-prev-body-beyond-eof/rmake.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
// After modifying the span of a function, if the length of
// the span remained the same but the end line number became different,
// this would cause an internal compiler error (ICE), fixed in #76256.

// This test compiles main.rs twice, first with end line 16 and
// then with end line 12. If compilation is successful, the end line
// was hashed by rustc in addition to the span length, and the fix still
// works.

//@ ignore-none
// reason: no-std is not supported

//@ ignore-nvptx64-nvidia-cuda
// FIXME: can't find crate for `std`

use run_make_support::{rustc, target, tmp_dir};
use std::fs;

fn main() {
fs::create_dir(tmp_dir().join("src")).unwrap();
fs::create_dir(tmp_dir().join("incr")).unwrap();
fs::copy("a.rs", tmp_dir().join("src/main.rs")).unwrap();
rustc()
.incremental(tmp_dir().join("incr"))
.input(tmp_dir().join("src/main.rs"))
.target(&target())
.run();
fs::copy("b.rs", tmp_dir().join("src/main.rs")).unwrap();
rustc()
.incremental(tmp_dir().join("incr"))
.input(tmp_dir().join("src/main.rs"))
.target(&target())
.run();
}
7 changes: 0 additions & 7 deletions tests/run-make/resolve-rename/Makefile

This file was deleted.

16 changes: 16 additions & 0 deletions tests/run-make/resolve-rename/rmake.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
// If a library is compiled with -C extra-filename, the rust compiler
// will take this into account when searching for libraries. However,
// if that library is then renamed, the rust compiler should fall back
// to its regular library location logic and not immediately fail to find
// the renamed library.
// See https://github.com/rust-lang/rust/pull/49253

use run_make_support::{rustc, tmp_dir};
use std::fs;
fn main() {
rustc().extra_filename("-hash").input("foo.rs").run();
rustc().input("bar.rs").run();
fs::rename(tmp_dir().join("libfoo-hash.rlib"), tmp_dir().join("libfoo-another-hash.rlib"))
.unwrap();
rustc().input("baz.rs").run();
}
8 changes: 0 additions & 8 deletions tests/run-make/suspicious-library/Makefile

This file was deleted.

14 changes: 14 additions & 0 deletions tests/run-make/suspicious-library/rmake.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
// This test creates some fake dynamic libraries with nothing inside,
// and checks if rustc avoids them and successfully compiles as a result.

//@ ignore-cross-compile

use run_make_support::{dynamic_lib, rustc};
use std::fs::File;

fn main() {
rustc().input("foo.rs").arg("-Cprefer-dynamic").run();
File::create(dynamic_lib("foo-something-special")).unwrap();
File::create(dynamic_lib("foo-something-special2")).unwrap();
rustc().input("bar.rs").run();
}

0 comments on commit 9001245

Please sign in to comment.