mirror of
https://github.com/mii443/wasmer.git
synced 2025-12-06 12:48:20 +00:00
Fix multi-command-exe test
This commit is contained in:
@@ -223,7 +223,10 @@ pub unsafe extern "C" fn wasm_func_call(
|
|||||||
|
|
||||||
None
|
None
|
||||||
}
|
}
|
||||||
Err(e) => Some(Box::new(e.into())),
|
Err(e) => {
|
||||||
|
println!("error: {e}");
|
||||||
|
Some(Box::new(e.into()))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -234,9 +234,16 @@ int main(int argc, char *argv[]) {
|
|||||||
wasm_val_vec_t results = WASM_EMPTY_VEC;
|
wasm_val_vec_t results = WASM_EMPTY_VEC;
|
||||||
own wasm_trap_t *trap = wasm_func_call(start_function, &args, &results);
|
own wasm_trap_t *trap = wasm_func_call(start_function, &args, &results);
|
||||||
if (trap) {
|
if (trap) {
|
||||||
fprintf(stderr, "Trap is not NULL: TODO:\n");
|
wasm_message_t retrieved_message;
|
||||||
|
// TODO: this is a shitty solution, but it's good enough for now
|
||||||
|
wasm_trap_message(trap, &retrieved_message);
|
||||||
|
if (strcmp(retrieved_message.data, "WASI exited with code: 0") == 0) {
|
||||||
|
wasm_trap_delete(trap);
|
||||||
|
} else {
|
||||||
|
fprintf(stderr, "%s", retrieved_message.data);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// TODO: handle non-WASI start (maybe with invoke?)
|
// TODO: handle non-WASI start (maybe with invoke?)
|
||||||
|
|||||||
@@ -195,7 +195,7 @@ fn create_exe_works_multi_command() -> anyhow::Result<()> {
|
|||||||
.run()
|
.run()
|
||||||
.context("Failed to create-exe wasm with Wasmer")?;
|
.context("Failed to create-exe wasm with Wasmer")?;
|
||||||
|
|
||||||
let _result = run_code(
|
let result = run_code(
|
||||||
&operating_dir,
|
&operating_dir,
|
||||||
&executable_path,
|
&executable_path,
|
||||||
&[
|
&[
|
||||||
@@ -206,6 +206,9 @@ fn create_exe_works_multi_command() -> anyhow::Result<()> {
|
|||||||
)
|
)
|
||||||
.context("Failed to run generated executable")?;
|
.context("Failed to run generated executable")?;
|
||||||
|
|
||||||
|
let result_lines = result.lines().collect::<Vec<&str>>();
|
||||||
|
assert_eq!(result_lines, vec!["1.0.37 (git~v1.0.37)"]);
|
||||||
|
|
||||||
let result = run_code(
|
let result = run_code(
|
||||||
&operating_dir,
|
&operating_dir,
|
||||||
&executable_path,
|
&executable_path,
|
||||||
@@ -218,7 +221,7 @@ fn create_exe_works_multi_command() -> anyhow::Result<()> {
|
|||||||
.context("Failed to run generated executable")?;
|
.context("Failed to run generated executable")?;
|
||||||
|
|
||||||
let result_lines = result.lines().collect::<Vec<&str>>();
|
let result_lines = result.lines().collect::<Vec<&str>>();
|
||||||
assert_eq!(result_lines, vec!["\"Hello, World\""],);
|
assert_eq!(result_lines, vec!["1.0.37 (git~v1.0.37)"]);
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
@@ -395,8 +398,6 @@ fn create_exe_with_object_input(mut args: Vec<String>) -> anyhow::Result<()> {
|
|||||||
|
|
||||||
args.push("--prefix".to_string());
|
args.push("--prefix".to_string());
|
||||||
args.push("abc123".to_string());
|
args.push("abc123".to_string());
|
||||||
args.push("--debug-dir".to_string());
|
|
||||||
args.push("tmp".to_string());
|
|
||||||
|
|
||||||
WasmerCreateObj {
|
WasmerCreateObj {
|
||||||
current_dir: operating_dir.clone(),
|
current_dir: operating_dir.clone(),
|
||||||
|
|||||||
@@ -63,8 +63,6 @@ fn test_cross_compile_python_windows() -> anyhow::Result<()> {
|
|||||||
output.arg(wasi_test_python_path());
|
output.arg(wasi_test_python_path());
|
||||||
output.arg("--target");
|
output.arg("--target");
|
||||||
output.arg(t);
|
output.arg(t);
|
||||||
output.arg("--debug-dir");
|
|
||||||
output.arg(&format!("./{t}-{c}"));
|
|
||||||
output.arg("-o");
|
output.arg("-o");
|
||||||
output.arg(python_wasmer_path.clone());
|
output.arg(python_wasmer_path.clone());
|
||||||
output.arg(format!("--{c}"));
|
output.arg(format!("--{c}"));
|
||||||
|
|||||||
Reference in New Issue
Block a user