Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove cmake dependency #1880

Merged
merged 11 commits into from
Dec 5, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .github/workflows/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -218,8 +218,8 @@ jobs:
run: |
ls target/release
alias wasmer=target/release/wasmer
./target/release/wasmer compile --target=x86_64-apple-darwin tests/integration/cli/assets/qjs.wasm -o qjs_mac_from_linux.wjit
#./target/release/wasmer compile --target=x86_64-pc-windows-msvc tests/integration/cli/assets/qjs.wasm -o qjs_win_from_linux.wjit
./target/release/wasmer compile --target=x86_64-apple-darwin lib/c-api/tests/assets/qjs.wasm -o qjs_mac_from_linux.wjit
#./target/release/wasmer compile --target=x86_64-pc-windows-msvc lib/c-api/tests/assets/qjs.wasm -o qjs_win_from_linux.wjit
Comment on lines -221 to +222
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note: this change was done because the tests/integration/cli/assets/qjs.wasm was a symlink.
And once tested, as it was a existing file was quite hard to figure out what was going on.

Much easier to use directly the real files!

mkdir cross
cp qjs_mac_from_linux.wjit cross
#cp qjs_win_from_linux.wjit cross
Expand All @@ -230,8 +230,8 @@ jobs:
run: |
ls target/release
alias wasmer=target/release/wasmer
./target/release/wasmer compile --target=x86_64-unknown-linux-gnu tests/integration/cli/assets/qjs.wasm -o qjs_linux_from_mac.wjit
#./target/release/wasmer compile --target=x86_64-pc-windows-msvc tests/integration/cli/assets/qjs.wasm -o qjs_win_from_mac.wjit
./target/release/wasmer compile --target=x86_64-unknown-linux-gnu lib/c-api/tests/assets/qjs.wasm -o qjs_linux_from_mac.wjit
#./target/release/wasmer compile --target=x86_64-pc-windows-msvc lib/c-api/tests/assets/qjs.wasm -o qjs_win_from_mac.wjit
mkdir cross
cp qjs_linux_from_mac.wjit cross
#cp qjs_win_from_mac.wjit cross
Expand Down
5 changes: 0 additions & 5 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,3 @@ api-docs-repo/
# Generated by tests on Android
/avd
/core
/lib/c-api/examples/exports-function
/lib/c-api/examples/exports-global
/lib/c-api/examples/imports-exports
/lib/c-api/examples/instance
/lib/c-api/examples/memory
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
### Changed

- [#1874](https://github.com/wasmerio/wasmer/pull/1874) Set `CompilerConfig` to be owned (following wasm-c-api)
- [#1880](https://github.com/wasmerio/wasmer/pull/1880) Remove cmake dependency for tests

## 1.0.0-beta1 - 2020-12-01

Expand Down
19 changes: 10 additions & 9 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ ifneq (,$(filter $(ARCH),aarch64 arm64))
ifneq (, $(findstring llvm,$(compilers)))
test_compilers_engines += llvm-native
endif
# if we are in Darwin, we use the system libffi for the capi
# if we are in macos arm64, we use the system libffi for the capi
ifeq ($(UNAME_S), Darwin)
capi_default_features := --features system-libffi
endif
Expand Down Expand Up @@ -224,19 +224,17 @@ test-packages:

# The test-capi rules depend on the build-capi rules to build the .a files to
# link the tests against. cargo test doesn't know that the tests will be running
# cmake + make to build programs whose dependencies cargo isn't aware of.

test-capi: $(foreach compiler_engine,$(test_compilers_engines),test-capi-$(compiler_engine))

test-capi-singlepass-jit: build-capi-singlepass-jit test-capi-examples
test-capi-singlepass-jit: build-capi-singlepass-jit test-capi-tests
cargo test --manifest-path lib/c-api/Cargo.toml --release \
--no-default-features --features deprecated,wat,jit,singlepass,wasi $(capi_default_features) -- --nocapture

test-capi-cranelift-jit: build-capi-cranelift-jit test-capi-examples
test-capi-cranelift-jit: build-capi-cranelift-jit test-capi-tests
cargo test --manifest-path lib/c-api/Cargo.toml --release \
--no-default-features --features deprecated,wat,jit,cranelift,wasi $(capi_default_features) -- --nocapture

test-capi-cranelift-native: build-capi-cranelift-native test-capi-examples
test-capi-cranelift-native: build-capi-cranelift-native test-capi-tests
cargo test --manifest-path lib/c-api/Cargo.toml --release \
--no-default-features --features deprecated,wat,native,cranelift,wasi $(capi_default_features) -- --nocapture

Expand All @@ -248,7 +246,10 @@ test-capi-llvm-native:
cargo test --manifest-path lib/c-api/Cargo.toml --release \
--no-default-features --features deprecated,wat,native,llvm,wasi $(capi_default_features) -- --nocapture

test-capi-examples: package-capi
test-capi-tests: package-capi
# Test the Wasmer C API tests for C
cd lib/c-api/tests; WASMER_DIR=`pwd`/../../../package make test
# Test the Wasmer C API examples
cd lib/c-api/examples; WASMER_DIR=`pwd`/../../../package make run

test-wasi-unit:
Expand Down Expand Up @@ -287,8 +288,6 @@ else
cp target/release/wasmer package/bin/
endif



package-capi:
mkdir -p "package/include"
mkdir -p "package/lib"
Expand All @@ -301,6 +300,8 @@ ifeq ($(OS), Windows_NT)
cp target/release/wasmer_c_api.lib package/lib
else
ifeq ($(UNAME_S), Darwin)
# For some reason in macOS arm64 there are issues if we copy constantly in the install_name_tool util
rm -f package/lib/libwasmer.dylib
cp target/release/libwasmer_c_api.dylib package/lib/libwasmer.dylib
cp target/release/libwasmer_c_api.a package/lib/libwasmer.a
# Fix the rpath for the dylib
Expand Down
8 changes: 8 additions & 0 deletions lib/c-api/examples/.gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,9 @@

*
*.o


# Unignore files ending with `.c` (i.e. `wasm-c-api-wasi.c`)
!*.c
# Unignore Makefile
!Makefile
1 change: 0 additions & 1 deletion lib/c-api/examples/Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

$(info Using provided WASMER_DIR=$(WASMER_DIR))

ifeq (,$(wildcard $(WASMER_DIR)/bin/wasmer))
Expand Down
6 changes: 6 additions & 0 deletions lib/c-api/tests/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# ignore wasm-c-api binaries
wasm-c-api-*
test-*

# Unignore files ending with `.c` (i.e. `wasm-c-api-wasi.c`)
!*.c
75 changes: 75 additions & 0 deletions lib/c-api/tests/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
$(info Using provided WASMER_DIR=$(WASMER_DIR))

ifeq (,$(wildcard $(WASMER_DIR)/bin/wasmer))
CFLAGS = -g -I$(WASMER_DIR)/include
LDFLAGS = -Wl,-rpath,$(WASMER_DIR)/lib
LDLIBS = -L$(WASMER_DIR)/lib -lwasmer
else
CFLAGS = -g -I$(shell $(WASMER_DIR)/bin/wasmer config --includedir)
LDFLAGS = -Wl,-rpath,$(shell $(WASMER_DIR)/bin/wasmer config --libdir)
LDLIBS = $(shell $(WASMER_DIR)/bin/wasmer config --libs)
endif

$(info * CFLAGS: $(CFLAGS))
$(info * LDFLAGS: $(LDFLAGS))
$(info * LDLIBS: $(LDLIBS))

CAPI_WASMER_TESTS = \
test-early-exit test-memory test-wasi \
test-wat2wasm

CAPI_BASE_TESTS = \
wasm-c-api/example/callback wasm-c-api/example/global wasm-c-api/example/hello \
wasm-c-api/example/memory wasm-c-api/example/reflect wasm-c-api/example/serialize \
wasm-c-api/example/start wasm-c-api/example/trap

CAPI_BASE_TESTS_NOT_WORKING = \
wasm-c-api/example/finalize wasm-c-api/example/hostref wasm-c-api/example/multi \
wasm-c-api/example/table wasm-c-api/example/threads

DEPRECATED_TESTS = \
deprecated/test-context deprecated/test-import-object deprecated/test-module-imports \
deprecated/test-import-trap deprecated/test-module-serialize \
deprecated/test-exported-memory deprecated/test-imports deprecated/test-module \
deprecated/test-exports deprecated/test-instantiate deprecated/test-tables \
deprecated/test-globals deprecated/test-memory deprecated/test-validate \
deprecated/test-module-exports deprecated/test-module-import-instantiate

DEPRECATED_NOT_WORKING = test-import-function test-import-function-callinfo test-wasi-import-object test-emscripten-import-object

ALL = $(CAPI_BASE_TESTS) $(CAPI_WASMER_TESTS) $(DEPRECATED_TESTS)

test-%: %.o
deprecated/test-%: deprecated/%.o

.PHONY: all
all: $(ALL)

.PHONY: test-capi-wasmer
.SILENT: test-capi-wasmer
test-capi-wasmer: $(CAPI_WASMER_TESTS)
set -o errexit; \
$(foreach example,$?,echo Running \"$(example)\" example; cd $(shell dirname $(realpath $(example))) && ./$(shell basename $(example)); echo;)

.PHONY: test-capi-base
.SILENT: test-capi-base
test-capi-base: $(CAPI_BASE_TESTS)
set -o errexit; \
$(foreach example,$?,echo Running \"$(example)\" example; cd $(shell dirname $(realpath $(example))) && ./$(shell basename $(example)); echo;)

.PHONY: test-capi-base
.SILENT: test-capi-base
test-capi: test-capi-base test-capi-wasmer

.PHONY: test-deprecated
.SILENT: test-deprecated
test-deprecated: $(DEPRECATED_TESTS)
set -o errexit; \
$(foreach example,$?,echo Running \"$(example)\" example; cd $(shell dirname $(realpath $(example))) && ./$(shell basename $(example)); echo;)

test: test-capi test-deprecated

.SILENT: clean
.PHONY: clean
clean:
$(foreach file,$(ALL),rm -f $(file).o $(file))
32 changes: 0 additions & 32 deletions lib/c-api/tests/deprecated/.gitignore
Original file line number Diff line number Diff line change
@@ -1,35 +1,3 @@
CMakeLists.txt.user
CMakeCache.txt
CMakeFiles
CMakeScripts
Testing
Makefile
cmake_install.cmake
install_manifest.txt
compile_commands.json
CTestTestfile.cmake
_deps
rust-build
test-context
test-exported-memory
test-exports
test-globals
test-import-function
test-import-trap
test-import-object
test-imports
test-instantiate
test-memory
test-module
test-module-exports
test-module-import-instantiate
test-module-imports
test-module-serialize
test-tables
test-validate
test-wasi-import-object
test-emscripten-import-object

# ignore wasm-c-api binaries
wasm-c-api-*
test-*
Expand Down
130 changes: 0 additions & 130 deletions lib/c-api/tests/deprecated/CMakeLists.txt

This file was deleted.

23 changes: 0 additions & 23 deletions lib/c-api/tests/deprecated_tests.rs

This file was deleted.

File renamed without changes.
File renamed without changes.
Loading