Rollup merge of #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 #121876. r? ``@jieyouxu`` try-job: x86_64-gnu-debug try-job: dist-various-2
This commit is contained in:
commit
61e7f05895
@ -175,8 +175,4 @@ run-make/track-pgo-dep-info/Makefile
|
||||
run-make/translation/Makefile
|
||||
run-make/type-mismatch-same-crate-name/Makefile
|
||||
run-make/unstable-flag-required/Makefile
|
||||
run-make/volatile-intrinsics/Makefile
|
||||
run-make/wasm-exceptions-nostd/Makefile
|
||||
run-make/wasm-override-linker/Makefile
|
||||
run-make/weird-output-filenames/Makefile
|
||||
run-make/x86_64-fortanix-unknown-sgx-lvi/Makefile
|
||||
|
@ -5,7 +5,7 @@
|
||||
|
||||
// FIXME: This test isn't comprehensive and isn't covering all possible combinations.
|
||||
|
||||
use run_make_support::{assert_contains, cmd, run_in_tmpdir, rustc};
|
||||
use run_make_support::{assert_contains, cmd, llvm_readobj, run_in_tmpdir, rustc};
|
||||
|
||||
fn check_compression(compression: &str, to_find: &str) {
|
||||
run_in_tmpdir(|| {
|
||||
@ -19,8 +19,7 @@ fn check_compression(compression: &str, to_find: &str) {
|
||||
.run();
|
||||
let stderr = out.stderr_utf8();
|
||||
if stderr.is_empty() {
|
||||
// FIXME: `readelf` might need to be replaced with `llvm-readelf`.
|
||||
cmd("readelf").arg("-t").arg("foo.o").run().assert_stdout_contains(to_find);
|
||||
llvm_readobj().arg("-t").arg("foo.o").run().assert_stdout_contains(to_find);
|
||||
} else {
|
||||
assert_contains(
|
||||
&stderr,
|
||||
|
@ -1,10 +0,0 @@
|
||||
# ignore-cross-compile
|
||||
include ../tools.mk
|
||||
|
||||
all:
|
||||
# The tests must pass...
|
||||
$(RUSTC) main.rs
|
||||
$(call RUN,main)
|
||||
# ... and the loads/stores must not be optimized out.
|
||||
$(RUSTC) main.rs --emit=llvm-ir
|
||||
$(CGREP) "load volatile" "store volatile" < $(TMPDIR)/main.ll
|
18
tests/run-make/volatile-intrinsics/rmake.rs
Normal file
18
tests/run-make/volatile-intrinsics/rmake.rs
Normal file
@ -0,0 +1,18 @@
|
||||
//@ ignore-cross-compile
|
||||
|
||||
use run_make_support::fs_wrapper::read;
|
||||
use run_make_support::{assert_contains, run, rustc};
|
||||
|
||||
fn main() {
|
||||
// The tests must pass...
|
||||
rustc().input("main.rs").run();
|
||||
run("main");
|
||||
|
||||
// ... and the loads/stores must not be optimized out.
|
||||
rustc().input("main.rs").emit("llvm-ir").run();
|
||||
|
||||
let raw_llvm_ir = read("main.ll");
|
||||
let llvm_ir = String::from_utf8_lossy(&raw_llvm_ir);
|
||||
assert_contains(&llvm_ir, "load volatile");
|
||||
assert_contains(&llvm_ir, "store volatile");
|
||||
}
|
@ -1,9 +1,8 @@
|
||||
//@ only-wasm32-wasip1
|
||||
//@ needs-wasmtime
|
||||
|
||||
use run_make_support::rustc;
|
||||
use run_make_support::{cmd, rustc};
|
||||
use std::path::Path;
|
||||
use std::process::Command;
|
||||
|
||||
fn main() {
|
||||
rustc().input("foo.rs").target("wasm32-wasip1").run();
|
||||
@ -19,14 +18,12 @@ fn main() {
|
||||
}
|
||||
|
||||
fn run(file: &Path, method: &str, expected_output: &str) {
|
||||
let output = Command::new("wasmtime")
|
||||
cmd("wasmtime")
|
||||
.arg("run")
|
||||
.arg("--preload=host=host.wat")
|
||||
.arg("--invoke")
|
||||
.arg(method)
|
||||
.arg(file)
|
||||
.output()
|
||||
.unwrap();
|
||||
assert!(output.status.success());
|
||||
assert_eq!(expected_output, String::from_utf8_lossy(&output.stdout));
|
||||
.run()
|
||||
.assert_stdout_equals(expected_output);
|
||||
}
|
||||
|
@ -1,12 +0,0 @@
|
||||
include ../tools.mk
|
||||
|
||||
# only-wasm32-bare
|
||||
|
||||
# Add a few command line args to make exceptions work
|
||||
RUSTC := $(RUSTC) -C llvm-args=-wasm-enable-eh
|
||||
RUSTC := $(RUSTC) -C target-feature=+exception-handling
|
||||
RUSTC := $(RUSTC) -C panic=unwind
|
||||
|
||||
all:
|
||||
$(RUSTC) src/lib.rs --target wasm32-unknown-unknown
|
||||
$(NODE) verify.mjs $(TMPDIR)/lib.wasm
|
18
tests/run-make/wasm-exceptions-nostd/rmake.rs
Normal file
18
tests/run-make/wasm-exceptions-nostd/rmake.rs
Normal file
@ -0,0 +1,18 @@
|
||||
//@ only-wasm32-bare
|
||||
|
||||
use std::path::Path;
|
||||
|
||||
use run_make_support::{cmd, env_var, rustc};
|
||||
|
||||
fn main() {
|
||||
// Add a few command line args to make exceptions work
|
||||
rustc()
|
||||
.input(Path::new("src").join("lib.rs"))
|
||||
.target("wasm32-unknown-unknown")
|
||||
.panic("unwind")
|
||||
.arg("-Cllvm-args=-wasm-enable-eh")
|
||||
.arg("-Ctarget-feature=+exception-handling")
|
||||
.run();
|
||||
|
||||
cmd(&env_var("NODE")).arg("verify.mjs").arg("lib.wasm").run();
|
||||
}
|
@ -17,8 +17,8 @@ fn panic_handler(info: &core::panic::PanicInfo<'_>) -> ! {
|
||||
use alloc::boxed::Box;
|
||||
use alloc::string::ToString;
|
||||
|
||||
let msg = info.message().map(|msg| msg.to_string()).unwrap_or("(no message)".to_string());
|
||||
let exception = Box::new(msg.to_string());
|
||||
let msg = info.message().to_string();
|
||||
let exception = Box::new(msg);
|
||||
unsafe {
|
||||
let exception_raw = Box::into_raw(exception);
|
||||
wasm_throw(exception_raw as *mut u8);
|
||||
|
@ -1,16 +0,0 @@
|
||||
# needs-force-clang-based-tests
|
||||
|
||||
# FIXME(#126180): This test doesn't actually run anywhere, because the only
|
||||
# CI job that sets RUSTBUILD_FORCE_CLANG_BASED_TESTS runs very few tests.
|
||||
|
||||
include ../tools.mk
|
||||
|
||||
ifeq ($(TARGET),wasm32-unknown-unknown)
|
||||
all:
|
||||
$(RUSTC) foo.rs --crate-type cdylib --target $(TARGET) -C linker=$(CLANG)
|
||||
else ifeq ($(TARGET),wasm64-unknown-unknown)
|
||||
all:
|
||||
$(RUSTC) foo.rs --crate-type cdylib --target $(TARGET) -C linker=$(CLANG)
|
||||
else
|
||||
all:
|
||||
endif
|
17
tests/run-make/wasm-override-linker/rmake.rs
Normal file
17
tests/run-make/wasm-override-linker/rmake.rs
Normal file
@ -0,0 +1,17 @@
|
||||
// How to run this
|
||||
// $ RUSTBUILD_FORCE_CLANG_BASED_TESTS=1 ./x.py test tests/run-make/wasm-override-linker/
|
||||
|
||||
//@ needs-force-clang-based-tests
|
||||
|
||||
use run_make_support::{env_var, rustc, target};
|
||||
|
||||
fn main() {
|
||||
if matches!(target().as_str(), "wasm32-unknown-unknown" | "wasm64-unknown-unknown") {
|
||||
rustc()
|
||||
.input("foo.rs")
|
||||
.crate_type("cdylib")
|
||||
.target(&target())
|
||||
.linker(&env_var("CLANG"))
|
||||
.run();
|
||||
}
|
||||
}
|
@ -1,15 +0,0 @@
|
||||
include ../tools.mk
|
||||
|
||||
all:
|
||||
cp foo.rs $(TMPDIR)/.foo.rs
|
||||
$(RUSTC) $(TMPDIR)/.foo.rs 2>&1 \
|
||||
| $(CGREP) -e "invalid character.*in crate name:"
|
||||
cp foo.rs $(TMPDIR)/.foo.bar
|
||||
$(RUSTC) $(TMPDIR)/.foo.bar 2>&1 \
|
||||
| $(CGREP) -e "invalid character.*in crate name:"
|
||||
cp foo.rs $(TMPDIR)/+foo+bar.rs
|
||||
$(RUSTC) $(TMPDIR)/+foo+bar.rs 2>&1 \
|
||||
| $(CGREP) -e "invalid character.*in crate name:"
|
||||
cp foo.rs $(TMPDIR)/-foo.rs
|
||||
$(RUSTC) $(TMPDIR)/-foo.rs 2>&1 \
|
||||
| $(CGREP) 'crate names cannot start with a `-`'
|
19
tests/run-make/weird-output-filenames/rmake.rs
Normal file
19
tests/run-make/weird-output-filenames/rmake.rs
Normal file
@ -0,0 +1,19 @@
|
||||
use run_make_support::fs_wrapper::copy;
|
||||
use run_make_support::regex::Regex;
|
||||
use run_make_support::{cwd, rustc};
|
||||
|
||||
fn main() {
|
||||
let invalid_characters = [".foo.rs", ".foo.bar", "+foo+bar.rs"];
|
||||
let re = Regex::new(r"invalid character.*in crate name:").unwrap();
|
||||
for f in invalid_characters {
|
||||
copy("foo.rs", f);
|
||||
let stderr = rustc().input(f).run_fail().stderr_utf8();
|
||||
assert!(re.is_match(&stderr));
|
||||
}
|
||||
|
||||
copy("foo.rs", "-foo.rs");
|
||||
rustc()
|
||||
.input(cwd().join("-foo.rs"))
|
||||
.run_fail()
|
||||
.assert_stderr_contains("crate names cannot start with a `-`");
|
||||
}
|
Loading…
Reference in New Issue
Block a user