Final fixes for make test-capi on windows-msvc

- .wasm files should always be opened in "rb" mode
- open_memstream doesn't exist on Windows, use tempfile() instead
- remove .obj and .exe files when the test finish
This commit is contained in:
Felix Schütt
2022-09-14 22:31:19 +02:00
parent fd390f6160
commit 7441fade9c
8 changed files with 196 additions and 169 deletions

View File

@@ -4,14 +4,26 @@ $(info Using provided WASMER_DIR=$(WASMER_DIR))
ROOT_DIR:=$(shell dirname $(realpath $(firstword $(MAKEFILE_LIST))))
MSVC_CFLAGS:=""
MSVC_LDFLAGS:=""
MSVC_LDLIBS:=""
ifeq (,$(wildcard $(WASMER_DIR)/bin/wasmer))
CFLAGS = -g -I$(ROOT_DIR)/../tests -I$(WASMER_DIR)/include
CFLAGS = -g -I$(ROOT_DIR)/ -I$(WASMER_DIR)/include
LDFLAGS = -Wl,-rpath,$(WASMER_DIR)/lib
LDLIBS = -L$(WASMER_DIR)/lib -lwasmer
MSVC_CFLAGS:= /DEBUG /I $(ROOT_DIR)/ /I $(WASMER_DIR)/include
MSVC_LDFLAGS:= ""
MSVC_LDLIBS:= /LIBPATH:$(WASMER_DIR)/lib wasmer.dll.lib
else
CFLAGS = -g -I$(ROOT_DIR)/../tests -I$(shell $(WASMER_DIR)/bin/wasmer config --includedir)
CFLAGS = -g -I$(ROOT_DIR)/ -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)
MSVC_CFLAGS:= /DEBUG /I $(ROOT_DIR)/ /I $(shell $(WASMER_DIR)/bin/wasmer config --includedir)
MSVC_LDFLAGS:= ""
MSVC_LDLIBS:= /LIBPATH:$(shell $(WASMER_DIR)/bin/wasmer config --libs) wasmer.dll.lib
endif
$(info * CFLAGS: $(CFLAGS))
@@ -20,44 +32,10 @@ $(info * LDLIBS: $(LDLIBS))
ALL = deprecated-header early-exit instance imports-exports exports-function exports-global memory memory2 features wasi
.SILENT: deprecated-header deprecated-header.o
deprecated-header: deprecated-header.o
.SILENT: early-exit early-exit.o
early-exit: early-exit.o
.SILENT: instance instance.o
instance: instance.o
.SILENT: imports-exports imports-exports.o
imports-exports: imports-exports.o
.SILENT: exports-function exports-function.o
exports-function: exports-function.o
.SILENT: exports-global exports-global.o
exports-global: exports-global.o
.SILENT: memory memory.o
memory: memory.o
.SILENT: memory2 memory2.o
memory2: memory2.o
.SILENT: features features.o
features: features.o
.SILENT: wasi wasi.o
wasi: wasi.o
.PHONY: all
all: $(ALL)
.PHONY: run
.SILENT: run
run: $(ALL)
set -o errexit; \
$(foreach example,$?,echo Running \"$(example)\" example; ./$(example); echo;)
run:
WASMER_DIR="$(WASMER_DIR)" ROOT_DIR="$(ROOT_DIR)" CFLAGS="$(CFLAGS)" LDFLAGS="$(LDFLAGS)" LDLIBS="$(LDLIBS)" cargo test --manifest-path="./wasmer-capi-examples-runner/Cargo.toml" -- --nocapture
.SILENT: clean
.PHONY: clean