about summary refs log tree commit diff
diff options
context:
space:
mode:
authorJoshua Nelson <github@jyn.dev>2023-04-09 09:11:00 -0500
committerjyn <github@jyn.dev>2023-04-13 22:10:26 -0500
commit88ee6e5a6c5fad39494d4f5dcbfe026fa7fac621 (patch)
tree10b8215a12a2dfca9a60ed3292acda829518448a
parent2ffb0de8cfda57cafdfd71a690f14c2e17216d85 (diff)
downloadrust-88ee6e5a6c5fad39494d4f5dcbfe026fa7fac621.tar.gz
rust-88ee6e5a6c5fad39494d4f5dcbfe026fa7fac621.zip
Fix tests on wasm
The `std` test straightforwardly can't work without file descriptors;
 #99417 tracks moving it out of tests/ui.

`issue-13560.rs` requires the target to support dynamic linking.

`extern-mod-syntax` is interesting. The original test was added to check
if `extern mod` could be parsed correctly and used `extern mod std` and
an import:
https://github.com/rust-lang/rust/commit/138dc3048af36f0a20f857542c357fe8df563013#diff-73700e1e851b7a37bc92174635dab726124c82e5bfabbbc45b4a3c2e8e14fadd
At some point `std::json::Object` was moved out of std to an unstable
rustc-only `extras` crate, and rather than just changing the import it
got changed to use the unstable crate. When `extras` was removed, people
assumed the test was meant to also test rustc_private and changed it to
another unstable crate rather than using something in std.

This changes the test to remove the `rustc_private` import, to allow it
to work properly when cross-compiling.
-rw-r--r--tests/ui/extern-mod-syntax.rs8
-rw-r--r--tests/ui/issue-13560.rs1
-rw-r--r--tests/ui/std/switch-stdout.rs1
3 files changed, 6 insertions, 4 deletions
diff --git a/tests/ui/extern-mod-syntax.rs b/tests/ui/extern-mod-syntax.rs
index 230194c5377..65dfa6a0f57 100644
--- a/tests/ui/extern-mod-syntax.rs
+++ b/tests/ui/extern-mod-syntax.rs
@@ -1,11 +1,11 @@
 // run-pass
 
 #![allow(unused_imports)]
-#![feature(rustc_private)]
+#![no_std]
 
-extern crate libc;
-use libc::c_void;
+extern crate std;
+use std::ffi::c_void;
 
 pub fn main() {
-    println!("Hello world!");
+    std::println!("Hello world!");
 }
diff --git a/tests/ui/issue-13560.rs b/tests/ui/issue-13560.rs
index 5f7d647e230..3397202bef2 100644
--- a/tests/ui/issue-13560.rs
+++ b/tests/ui/issue-13560.rs
@@ -1,4 +1,5 @@
 // run-pass
+// ignore-cross-compile (needs dylibs and compiletest doesn't have a more specific header)
 // aux-build:issue-13560-1.rs
 // aux-build:issue-13560-2.rs
 // aux-build:issue-13560-3.rs
diff --git a/tests/ui/std/switch-stdout.rs b/tests/ui/std/switch-stdout.rs
index e9501a80930..2d936d96b05 100644
--- a/tests/ui/std/switch-stdout.rs
+++ b/tests/ui/std/switch-stdout.rs
@@ -1,4 +1,5 @@
 // run-pass
+// ignore-wasm (needs file descriptors and env variables)
 
 use std::env;
 use std::fs::File;