Fix multi-command-exe test

This commit is contained in:
Felix Schütt
2022-12-29 17:56:32 +01:00
parent e00aae8f13
commit f3d0902f68
4 changed files with 18 additions and 9 deletions

View File

@@ -223,7 +223,10 @@ pub unsafe extern "C" fn wasm_func_call(
None
}
Err(e) => Some(Box::new(e.into())),
Err(e) => {
println!("error: {e}");
Some(Box::new(e.into()))
}
}
}

View File

@@ -234,8 +234,15 @@ int main(int argc, char *argv[]) {
wasm_val_vec_t results = WASM_EMPTY_VEC;
own wasm_trap_t *trap = wasm_func_call(start_function, &args, &results);
if (trap) {
fprintf(stderr, "Trap is not NULL: TODO:\n");
return -1;
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;
}
}
#endif

View File

@@ -195,7 +195,7 @@ fn create_exe_works_multi_command() -> anyhow::Result<()> {
.run()
.context("Failed to create-exe wasm with Wasmer")?;
let _result = run_code(
let result = run_code(
&operating_dir,
&executable_path,
&[
@@ -206,6 +206,9 @@ fn create_exe_works_multi_command() -> anyhow::Result<()> {
)
.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(
&operating_dir,
&executable_path,
@@ -218,7 +221,7 @@ fn create_exe_works_multi_command() -> anyhow::Result<()> {
.context("Failed to run generated executable")?;
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(())
}
@@ -395,8 +398,6 @@ fn create_exe_with_object_input(mut args: Vec<String>) -> anyhow::Result<()> {
args.push("--prefix".to_string());
args.push("abc123".to_string());
args.push("--debug-dir".to_string());
args.push("tmp".to_string());
WasmerCreateObj {
current_dir: operating_dir.clone(),

View File

@@ -63,8 +63,6 @@ fn test_cross_compile_python_windows() -> anyhow::Result<()> {
output.arg(wasi_test_python_path());
output.arg("--target");
output.arg(t);
output.arg("--debug-dir");
output.arg(&format!("./{t}-{c}"));
output.arg("-o");
output.arg(python_wasmer_path.clone());
output.arg(format!("--{c}"));