diff --git a/.circleci/config.yml b/.circleci/config.yml index d22bdf33543..9dd3e8f3502 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -54,6 +54,12 @@ jobs: sudo sysctl -w kern.maxfiles=655360 kern.maxfilesperproc=327680 make test make lint + - run: + name: Execute integration tests + command: | + export PATH="`pwd`/cmake-3.4.1-Darwin-x86_64/CMake.app/Contents/bin:$PATH" + export PATH="$HOME/.cargo/bin:$PATH" + ./integration_tests/nginx/test.sh test-and-build: docker: diff --git a/integration_tests/nginx/README.md b/integration_tests/nginx/README.md new file mode 100644 index 00000000000..9df8af77399 --- /dev/null +++ b/integration_tests/nginx/README.md @@ -0,0 +1,12 @@ +# `nginx` integration test + + +This starts wasmer with the nginx wasm file and serves an html +file with some simple text to assert on. The test script does +the assertion. + +Run test with: + +``` +> ./integration_tests/nginx/test.sh +``` diff --git a/integration_tests/nginx/html/index.html b/integration_tests/nginx/html/index.html new file mode 100644 index 00000000000..02eaa92ed71 --- /dev/null +++ b/integration_tests/nginx/html/index.html @@ -0,0 +1 @@ +wasmer diff --git a/integration_tests/nginx/logs/nginx.pid b/integration_tests/nginx/logs/nginx.pid new file mode 100644 index 00000000000..d4e41cacbb3 --- /dev/null +++ b/integration_tests/nginx/logs/nginx.pid @@ -0,0 +1 @@ +26310 diff --git a/integration_tests/nginx/nginx.conf b/integration_tests/nginx/nginx.conf new file mode 100644 index 00000000000..d44d2569bf4 --- /dev/null +++ b/integration_tests/nginx/nginx.conf @@ -0,0 +1,24 @@ +events { +} + +# We need this for now, as we want to run nginx as a worker +daemon off; +master_process off; + +# We show the errors and info in stderr +error_log /dev/stderr info; + +http { + # We show access in the stdout + access_log /dev/stdout; + server { + listen 8080; + server_name _; + + location / { + # IMPORTANT: Replace the dir with the one you want to serve (that have an index.html file) + root ./html/; + index index.html; + } + } +} diff --git a/integration_tests/nginx/test.sh b/integration_tests/nginx/test.sh new file mode 100755 index 00000000000..55b319da5a3 --- /dev/null +++ b/integration_tests/nginx/test.sh @@ -0,0 +1,24 @@ +#! /bin/bash + +# Build the release and run nginx +make release +nohup ./target/release/wasmer run examples/nginx/nginx.wasm -- -p integration_tests/nginx/ -c nginx.conf & +sleep 3s + +curl localhost:8080 > ./nginx.out + + +if grep "wasmer" ./nginx.out +then + echo "nginx integration test succeeded" + rm ./nohup.out + rm ./nginx.out + rm -rf ./integration_tests/nginx/*_temp + exit 0 +else + echo "nginx integration test failed" + rm ./nohup.out + rm ./nginx.out + rm -rf ./integration_tests/nginx/*_temp + exit -1 +fi