-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: add building reactor, rework Makefile
- Loading branch information
Showing
4 changed files
with
25 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,31 @@ | ||
WASICC?=$(WASI_SDK_PATH)/bin/clang --sysroot=${WASI_SDK_PATH}/share/wasi-sysroot | ||
WASM_INSTR_API_KEY=? | ||
|
||
WASM_INSTR_API_KEY?= | ||
.NOTINTERMEDIATE: | ||
.PHONY: test | ||
test: | ||
cargo run --example=basic test/test.c.instr.wasm "Test" | ||
cargo run --example=many test/test.c.instr.wasm "Test" | ||
|
||
C_MODULES := $(wildcard test/*.c) | ||
RS_MODULES := $(wildcard test/*.rs) | ||
instrument: | ||
@for file in $(C_MODULES); do \ | ||
$(WASICC) -o $$file.wasm $$file; \ | ||
curl -F wasm=@$$file.wasm https://compiler-preview.dylibso.com/instrument -X POST -H "Authorization: Bearer $(WASM_INSTR_API_KEY)" > $$file.instr.wasm; \ | ||
done | ||
@for file in $(RS_MODULES); do \ | ||
rustc $$file --target=wasm32-wasi -C opt-level=3 -C debuginfo=0 -o $$file.wasm; \ | ||
curl -F wasm=@$$file.wasm https://compiler-preview.dylibso.com/instrument -X POST -H "Authorization: Bearer $(WASM_INSTR_API_KEY)" > $$file.instr.wasm; \ | ||
done | ||
ALL_MODULES := $(C_MODULES) $(RS_MODULES) | ||
ALL_MODULES_INSTR_WASM := $(addsuffix .instr.wasm, $(ALL_MODULES)) | ||
|
||
test/reactor-%.c.wasm: test/reactor-%.c | ||
$(WASICC) -mexec-model=reactor -o $@ $^ | ||
|
||
test/%.c.wasm: test/%.c | ||
$(WASICC) -o $@ $^ | ||
|
||
test/%.rs.wasm: test/%.rs | ||
rustc $^ --target=wasm32-wasi -C opt-level=3 -C debuginfo=0 -o $@ | ||
|
||
test/%.instr.wasm: test/%.wasm | ||
curl -F wasm=@$^ https://compiler-preview.dylibso.com/instrument -X POST -H "Authorization: Bearer $(WASM_INSTR_API_KEY)" > $@ | ||
|
||
.PHONY: instrument | ||
instrument: $(ALL_MODULES_INSTR_WASM) | ||
|
||
.PHONY: clean | ||
clean: | ||
rm -f test/*.wasm |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
#include <stdio.h> | ||
void hello(void) { printf("hello world\n"); } |
Binary file not shown.
Binary file not shown.