diff --git a/default.nix b/default.nix index feee501f625..c843d6a9560 100644 --- a/default.nix +++ b/default.nix @@ -114,11 +114,10 @@ rec { patchShebangs . asc --version make -C samples ASC=asc all - make -C test/run VERBOSE=1 ASC=asc all - make -C test/fail VERBOSE=1 ASC=asc all + make -C test VERBOSE=1 ASC=asc quick '' + (if test-dvm then '' - make -C test/run-dfinity VERBOSE=1 ASC=asc all + make --load-average -j8 -C test/run-dfinity VERBOSE=1 ASC=asc quick '' else ""); installPhase = '' diff --git a/src/Makefile b/src/Makefile index fd811340b00..57286cf567e 100644 --- a/src/Makefile +++ b/src/Makefile @@ -21,10 +21,11 @@ OCAMLBUILD = ocamlbuild $(OCAML_FLAGS) \ $(OPAM_PACKAGES:%=-pkg %) \ -tags debug -.PHONY: all quick clean test test-quick +.PHONY: all parallel quick clean test test-parallel test-quick all: $(NAME) test +parallel: $(NAME) test-parallel quick: $(NAME) test-quick $(NAME): $(MAIN).$(BUILD) @@ -55,5 +56,8 @@ test: $(NAME) accept: $(NAME) $(MAKE) -C ../test ASC=$(ASC) accept +test-parallel: $(NAME) + $(MAKE) -C ../test ASC=$(ASC) parallel + test-quick: $(NAME) $(MAKE) -C ../test ASC=$(ASC) quick diff --git a/test/Makefile b/test/Makefile index 19b6c2eec37..3163c044c2f 100644 --- a/test/Makefile +++ b/test/Makefile @@ -6,7 +6,9 @@ all: quick: $(MAKE) --no-print-directory --load-average -j -C fail quick $(MAKE) --no-print-directory --load-average -j -C run quick - $(MAKE) --no-print-directory --load-average -j -C run-dfinity _out/chatpp.done + +parallel: quick + $(MAKE) --no-print-directory --load-average -j -C run-dfinity quick coverage: rm -rf _coverage diff --git a/test/dvm.sh b/test/dvm.sh index 5ced2e91b6f..3af0e0e5468 100755 --- a/test/dvm.sh +++ b/test/dvm.sh @@ -2,11 +2,13 @@ if [ -z "$1" ] then - echo "Usage: $0 foo.wasm" + echo "Usage: $0 .wasm" exit 1 fi name="$(basename $1 .wasm)_0" +DVM_TMP=$(mktemp -d) +trap 'rm -rf $DVM_TMP' EXIT export LANG=C function dvm_ () { @@ -20,6 +22,6 @@ function dvm_ () { } -dvm_ -q reset -dvm_ -q new $1 -dvm_ -q run $name start +dvm_ -q --db $DVM_TMP reset +dvm_ -q --db $DVM_TMP new $1 +dvm_ -q --db $DVM_TMP run $name start diff --git a/test/quick.mk b/test/quick.mk index 274061b9433..73fc6def5a0 100644 --- a/test/quick.mk +++ b/test/quick.mk @@ -2,9 +2,14 @@ TO-TEST = $(patsubst %.as,_out/%.done,$(wildcard *.as)) +.PHONY: quick + quick: $(TO-TEST) +_out: + @ mkdir -p $@ + # run single test, e.g. make _out/AST-56.done -_out/%.done: %.as $(ASC) ../run.sh - @ mkdir -p _out +.SECONDEXPANSION: +_out/%.done: %.as $$(wildcard $(ASC)) ../run.sh | _out @ (../run.sh $(RUNFLAGS) $< > $@.tmp && mv $@.tmp $@) || (cat $@.tmp; rm -f $@.tmp; false) diff --git a/test/run-dfinity/ok/flatten-awaitables.dvm-run.ok b/test/run-dfinity/ok/flatten-awaitables.dvm-run.ok index b9d940dfe06..84cb71c9839 100644 --- a/test/run-dfinity/ok/flatten-awaitables.dvm-run.ok +++ b/test/run-dfinity/ok/flatten-awaitables.dvm-run.ok @@ -4,4 +4,4 @@ # Empty MaybeLocal. # -dvm.sh: line 12: Illegal instruction dvm $@ +dvm.sh: line 14: Illegal instruction dvm $@ diff --git a/test/run.sh b/test/run.sh index 45d22c0372f..dbd3fbd81ce 100755 --- a/test/run.sh +++ b/test/run.sh @@ -8,9 +8,10 @@ # # -a: Update the files in ok/ # -d: Compile with --dfinity, use dvm to run +# -s: Be silent in sunny-day execution # -realpath() { +function realpath() { [[ $1 = /* ]] && echo "$1" || echo "$PWD/${1#./}" }