mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-26 13:29:12 +00:00
make test_gen build windows-proof
This commit is contained in:
parent
f282641a0b
commit
a345649856
1 changed files with 23 additions and 11 deletions
|
@ -17,6 +17,14 @@ fn main() {
|
|||
}
|
||||
}
|
||||
|
||||
const fn object_file_extension() -> &'static str {
|
||||
if cfg!(windows) {
|
||||
"obj"
|
||||
} else {
|
||||
"o"
|
||||
}
|
||||
}
|
||||
|
||||
fn build_wasm_linking_test_host() {
|
||||
let host_source_path = PathBuf::from("src")
|
||||
.join("helpers")
|
||||
|
@ -53,15 +61,8 @@ fn build_wasm_linking_test_host() {
|
|||
&format!("-femit-bin={}", host_wasm),
|
||||
]);
|
||||
|
||||
let host_obj_path = PathBuf::from("build").join("wasm_linking_test_host.o");
|
||||
let host_obj = host_obj_path.to_str().unwrap();
|
||||
run_zig(&[
|
||||
"build-obj",
|
||||
host_source,
|
||||
&format!("-femit-bin={}", &host_obj),
|
||||
]);
|
||||
|
||||
let import_obj_path = PathBuf::from("build").join("wasm_linking_host_imports.o");
|
||||
let mut import_obj_path = PathBuf::from("build").join("wasm_linking_host_imports");
|
||||
import_obj_path.set_extension(object_file_extension());
|
||||
let import_obj = import_obj_path.to_str().unwrap();
|
||||
run_zig(&[
|
||||
"build-obj",
|
||||
|
@ -71,9 +72,15 @@ fn build_wasm_linking_test_host() {
|
|||
|
||||
run_zig(&[
|
||||
"build-exe",
|
||||
host_obj,
|
||||
host_source,
|
||||
import_obj,
|
||||
&format!("-femit-bin={}", host_native),
|
||||
#[cfg(windows)]
|
||||
"--subsystem",
|
||||
#[cfg(windows)]
|
||||
"console",
|
||||
#[cfg(windows)]
|
||||
"-lc",
|
||||
]);
|
||||
}
|
||||
|
||||
|
@ -143,7 +150,12 @@ fn run_zig(args: &[&str]) {
|
|||
println!("{} {}", zig, args.join(" "));
|
||||
let output = Command::new(&zig).args(args).output().unwrap();
|
||||
|
||||
assert!(output.status.success(), "{:#?}", output);
|
||||
if !output.status.success() {
|
||||
eprintln!("stdout:\n{}", String::from_utf8_lossy(&output.stdout));
|
||||
eprintln!("stderr:\n{}", String::from_utf8_lossy(&output.stderr));
|
||||
panic!("zig call failed with status {:?}", output.status);
|
||||
}
|
||||
|
||||
assert!(output.stdout.is_empty(), "{:#?}", output);
|
||||
assert!(output.stderr.is_empty(), "{:#?}", output);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue