Skip to content

Commit

Permalink
Merge branch 'feature/vm_refactor' into fix/vm_refactor_esmcripten_in…
Browse files Browse the repository at this point in the history
…tegration
  • Loading branch information
bjfish committed Jan 18, 2019
2 parents 456a76a + a5d03ff commit 321abe6
Show file tree
Hide file tree
Showing 17 changed files with 359 additions and 63 deletions.
151 changes: 151 additions & 0 deletions .appveyor.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,151 @@
# This appveyor build file is heavily inspired by uutils/coreutils
# https://raw.githubusercontent.com/uutils/coreutils/d0db7bbaa46dabf65b71e3e33b1ed7595aaacc56/.appveyor.yml

branches:
except:
- master

version: "{build} ~ {branch}"

os: Visual Studio 2017

matrix:
allow_failures:
- CHANNEL: nightly
# - ABI: gnu

environment:
matrix:
# minimum version
# - CHANNEL: 1.31.0
# ARCH: i686
# ABI: msvc
# # "msvc" ABI
# - CHANNEL: stable
# ARCH: i686
# ABI: msvc
# - CHANNEL: stable
# ARCH: x86_64
# ABI: msvc
# - CHANNEL: beta
# ARCH: i686
# ABI: msvc
# - CHANNEL: beta
# ARCH: x86_64
# ABI: msvc
# - CHANNEL: nightly
# ARCH: i686
# ABI: msvc
# - CHANNEL: nightly
# ARCH: x86_64
# ABI: msvc
# # "gnu" ABI
# - CHANNEL: stable
# ARCH: i686
# ABI: gnu
# - CHANNEL: stable
# ARCH: x86_64
# ABI: gnu
# - CHANNEL: beta
# ARCH: i686
# ABI: gnu
# - CHANNEL: beta
# ARCH: x86_64
# ABI: gnu
# - CHANNEL: nightly
# ARCH: i686
# ABI: gnu
# - CHANNEL: nightly
# ARCH: x86_64
# ABI: gnu
# * specific gnu compilers
# - CHANNEL: stable
# ARCH: i686
# ABI: gnu
# MINGW_URL: https://sourceforge.net/projects/mingw-w64/files/Toolchains%20targetting%20Win32/Personal%20Builds/mingw-builds/4.9.2/threads-win32/dwarf/i686-4.9.2-release-win32-dwarf-rt_v4-rev4.7z/download
# MINGW_ARCHIVE: i686-4.9.2-release-win32-dwarf-rt_v4-rev4.7z
- CHANNEL: stable
ARCH: x86_64
ABI: gnu
MINGW_URL: https://sourceforge.net/projects/mingw-w64/files/Toolchains%20targetting%20Win64/Personal%20Builds/mingw-builds/7.3.0/threads-posix/seh/x86_64-7.3.0-release-posix-seh-rt_v5-rev0.7z/download#mingw-w64-x86_64-7.3.0-posix-seh.7z

install:
- echo %PATH%
# force branch checkout (if knowable), then reset to the specific commit ## (can be needed for accurate code coverage info)
# * this allows later apps to see the branch name using standard `git branch` operations, yet always builds the correct specific commit
# * ref: <https://github.com/appveyor/ci/issues/1606>[`@`](https://archive.is/RVpnF)
- if DEFINED APPVEYOR_REPO_BRANCH if /I "%APPVEYOR_REPO_SCM%"=="git" ( git checkout "%APPVEYOR_REPO_BRANCH%" & git reset --hard "%APPVEYOR_REPO_COMMIT%" )
# ensure CWD is project main directory
- cd "%APPVEYOR_BUILD_FOLDER%"
# create a working area
- ps: if ( ! $env:CI_TEMP_DIR ) { $env:CI_TEMP_DIR = "${env:TEMP}\${env:APPVEYOR_JOB_ID}" ; mkdir -force $env:CI_TEMP_DIR | out-null }

# rust installation
- set "TARGET=%ARCH%-pc-windows-%ABI%"
# * install `rust` via `rustup`
- appveyor DownloadFile "https://win.rustup.rs/" -FileName "%CI_TEMP_DIR%\rustup-init.exe"
- call "%CI_TEMP_DIR%\rustup-init.exe" -y --default-toolchain %CHANNEL% --default-host %TARGET% --no-modify-path >NUL
- set "PATH=%PATH%;%USERPROFILE%\.cargo\bin"
- ps: $env:TOOLCHAIN = $(rustup show active-toolchain)
- rename "C:\Program Files\Git\usr\bin\sh.exe" sh2.exe
# * set RUST_BACKTRACE for enhanced error messages
- set RUST_BACKTRACE=1
# * show versions
- rustc -vV
- cargo -vV

