mirror of
https://github.com/fluencelabs/wasmer
synced 2025-06-24 22:21:32 +00:00
Fix failures on test compilation.
This commit is contained in:
@ -71,13 +71,17 @@ pub fn call_protected(
|
|||||||
TrapCode::HeapOutOfBounds => ExceptionCode::MemoryOutOfBounds,
|
TrapCode::HeapOutOfBounds => ExceptionCode::MemoryOutOfBounds,
|
||||||
TrapCode::TableOutOfBounds => ExceptionCode::CallIndirectOOB,
|
TrapCode::TableOutOfBounds => ExceptionCode::CallIndirectOOB,
|
||||||
TrapCode::UnreachableCodeReached => ExceptionCode::Unreachable,
|
TrapCode::UnreachableCodeReached => ExceptionCode::Unreachable,
|
||||||
_ => ExceptionCode::Unknown,
|
_ => return Err(CallProtError(Box::new("unknown trap code".to_string()))),
|
||||||
},
|
},
|
||||||
EXCEPTION_STACK_OVERFLOW => ExceptionCode::Unknown,
|
EXCEPTION_STACK_OVERFLOW => ExceptionCode::MemoryOutOfBounds,
|
||||||
EXCEPTION_INT_DIVIDE_BY_ZERO | EXCEPTION_INT_OVERFLOW => {
|
EXCEPTION_INT_DIVIDE_BY_ZERO | EXCEPTION_INT_OVERFLOW => {
|
||||||
ExceptionCode::IllegalArithmetic
|
ExceptionCode::IllegalArithmetic
|
||||||
}
|
}
|
||||||
_ => ExceptionCode::Unknown,
|
_ => {
|
||||||
|
return Err(CallProtError(Box::new(
|
||||||
|
"unknown exception code".to_string(),
|
||||||
|
)))
|
||||||
|
}
|
||||||
})))
|
})))
|
||||||
} else {
|
} else {
|
||||||
let signal = match code as DWORD {
|
let signal = match code as DWORD {
|
||||||
|
@ -30,10 +30,8 @@ mod tests {
|
|||||||
match result {
|
match result {
|
||||||
Err(err) => match err {
|
Err(err) => match err {
|
||||||
CallError::Runtime(RuntimeError(e)) => {
|
CallError::Runtime(RuntimeError(e)) => {
|
||||||
let exc_code = e
|
e.downcast::<ExceptionCode>()
|
||||||
.downcast::<ExceptionCode>()
|
|
||||||
.expect("expecting exception code");
|
.expect("expecting exception code");
|
||||||
assert!(exc_code != ExceptionCode::Unknown);
|
|
||||||
}
|
}
|
||||||
_ => unimplemented!(),
|
_ => unimplemented!(),
|
||||||
},
|
},
|
||||||
|
@ -690,7 +690,7 @@ mod tests {
|
|||||||
}
|
}
|
||||||
CallError::Runtime(RuntimeError(e)) => {
|
CallError::Runtime(RuntimeError(e)) => {
|
||||||
use wasmer_runtime::ExceptionCode;
|
use wasmer_runtime::ExceptionCode;
|
||||||
if let Some(_) = data.downcast_ref::<ExceptionCode>() {
|
if let Some(_) = e.downcast_ref::<ExceptionCode>() {
|
||||||
test_report.count_passed();
|
test_report.count_passed();
|
||||||
} else {
|
} else {
|
||||||
test_report.add_failure(
|
test_report.add_failure(
|
||||||
@ -699,8 +699,7 @@ mod tests {
|
|||||||
line,
|
line,
|
||||||
kind: format!("{}", "AssertTrap"),
|
kind: format!("{}", "AssertTrap"),
|
||||||
message: format!(
|
message: format!(
|
||||||
"expected trap, got Runtime:Error {:?}",
|
"expected trap, got RuntimeError"
|
||||||
r
|
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
&test_key,
|
&test_key,
|
||||||
|
Reference in New Issue
Block a user