Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 5a2536f

Browse files
authoredJul 1, 2024
Unrolled build for rust-lang#126880
Rollup merge of rust-lang#126880 - Rejyr:migrate-rmake-vw, r=Kobzol Migrate `volatile-intrinsics`, `weird-output-filenames`, `wasm-override-linker`, `wasm-exceptions-nostd` to `rmake` Also refactors `wasm-abi` and `compressed-debuginfo`. Part of rust-lang#121876. r? ``@jieyouxu`` try-job: x86_64-gnu-debug try-job: dist-various-2
2 parents 221e274 + 2ef2699 commit 5a2536f

File tree

12 files changed

+80
-69
lines changed

12 files changed

+80
-69
lines changed
 

‎src/tools/tidy/src/allowed_run_make_makefiles.txt

-4
Original file line numberDiff line numberDiff line change
@@ -175,8 +175,4 @@ run-make/track-pgo-dep-info/Makefile
175175
run-make/translation/Makefile
176176
run-make/type-mismatch-same-crate-name/Makefile
177177
run-make/unstable-flag-required/Makefile
178-
run-make/volatile-intrinsics/Makefile
179-
run-make/wasm-exceptions-nostd/Makefile
180-
run-make/wasm-override-linker/Makefile
181-
run-make/weird-output-filenames/Makefile
182178
run-make/x86_64-fortanix-unknown-sgx-lvi/Makefile

‎tests/run-make/compressed-debuginfo/rmake.rs

+2-3
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
// FIXME: This test isn't comprehensive and isn't covering all possible combinations.
77

8-
use run_make_support::{assert_contains, cmd, run_in_tmpdir, rustc};
8+
use run_make_support::{assert_contains, cmd, llvm_readobj, run_in_tmpdir, rustc};
99

1010
fn check_compression(compression: &str, to_find: &str) {
1111
run_in_tmpdir(|| {
@@ -19,8 +19,7 @@ fn check_compression(compression: &str, to_find: &str) {
1919
.run();
2020
let stderr = out.stderr_utf8();
2121
if stderr.is_empty() {
22-
// FIXME: `readelf` might need to be replaced with `llvm-readelf`.
23-
cmd("readelf").arg("-t").arg("foo.o").run().assert_stdout_contains(to_find);
22+
llvm_readobj().arg("-t").arg("foo.o").run().assert_stdout_contains(to_find);
2423
} else {
2524
assert_contains(
2625
&stderr,

‎tests/run-make/volatile-intrinsics/Makefile

-10
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
//@ ignore-cross-compile
2+
3+
use run_make_support::fs_wrapper::read;
4+
use run_make_support::{assert_contains, run, rustc};
5+
6+
fn main() {
7+
// The tests must pass...
8+
rustc().input("main.rs").run();
9+
run("main");
10+
11+
// ... and the loads/stores must not be optimized out.
12+
rustc().input("main.rs").emit("llvm-ir").run();
13+
14+
let raw_llvm_ir = read("main.ll");
15+
let llvm_ir = String::from_utf8_lossy(&raw_llvm_ir);
16+
assert_contains(&llvm_ir, "load volatile");
17+
assert_contains(&llvm_ir, "store volatile");
18+
}

‎tests/run-make/wasm-abi/rmake.rs

+4-7
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
//@ only-wasm32-wasip1
22
//@ needs-wasmtime
33

4-
use run_make_support::rustc;
4+
use run_make_support::{cmd, rustc};
55
use std::path::Path;
6-
use std::process::Command;
76

87
fn main() {
98
rustc().input("foo.rs").target("wasm32-wasip1").run();
@@ -19,14 +18,12 @@ fn main() {
1918
}
2019

2120
fn run(file: &Path, method: &str, expected_output: &str) {
22-
let output = Command::new("wasmtime")
21+
cmd("wasmtime")
2322
.arg("run")
2423
.arg("--preload=host=host.wat")
2524
.arg("--invoke")
2625
.arg(method)
2726
.arg(file)
28-
.output()
29-
.unwrap();
30-
assert!(output.status.success());
31-
assert_eq!(expected_output, String::from_utf8_lossy(&output.stdout));
27+
.run()
28+
.assert_stdout_equals(expected_output);
3229
}

‎tests/run-make/wasm-exceptions-nostd/Makefile

-12
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
//@ only-wasm32-bare
2+
3+
use std::path::Path;
4+
5+
use run_make_support::{cmd, env_var, rustc};
6+
7+
fn main() {
8+
// Add a few command line args to make exceptions work
9+
rustc()
10+
.input(Path::new("src").join("lib.rs"))
11+
.target("wasm32-unknown-unknown")
12+
.panic("unwind")
13+
.arg("-Cllvm-args=-wasm-enable-eh")
14+
.arg("-Ctarget-feature=+exception-handling")
15+
.run();
16+
17+
cmd(&env_var("NODE")).arg("verify.mjs").arg("lib.wasm").run();
18+
}

‎tests/run-make/wasm-exceptions-nostd/src/panicking.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ fn panic_handler(info: &core::panic::PanicInfo<'_>) -> ! {
1717
use alloc::boxed::Box;
1818
use alloc::string::ToString;
1919

20-
let msg = info.message().map(|msg| msg.to_string()).unwrap_or("(no message)".to_string());
21-
let exception = Box::new(msg.to_string());
20+
let msg = info.message().to_string();
21+
let exception = Box::new(msg);
2222
unsafe {
2323
let exception_raw = Box::into_raw(exception);
2424
wasm_throw(exception_raw as *mut u8);

‎tests/run-make/wasm-override-linker/Makefile

-16
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
// How to run this
2+
// $ RUSTBUILD_FORCE_CLANG_BASED_TESTS=1 ./x.py test tests/run-make/wasm-override-linker/
3+
4+
//@ needs-force-clang-based-tests
5+
6+
use run_make_support::{env_var, rustc, target};
7+
8+
fn main() {
9+
if matches!(target().as_str(), "wasm32-unknown-unknown" | "wasm64-unknown-unknown") {
10+
rustc()
11+
.input("foo.rs")
12+
.crate_type("cdylib")
13+
.target(&target())
14+
.linker(&env_var("CLANG"))
15+
.run();
16+
}
17+
}

‎tests/run-make/weird-output-filenames/Makefile

-15
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
use run_make_support::fs_wrapper::copy;
2+
use run_make_support::regex::Regex;
3+
use run_make_support::{cwd, rustc};
4+
5+
fn main() {
6+
let invalid_characters = [".foo.rs", ".foo.bar", "+foo+bar.rs"];
7+
let re = Regex::new(r"invalid character.*in crate name:").unwrap();
8+
for f in invalid_characters {
9+
copy("foo.rs", f);
10+
let stderr = rustc().input(f).run_fail().stderr_utf8();
11+
assert!(re.is_match(&stderr));
12+
}
13+
14+
copy("foo.rs", "-foo.rs");
15+
rustc()
16+
.input(cwd().join("-foo.rs"))
17+
.run_fail()
18+
.assert_stderr_contains("crate names cannot start with a `-`");
19+
}

0 commit comments

Comments
 (0)
Failed to load comments.