# finalize FEATURES
- if /i "%CHANNEL%"=="nightly" set "FEATURES=nightly"

# "gnu" ABI setup
# * use the system MinGW/MSYS if we can
- if /i "%ABI%"=="gnu" set MSYS_BINDIR=C:\msys64\usr\bin
- if /i "%ABI%"=="gnu" if /i "%ARCH%"=="i686" set "MSYS_BITS=32"
- if /i "%ABI%"=="gnu" if /i "%ARCH%"=="x86_64" set "MSYS_BITS=64"
- if defined MSYS_BITS set "MSYS_MINGWDIR=C:\msys64\mingw%MSYS_BITS%"
- if defined MSYS_MINGWDIR set "MSYS_BINDIR=C:\msys64\usr\bin"
## * workaround for rust-lang/rust#47048 / rust-lang/rust#53454 ## !maint: remove when resolved
- if /i "%ABI%"=="gnu" if /i "%ARCH%"=="i686" if not DEFINED MINGW_URL set "MINGW_URL=https://downloads.sourceforge.net/project/mingw-w64/Toolchains targetting Win32/Personal Builds/mingw-builds/8.1.0/threads-posix/dwarf/i686-8.1.0-release-posix-dwarf-rt_v6-rev0.7z"
- if /i "%ABI%"=="gnu" if /i "%ARCH%"=="x86_64" if not DEFINED MINGW_URL set "MINGW_URL=https://downloads.sourceforge.net/project/mingw-w64/Toolchains targetting Win64/Personal Builds/mingw-builds/8.1.0/threads-posix/seh/x86_64-8.1.0-release-posix-seh-rt_v6-rev0.7z"
##
# * specific MinGW, if specified
- ps: if ( ! $env:MINGW_ARCHIVE -and $env:MINGW_URL ) { $env:MINGW_ARCHIVE = $($([URI]$env:MINGW_URL).fragment).TrimStart('#') }
- ps: if ( ! $env:MINGW_ARCHIVE -and $env:MINGW_URL ) { $env:MINGW_ARCHIVE = $([URI]$env:MINGW_URL).segments[-1] }
- if defined MINGW_ARCHIVE curl --insecure -fsSL "%MINGW_URL%" -o "%CI_TEMP_DIR%\%MINGW_ARCHIVE%"
- if defined MINGW_ARCHIVE mkdir "%CI_TEMP_DIR%\MinGW" >NUL
- if defined MINGW_ARCHIVE 7z x -y "%CI_TEMP_DIR%\%MINGW_ARCHIVE%" -o"%CI_TEMP_DIR%\MinGW" >NUL
- if defined MINGW_ARCHIVE set "MSYS_MINGWDIR=%CI_TEMP_DIR%\MinGW\mingw%MSYS_BITS%"
- if defined MINGW_ARCHIVE set "MSYS_BINDIR=%MSYS_MINGWDIR%\bin"
# * MinGW/MSYS PATH setup
- if defined MSYS_MINGWDIR set PATH=%MSYS_MINGWDIR%\%ARCH%-w64-mingw32\bin;%MSYS_BINDIR%;%PATH%
## * workaround for rust-lang/rust#47048 / rust-lang/rust#53454 ## !maint: remove when resolved
# ** ref: <https://github.com/rust-lang/rust/issues/47048>, <https://github.com/rust-lang/rust/issues/53454>
# ** egs: <https://github.com/pkgw/tectonic/commit/29686db533d8732d7d97fc94270ed33b77f29295>, <https://github.com/rukai/PF_Sandbox/blob/e842613cf9ff102dfb3fbd87381319e6e6dfe3ae/appveyor.yml>
- if /i "%ABI%"=="gnu" rustup install %CHANNEL%-%ARCH%-pc-windows-msvc
- if /i "%ABI%"=="gnu" rustup default %CHANNEL%-%ARCH%-pc-windows-msvc
- if /i "%ABI%"=="gnu" rustup target add %TARGET%
- if /i "%ABI%"=="gnu" rustup show
- if /i "%ABI%"=="gnu" rustc -vV
- ps: $env:TOOLCHAIN = $(rustup show active-toolchain)
# ** copy libs from gcc toolchain to rust toolchain (more specifically, "crt2.o" and "dllcrt2.o" are needed)
- if defined MSYS_MINGWDIR copy /y "%MSYS_MINGWDIR%\%ARCH%-w64-mingw32\lib\*.o" "%USERPROFILE%\.rustup\toolchains\%TOOLCHAIN%\lib\rustlib\%TARGET%\lib" >NUL
##
- if /i "%ABI%"=="gnu" where gcc
- if /i "%ABI%"=="gnu" gcc --version

