Use compiletest directives for properly only running wasm32-wasip1 tests on that target

This commit is contained in:
许杰友 Jieyou Xu (Joe) 2024-03-27 21:55:09 +00:00
parent 1dcbc23c4b
commit 08853804d0
No known key found for this signature in database
GPG Key ID: 95DDEBD74A1DC2C0
11 changed files with 15 additions and 44 deletions

View File

@ -1,3 +1,5 @@
//@ only-wasm32-wasip1
extern crate run_make_support;
use run_make_support::{rustc, tmp_dir};
@ -5,10 +7,6 @@ use std::path::Path;
use std::process::Command;
fn main() {
if std::env::var("TARGET").unwrap() != "wasm32-wasip1" {
return;
}
rustc().input("foo.rs").target("wasm32-wasip1").run();
let file = tmp_dir().join("foo.wasm");

View File

@ -1,13 +1,10 @@
//@ only-wasm32-wasip1
extern crate run_make_support;
use run_make_support::{rustc, tmp_dir, wasmparser};
use std::collections::HashMap;
fn main() {
if std::env::var("TARGET").unwrap() != "wasm32-wasip1" {
return;
}
rustc().input("foo.rs").target("wasm32-wasip1").run();
rustc().input("bar.rs").target("wasm32-wasip1").arg("-Clto").opt().run();

View File

@ -1,3 +1,4 @@
//@ only-wasm32-wasip1
extern crate run_make_support;
use run_make_support::{tmp_dir, wasmparser, rustc};
@ -5,10 +6,6 @@ use std::collections::HashMap;
use std::path::Path;
fn main() {
if std::env::var("TARGET").unwrap() != "wasm32-wasip1" {
return;
}
rustc().input("foo.rs").target("wasm32-wasip1").opt().run();
verify(&tmp_dir().join("foo.wasm"));

View File

@ -1,3 +1,5 @@
//@ only-wasm32-wasip1
extern crate run_make_support;
use run_make_support::{tmp_dir, wasmparser, rustc};
@ -6,10 +8,6 @@ use std::path::Path;
use wasmparser::ExternalKind::*;
fn main() {
if std::env::var("TARGET").unwrap() != "wasm32-wasip1" {
return;
}
test(&[]);
test(&["-O"]);
test(&["-Clto"]);

View File

@ -1,3 +1,5 @@
//@ only-wasm32-wasip1
extern crate run_make_support;
use run_make_support::{tmp_dir, wasmparser, rustc};
@ -5,10 +7,6 @@ use std::collections::HashMap;
use wasmparser::TypeRef::Func;
fn main() {
if std::env::var("TARGET").unwrap() != "wasm32-wasip1" {
return;
}
rustc().input("foo.rs").target("wasm32-wasip1").run();
rustc()
.input("bar.rs")

View File

@ -1,3 +1,4 @@
//@ only-wasm32-wasip1
#![deny(warnings)]
extern crate run_make_support;
@ -5,10 +6,6 @@ extern crate run_make_support;
use run_make_support::{rustc, tmp_dir};
fn main() {
if std::env::var("TARGET").unwrap() != "wasm32-wasip1" {
return;
}
test("a");
test("b");
test("c");

View File

@ -1,13 +1,11 @@
//@ only-wasm32-wasip1
extern crate run_make_support;
use run_make_support::{rustc, tmp_dir, wasmparser};
use std::collections::HashMap;
fn main() {
if std::env::var("TARGET").unwrap() != "wasm32-wasip1" {
return;
}
rustc()
.input("main.rs")
.target("wasm32-wasip1")

View File

@ -1,3 +1,4 @@
//@ only-wasm32-wasip1
#![deny(warnings)]
extern crate run_make_support;
@ -5,10 +6,6 @@ extern crate run_make_support;
use run_make_support::{rustc, tmp_dir};
fn main() {
if std::env::var("TARGET").unwrap() != "wasm32-wasip1" {
return;
}
rustc().input("foo.rs").target("wasm32-wasip1").arg("-Clto").opt().run();
let bytes = std::fs::read(&tmp_dir().join("foo.wasm")).unwrap();

View File

@ -1,13 +1,10 @@
//@ only-wasm32-wasip1
extern crate run_make_support;
use run_make_support::{rustc, tmp_dir, wasmparser};
use std::collections::{HashMap, HashSet};
fn main() {
if std::env::var("TARGET").unwrap() != "wasm32-wasip1" {
return;
}
test_file("foo.rs", &[("a", &["foo"]), ("b", &["foo"])]);
test_file("bar.rs", &[("m1", &["f", "g"]), ("m2", &["f"])]);
test_file("baz.rs", &[("sqlite", &["allocate", "deallocate"])]);

View File

@ -1,13 +1,10 @@
//@ only-wasm32-wasip1
extern crate run_make_support;
use run_make_support::{rustc, tmp_dir, wasmparser};
use std::path::Path;
fn main() {
if std::env::var("TARGET").unwrap() != "wasm32-wasip1" {
return;
}
rustc().input("foo.rs").target("wasm32-wasip1").run();
verify_symbols(&tmp_dir().join("foo.wasm"));
rustc().input("foo.rs").target("wasm32-wasip1").opt().run();

View File

@ -1,13 +1,10 @@
//@ only-wasm32-wasip1
extern crate run_make_support;
use run_make_support::{rustc, tmp_dir, wasmparser};
use std::path::Path;
fn main() {
if std::env::var("TARGET").unwrap() != "wasm32-wasip1" {
return;
}
rustc().input("foo.rs").target("wasm32-wasip1").run();
verify_symbols(&tmp_dir().join("foo.wasm"));
rustc().input("foo.rs").target("wasm32-wasip1").arg("-Clto").run();