mirror of
https://github.com/fluencelabs/wasmer
synced 2025-06-24 06:01:33 +00:00
add test and fix em tests
This commit is contained in:
0
lib/emscripten/a.txt
Normal file
0
lib/emscripten/a.txt
Normal file
@ -46,6 +46,21 @@ pub fn compile(file: &str, ignores: &Vec<String>) -> Option<String> {
|
||||
output_path.set_extension("js");
|
||||
let output_str = output_path.to_str().unwrap();
|
||||
|
||||
let wasm_file_metadata = {
|
||||
let mut wasm_file_path = PathBuf::from(file);
|
||||
wasm_file_path.set_extension("wasm");
|
||||
if let Ok(wasm_file) = File::open(wasm_file_path) {
|
||||
Some(wasm_file.metadata().unwrap())
|
||||
} else {
|
||||
None
|
||||
}
|
||||
};
|
||||
|
||||
let real_file = File::open(file).unwrap();
|
||||
let file_metadata = real_file.metadata().unwrap();
|
||||
if wasm_file_metadata.is_none()
|
||||
|| file_metadata.modified().unwrap() >= wasm_file_metadata.unwrap().modified().unwrap()
|
||||
{
|
||||
// Compile to wasm
|
||||
let _wasm_compilation = Command::new("emcc")
|
||||
.arg(file)
|
||||
@ -67,6 +82,7 @@ pub fn compile(file: &str, ignores: &Vec<String>) -> Option<String> {
|
||||
} else {
|
||||
println!("Output JS not found: {}", output_str);
|
||||
}
|
||||
}
|
||||
|
||||
let mut output_path = PathBuf::from(file);
|
||||
output_path.set_extension("output");
|
||||
|
4
lib/emscripten/emtests/hello.cpp
vendored
Normal file
4
lib/emscripten/emtests/hello.cpp
vendored
Normal file
@ -0,0 +1,4 @@
|
||||
#include <iostream>
|
||||
int main() {
|
||||
std::cout << "hello world\n";
|
||||
}
|
2
lib/emscripten/emtests/hello.out
vendored
Normal file
2
lib/emscripten/emtests/hello.out
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
hello world
|
||||
|
BIN
lib/emscripten/emtests/hello.wasm
vendored
Normal file
BIN
lib/emscripten/emtests/hello.wasm
vendored
Normal file
Binary file not shown.
43
lib/emscripten/emtests/ignores.txt
vendored
43
lib/emscripten/emtests/ignores.txt
vendored
@ -72,3 +72,46 @@ test_std_cout_new
|
||||
test_strptime_reentrant
|
||||
test_gmtime
|
||||
test_time_c
|
||||
test_execvp
|
||||
test_nl_types
|
||||
test_phiundef
|
||||
test_pipe
|
||||
test_printf_2
|
||||
test_printf_more
|
||||
test_regex
|
||||
test_relocatable_void_function
|
||||
test_rounding
|
||||
test_set_align
|
||||
test_sintvars
|
||||
test_sizeof
|
||||
test_sscanf
|
||||
test_sscanf_3
|
||||
test_sscanf_4
|
||||
test_sscanf_5
|
||||
test_sscanf_6
|
||||
test_sscanf_caps
|
||||
test_sscanf_float
|
||||
test_sscanf_n
|
||||
test_strcasecmp
|
||||
test_strcmp_uni
|
||||
test_strndup
|
||||
test_strstr
|
||||
test_strtod
|
||||
test_strtok
|
||||
test_strtol_bin
|
||||
test_strtol_dec
|
||||
test_strtol_hex
|
||||
test_strtol_oct
|
||||
test_strtoll_bin
|
||||
test_strtoll_dec
|
||||
test_strtoll_hex
|
||||
test_strtoll_oct
|
||||
test_struct_varargs
|
||||
test_transtrcase
|
||||
test_trickystring
|
||||
test_unary_literal
|
||||
test_vfs
|
||||
test_vprintf
|
||||
test_vsnprintf
|
||||
test_write_stdout_fileno
|
||||
test_zerodiv
|
||||
|
0
lib/emscripten/foo.txt
Normal file
0
lib/emscripten/foo.txt
Normal file
@ -176,6 +176,7 @@ mod test_unary_literal;
|
||||
mod test_utf;
|
||||
mod test_varargs;
|
||||
mod test_varargs_multi;
|
||||
mod test_vfs;
|
||||
mod test_vprintf;
|
||||
mod test_vsnprintf;
|
||||
mod test_wprintf;
|
||||
|
@ -1,17 +1,10 @@
|
||||
#[test]
|
||||
fn test_execvp() {
|
||||
#[cfg(not(target_os = "windows"))]
|
||||
#[ignore]
|
||||
fn test_test_execvp() {
|
||||
assert_emscripten_output!(
|
||||
"../../emtests/test_execvp.wasm",
|
||||
"test_execvp",
|
||||
vec![],
|
||||
"../../emtests/test_execvp.out"
|
||||
);
|
||||
#[cfg(target_os = "windows")]
|
||||
assert_emscripten_output!(
|
||||
"../../emtests/test_execvp_windows.wasm",
|
||||
"test_execvp",
|
||||
vec![],
|
||||
"../../emtests/test_execvp.out"
|
||||
);
|
||||
}
|
||||
|
@ -1,8 +1,8 @@
|
||||
#[test]
|
||||
fn test_getcwd() {
|
||||
fn test_test_getcwd() {
|
||||
assert_emscripten_output!(
|
||||
"../../emtests/test_getcwd.wasm",
|
||||
"getcwd",
|
||||
"test_getcwd",
|
||||
vec![],
|
||||
"../../emtests/test_getcwd.out"
|
||||
);
|
||||
|
@ -1,4 +1,5 @@
|
||||
#[test]
|
||||
#[ignore]
|
||||
fn test_test_nl_types() {
|
||||
assert_emscripten_output!(
|
||||
"../../emtests/test_nl_types.wasm",
|
||||
|
@ -1,4 +1,5 @@
|
||||
#[test]
|
||||
#[ignore]
|
||||
fn test_test_phiundef() {
|
||||
assert_emscripten_output!(
|
||||
"../../emtests/test_phiundef.wasm",
|
||||
|
@ -1,8 +1,10 @@
|
||||
use crate::emtests::_common::assert_emscripten_output;
|
||||
|
||||
#[test]
|
||||
fn test_pipe() {
|
||||
let wasm_bytes = include_bytes!("../../emtests/test_pipe.wasm");
|
||||
let expected_str = include_str!("../../emtests/test_pipe.out");
|
||||
assert_emscripten_output(wasm_bytes, expected_str);
|
||||
#[ignore]
|
||||
fn test_test_pipe() {
|
||||
assert_emscripten_output!(
|
||||
"../../emtests/test_pipe.wasm",
|
||||
"test_pipe",
|
||||
vec![],
|
||||
"../../emtests/test_pipe.out"
|
||||
);
|
||||
}
|
||||
|
@ -1,4 +1,5 @@
|
||||
#[test]
|
||||
#[ignore]
|
||||
fn test_test_printf_2() {
|
||||
assert_emscripten_output!(
|
||||
"../../emtests/test_printf_2.wasm",
|
||||
|
@ -1,4 +1,5 @@
|
||||
#[test]
|
||||
#[ignore]
|
||||
fn test_test_printf_more() {
|
||||
assert_emscripten_output!(
|
||||
"../../emtests/test_printf_more.wasm",
|
||||
|
@ -1,4 +1,5 @@
|
||||
#[test]
|
||||
#[ignore]
|
||||
fn test_test_regex() {
|
||||
assert_emscripten_output!(
|
||||
"../../emtests/test_regex.wasm",
|
||||
|
@ -1,4 +1,5 @@
|
||||
#[test]
|
||||
#[ignore]
|
||||
fn test_test_relocatable_void_function() {
|
||||
assert_emscripten_output!(
|
||||
"../../emtests/test_relocatable_void_function.wasm",
|
||||
|
@ -1,4 +1,5 @@
|
||||
#[test]
|
||||
#[ignore]
|
||||
fn test_test_rounding() {
|
||||
assert_emscripten_output!(
|
||||
"../../emtests/test_rounding.wasm",
|
||||
|
@ -1,4 +1,5 @@
|
||||
#[test]
|
||||
#[ignore]
|
||||
fn test_test_set_align() {
|
||||
assert_emscripten_output!(
|
||||
"../../emtests/test_set_align.wasm",
|
||||
|
@ -1,4 +1,5 @@
|
||||
#[test]
|
||||
#[ignore]
|
||||
fn test_test_sintvars() {
|
||||
assert_emscripten_output!(
|
||||
"../../emtests/test_sintvars.wasm",
|
||||
|
@ -1,4 +1,5 @@
|
||||
#[test]
|
||||
#[ignore]
|
||||
fn test_test_sizeof() {
|
||||
assert_emscripten_output!(
|
||||
"../../emtests/test_sizeof.wasm",
|
||||
|
@ -1,4 +1,5 @@
|
||||
#[test]
|
||||
#[ignore]
|
||||
fn test_test_sscanf() {
|
||||
assert_emscripten_output!(
|
||||
"../../emtests/test_sscanf.wasm",
|
||||
|
@ -1,4 +1,5 @@
|
||||
#[test]
|
||||
#[ignore]
|
||||
fn test_test_sscanf_3() {
|
||||
assert_emscripten_output!(
|
||||
"../../emtests/test_sscanf_3.wasm",
|
||||
|
@ -1,4 +1,5 @@
|
||||
#[test]
|
||||
#[ignore]
|
||||
fn test_test_sscanf_4() {
|
||||
assert_emscripten_output!(
|
||||
"../../emtests/test_sscanf_4.wasm",
|
||||
|
@ -1,4 +1,5 @@
|
||||
#[test]
|
||||
#[ignore]
|
||||
fn test_test_sscanf_5() {
|
||||
assert_emscripten_output!(
|
||||
"../../emtests/test_sscanf_5.wasm",
|
||||
|
@ -1,4 +1,5 @@
|
||||
#[test]
|
||||
#[ignore]
|
||||
fn test_test_sscanf_6() {
|
||||
assert_emscripten_output!(
|
||||
"../../emtests/test_sscanf_6.wasm",
|
||||
|
@ -1,4 +1,5 @@
|
||||
#[test]
|
||||
#[ignore]
|
||||
fn test_test_sscanf_caps() {
|
||||
assert_emscripten_output!(
|
||||
"../../emtests/test_sscanf_caps.wasm",
|
||||
|
@ -1,4 +1,5 @@
|
||||
#[test]
|
||||
#[ignore]
|
||||
fn test_test_sscanf_float() {
|
||||
assert_emscripten_output!(
|
||||
"../../emtests/test_sscanf_float.wasm",
|
||||
|
@ -1,4 +1,5 @@
|
||||
#[test]
|
||||
#[ignore]
|
||||
fn test_test_sscanf_n() {
|
||||
assert_emscripten_output!(
|
||||
"../../emtests/test_sscanf_n.wasm",
|
||||
|
@ -1,4 +1,5 @@
|
||||
#[test]
|
||||
#[ignore]
|
||||
fn test_test_strcasecmp() {
|
||||
assert_emscripten_output!(
|
||||
"../../emtests/test_strcasecmp.wasm",
|
||||
|
@ -1,4 +1,5 @@
|
||||
#[test]
|
||||
#[ignore]
|
||||
fn test_test_strcmp_uni() {
|
||||
assert_emscripten_output!(
|
||||
"../../emtests/test_strcmp_uni.wasm",
|
||||
|
@ -1,4 +1,5 @@
|
||||
#[test]
|
||||
#[ignore]
|
||||
fn test_test_strndup() {
|
||||
assert_emscripten_output!(
|
||||
"../../emtests/test_strndup.wasm",
|
||||
|
@ -1,4 +1,5 @@
|
||||
#[test]
|
||||
#[ignore]
|
||||
fn test_test_strstr() {
|
||||
assert_emscripten_output!(
|
||||
"../../emtests/test_strstr.wasm",
|
||||
|
@ -1,4 +1,5 @@
|
||||
#[test]
|
||||
#[ignore]
|
||||
fn test_test_strtod() {
|
||||
assert_emscripten_output!(
|
||||
"../../emtests/test_strtod.wasm",
|
||||
|
@ -1,4 +1,5 @@
|
||||
#[test]
|
||||
#[ignore]
|
||||
fn test_test_strtok() {
|
||||
assert_emscripten_output!(
|
||||
"../../emtests/test_strtok.wasm",
|
||||
|
@ -1,4 +1,5 @@
|
||||
#[test]
|
||||
#[ignore]
|
||||
fn test_test_strtol_bin() {
|
||||
assert_emscripten_output!(
|
||||
"../../emtests/test_strtol_bin.wasm",
|
||||
|
@ -1,4 +1,5 @@
|
||||
#[test]
|
||||
#[ignore]
|
||||
fn test_test_strtol_dec() {
|
||||
assert_emscripten_output!(
|
||||
"../../emtests/test_strtol_dec.wasm",
|
||||
|
@ -1,4 +1,5 @@
|
||||
#[test]
|
||||
#[ignore]
|
||||
fn test_test_strtol_hex() {
|
||||
assert_emscripten_output!(
|
||||
"../../emtests/test_strtol_hex.wasm",
|
||||
|
@ -1,4 +1,5 @@
|
||||
#[test]
|
||||
#[ignore]
|
||||
fn test_test_strtol_oct() {
|
||||
assert_emscripten_output!(
|
||||
"../../emtests/test_strtol_oct.wasm",
|
||||
|
@ -1,4 +1,5 @@
|
||||
#[test]
|
||||
#[ignore]
|
||||
fn test_test_strtoll_bin() {
|
||||
assert_emscripten_output!(
|
||||
"../../emtests/test_strtoll_bin.wasm",
|
||||
|
@ -1,4 +1,5 @@
|
||||
#[test]
|
||||
#[ignore]
|
||||
fn test_test_strtoll_dec() {
|
||||
assert_emscripten_output!(
|
||||
"../../emtests/test_strtoll_dec.wasm",
|
||||
|
@ -1,4 +1,5 @@
|
||||
#[test]
|
||||
#[ignore]
|
||||
fn test_test_strtoll_hex() {
|
||||
assert_emscripten_output!(
|
||||
"../../emtests/test_strtoll_hex.wasm",
|
||||
|
@ -1,4 +1,5 @@
|
||||
#[test]
|
||||
#[ignore]
|
||||
fn test_test_strtoll_oct() {
|
||||
assert_emscripten_output!(
|
||||
"../../emtests/test_strtoll_oct.wasm",
|
||||
|
@ -1,4 +1,5 @@
|
||||
#[test]
|
||||
#[ignore]
|
||||
fn test_test_struct_varargs() {
|
||||
assert_emscripten_output!(
|
||||
"../../emtests/test_struct_varargs.wasm",
|
||||
|
@ -1,4 +1,5 @@
|
||||
#[test]
|
||||
#[ignore]
|
||||
fn test_test_transtrcase() {
|
||||
assert_emscripten_output!(
|
||||
"../../emtests/test_transtrcase.wasm",
|
||||
|
@ -1,4 +1,5 @@
|
||||
#[test]
|
||||
#[ignore]
|
||||
fn test_test_trickystring() {
|
||||
assert_emscripten_output!(
|
||||
"../../emtests/test_trickystring.wasm",
|
||||
|
@ -1,4 +1,5 @@
|
||||
#[test]
|
||||
#[ignore]
|
||||
fn test_test_unary_literal() {
|
||||
assert_emscripten_output!(
|
||||
"../../emtests/test_unary_literal.wasm",
|
||||
|
@ -1,8 +1,10 @@
|
||||
use crate::emtests::_common::assert_emscripten_output;
|
||||
|
||||
#[test]
|
||||
fn test_vfs() {
|
||||
let wasm_bytes = include_bytes!("../../emtests/test_vfs_bundle.wasm");
|
||||
let expected_str = include_str!("../../emtests/test_vfs.out");
|
||||
assert_emscripten_output(wasm_bytes, expected_str);
|
||||
#[ignore]
|
||||
fn test_test_vfs() {
|
||||
assert_emscripten_output!(
|
||||
"../../emtests/test_vfs.wasm",
|
||||
"test_vfs",
|
||||
vec![],
|
||||
"../../emtests/test_vfs.out"
|
||||
);
|
||||
}
|
||||
|
@ -1,4 +1,5 @@
|
||||
#[test]
|
||||
#[ignore]
|
||||
fn test_test_vprintf() {
|
||||
assert_emscripten_output!(
|
||||
"../../emtests/test_vprintf.wasm",
|
||||
|
@ -1,4 +1,5 @@
|
||||
#[test]
|
||||
#[ignore]
|
||||
fn test_test_vsnprintf() {
|
||||
assert_emscripten_output!(
|
||||
"../../emtests/test_vsnprintf.wasm",
|
||||
|
@ -1,4 +1,5 @@
|
||||
#[test]
|
||||
#[ignore]
|
||||
fn test_test_write_stdout_fileno() {
|
||||
assert_emscripten_output!(
|
||||
"../../emtests/test_write_stdout_fileno.wasm",
|
||||
|
@ -1,4 +1,5 @@
|
||||
#[test]
|
||||
#[ignore]
|
||||
fn test_test_zerodiv() {
|
||||
assert_emscripten_output!(
|
||||
"../../emtests/test_zerodiv.wasm",
|
||||
|
Reference in New Issue
Block a user