More infrastructure.
Improve handling of memory.grow/size, add a standalone wast runner, test harness improvements.
This commit is contained in:
@@ -29,10 +29,14 @@ fn main() {
|
||||
writeln!(
|
||||
out,
|
||||
"fn {}() {{",
|
||||
path.file_stem()
|
||||
.expect("file_stem")
|
||||
.to_str()
|
||||
.expect("to_str")
|
||||
avoid_keywords(
|
||||
&path
|
||||
.file_stem()
|
||||
.expect("file_stem")
|
||||
.to_str()
|
||||
.expect("to_str")
|
||||
.replace("-", "_")
|
||||
)
|
||||
);
|
||||
writeln!(
|
||||
out,
|
||||
@@ -44,3 +48,14 @@ fn main() {
|
||||
writeln!(out);
|
||||
}
|
||||
}
|
||||
|
||||
fn avoid_keywords(name: &str) -> &str {
|
||||
match name {
|
||||
"if" => "if_",
|
||||
"loop" => "loop_",
|
||||
"type" => "type_",
|
||||
"const" => "const_",
|
||||
"return" => "return_",
|
||||
other => other,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -155,6 +155,72 @@ pub fn wast_buffer(name: &str, isa: &isa::TargetIsa, wast: &[u8]) {
|
||||
}
|
||||
}
|
||||
}
|
||||
CommandKind::AssertReturnCanonicalNan { action } => {
|
||||
match instances.perform_action(&*isa, action) {
|
||||
InvokeOutcome::Returned { values } => {
|
||||
for v in values.iter() {
|
||||
match v {
|
||||
Value::I32(_) | Value::I64(_) => {
|
||||
panic!("unexpected integer type in NaN test");
|
||||
}
|
||||
Value::F32(x) => assert_eq!(
|
||||
x & 0x7fffffff,
|
||||
0x7fc00000,
|
||||
"expected canonical NaN at {}:{}",
|
||||
name,
|
||||
line
|
||||
),
|
||||
Value::F64(x) => assert_eq!(
|
||||
x & 0x7fffffffffffffff,
|
||||
0x7ff8000000000000,
|
||||
"expected canonical NaN at {}:{}",
|
||||
name,
|
||||
line
|
||||
),
|
||||
};
|
||||
}
|
||||
}
|
||||
InvokeOutcome::Trapped { message } => {
|
||||
panic!(
|
||||
"{}:{}: expected canonical NaN return, but a trap occurred: {}",
|
||||
name, line, message
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
CommandKind::AssertReturnArithmeticNan { action } => {
|
||||
match instances.perform_action(&*isa, action) {
|
||||
InvokeOutcome::Returned { values } => {
|
||||
for v in values.iter() {
|
||||
match v {
|
||||
Value::I32(_) | Value::I64(_) => {
|
||||
panic!("unexpected integer type in NaN test");
|
||||
}
|
||||
Value::F32(x) => assert_eq!(
|
||||
x & 0x00400000,
|
||||
0x00400000,
|
||||
"expected arithmetic NaN at {}:{}",
|
||||
name,
|
||||
line
|
||||
),
|
||||
Value::F64(x) => assert_eq!(
|
||||
x & 0x0008000000000000,
|
||||
0x0008000000000000,
|
||||
"expected arithmetic NaN at {}:{}",
|
||||
name,
|
||||
line
|
||||
),
|
||||
};
|
||||
}
|
||||
}
|
||||
InvokeOutcome::Trapped { message } => {
|
||||
panic!(
|
||||
"{}:{}: expected canonical NaN return, but a trap occurred: {}",
|
||||
name, line, message
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
command => {
|
||||
println!("{}:{}: TODO: implement {:?}", name, line, command);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user