diff --git a/.circleci/config.yml b/.circleci/config.yml index 8162eef72..52160f216 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -42,6 +42,7 @@ jobs: command: | sudo apt-get install -y cmake - run: make test + - run: make integration-tests - save_cache: paths: - /usr/local/cargo/registry diff --git a/Makefile b/Makefile index d8e332668..c176dc7d1 100644 --- a/Makefile +++ b/Makefile @@ -23,7 +23,7 @@ install: integration-tests: release echo "Running Integration Tests" - # Commented for now until we fix emscripten + ./integration_tests/lua/test.sh ./integration_tests/nginx/test.sh lint: diff --git a/integration_tests/lua/README.md b/integration_tests/lua/README.md new file mode 100644 index 000000000..ce2b03f6f --- /dev/null +++ b/integration_tests/lua/README.md @@ -0,0 +1,9 @@ +# `lua` integration test + + +This starts wasmer with the lua wasm file. The test asserts on +the output of wasmer. Run test with: + +``` +> ./integration_tests/lua/test.sh +``` diff --git a/integration_tests/lua/test.sh b/integration_tests/lua/test.sh new file mode 100755 index 000000000..b45752f0b --- /dev/null +++ b/integration_tests/lua/test.sh @@ -0,0 +1,15 @@ +#! /bin/bash + +nohup ./target/release/wasmer run examples/lua.wasm & +sleep 3s + +if grep "Lua 5.4.0 Copyright (C) 1994-2018 Lua.org, PUC-Rio" ./nohup.out +then + echo "lua integration test succeeded" + rm ./nohup.out + exit 0 +else + echo "lua integration test failed" + rm ./nohup.out + exit -1 +fi diff --git a/lib/emscripten/src/jmp.rs b/lib/emscripten/src/jmp.rs index b0607c28e..0c63593aa 100644 --- a/lib/emscripten/src/jmp.rs +++ b/lib/emscripten/src/jmp.rs @@ -7,20 +7,19 @@ use wasmer_runtime_core::vm::Ctx; pub fn __setjmp(env_addr: u32, ctx: &mut Ctx) -> c_int { debug!("emscripten::__setjmp (setjmp)"); unsafe { - unimplemented!() - // // Rather than using the env as the holder of the jump buffer pointer, - // // we use the environment address to store the index relative to jumps - // // so the address of the jump it's outside the wasm memory itself. - // let jump_index = ctx.memory(0).as_ptr().add(env_addr as usize) as *mut i8; - // // We create the jump buffer outside of the wasm memory - // let jump_buf: UnsafeCell<[c_int; 27]> = UnsafeCell::new([0; 27]); - // let jumps = &mut get_emscripten_data(ctx).jumps; - // let result = setjmp(jump_buf.get() as _); - // // We set the jump index to be the last value of jumps - // *jump_index = jumps.len() as _; - // // We hold the reference of the jump buffer - // jumps.push(jump_buf); - // result + // Rather than using the env as the holder of the jump buffer pointer, + // we use the environment address to store the index relative to jumps + // so the address of the jump it's outside the wasm memory itself. + let jump_index = emscripten_memory_pointer!(ctx.memory(0), env_addr) as *mut i8; + // We create the jump buffer outside of the wasm memory + let jump_buf: UnsafeCell<[u32; 27]> = UnsafeCell::new([0; 27]); + let jumps = &mut get_emscripten_data(ctx).jumps; + let result = setjmp(jump_buf.get() as _); + // We set the jump index to be the last value of jumps + *jump_index = jumps.len() as _; + // We hold the reference of the jump buffer + jumps.push(jump_buf); + result } }