# "msvc" ABI setup
- if /i "%ABI%" == "msvc" if /i "%ARCH%" == "i686" call "%VS140COMNTOOLS%\..\..\VC\vcvarsall.bat"
- if /i "%ABI%" == "msvc" if /i "%ARCH%" == "x86_64" call "C:\Program Files\Microsoft SDKs\Windows\v7.1\Bin\SetEnv.cmd" /x64
- if /i "%ABI%" == "msvc" if /i "%ARCH%" == "x86_64" call "%VS140COMNTOOLS%\..\..\VC\vcvarsall.bat" x86_amd64

artifacts:
- path: target\%TARGET%\debug\wasmer.exe
name: wasmer.exe

build_script:
- set BUILD_CMD=cargo +%TOOLCHAIN% build --target=%TARGET%
- echo [ %BUILD_CMD% ] & %BUILD_CMD%

test_script:
- set TEST_CMD=cargo +%TOOLCHAIN% test --target=%TARGET% --no-fail-fast
- echo [ %TEST_CMD% ] & %TEST_CMD%
6 changes: 6 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,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:
Expand Down
21 changes: 10 additions & 11 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "wasmer"
version = "0.1.4"
authors = ["Syrus Akbary <[email protected]>"]
authors = ["The Wasmer Engineering Team <[email protected]>"]
edition = "2018"
repository = "https://github.com/wasmerio/wasmer"
publish = true
Expand Down
12 changes: 12 additions & 0 deletions integration_tests/nginx/README.md
Original file line number Diff line number Diff line change
@@ -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
```
1 change: 1 addition & 0 deletions integration_tests/nginx/html/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
wasmer
1 change: 1 addition & 0 deletions integration_tests/nginx/logs/nginx.pid
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
26310
24 changes: 24 additions & 0 deletions integration_tests/nginx/nginx.conf
Original file line number Diff line number Diff line change
@@ -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;
}
}
}
24 changes: 24 additions & 0 deletions integration_tests/nginx/test.sh
Original file line number Diff line number Diff line change
@@ -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
8 changes: 2 additions & 6 deletions lib/clif-backend/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
[package]
name = "wasmer-clif-backend"
version = "0.1.4"
authors = [
"Lachlan Sneff <[email protected]>",
"Steve Akinyemi <[email protected]>",
"Syrus Akbary <[email protected]>"
]
version = "0.1.0"
authors = ["The Wasmer Engineering Team <[email protected]>"]
edition = "2018"

[dependencies]
Expand Down
10 changes: 2 additions & 8 deletions lib/emscripten/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,13 +1,7 @@
[package]
name = "wasmer-emscripten"
version = "0.1.4"
authors = [
"Lachlan Sneff <[email protected]>",
"Steve Akinyemi <[email protected]>",
"Mackenzie Clark <[email protected]>",
"Brandon Fish <[email protected]>",
"Syrus Akbary <[email protected]>"
]
version = "0.1.1"
authors = ["The Wasmer Engineering Team <[email protected]>"]
edition = "2018"
build = "build/mod.rs"

Expand Down
3 changes: 1 addition & 2 deletions lib/emscripten/emtests/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ This process will do something similar to:
```
# Generate the .wasm file
emcc localtime.c -o localtime.js
# Delte the js file, as we don't need it
# Delete the js file, as we don't need it
rm localtime.js
```

10 changes: 2 additions & 8 deletions lib/runtime/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,13 +1,7 @@
[package]
name = "wasmer-runtime"
version = "0.1.4"
authors = [
"Lachlan Sneff <[email protected]>",
"Steve Akinyemi <[email protected]>",
"Mackenzie Clark <[email protected]>",
"Brandon Fish <[email protected]>",
"Syrus Akbary <[email protected]>"
]
version = "0.1.0"
authors = ["The Wasmer Engineering Team <[email protected]>"]
edition = "2018"
build = "build/mod.rs"

Expand Down
1 change: 1 addition & 0 deletions lib/runtime/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ pub mod vm;
#[doc(hidden)]
pub mod vmcalls;

pub use self::import::Imports;
pub use self::instance::Instance;
#[doc(inline)]
pub use self::module::Module;
Expand Down
Loading

0 comments on commit 321abe6

Please sign in to comment.