Skip to content
Merged
5 changes: 2 additions & 3 deletions default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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 = ''
Expand Down
6 changes: 5 additions & 1 deletion src/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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
4 changes: 3 additions & 1 deletion test/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
10 changes: 6 additions & 4 deletions test/dvm.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,13 @@

if [ -z "$1" ]
then
echo "Usage: $0 foo.wasm"
echo "Usage: $0 <name>.wasm"
exit 1
fi

name="$(basename $1 .wasm)_0"
DVM_TMP=$(mktemp -d)
trap 'rm -rf $DVM_TMP' EXIT

export LANG=C
function dvm_ () {
Expand All @@ -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
9 changes: 7 additions & 2 deletions test/quick.mk
Original file line number Diff line number Diff line change
Expand Up @@ -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)
2 changes: 1 addition & 1 deletion test/run-dfinity/ok/flatten-awaitables.dvm-run.ok
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@
# Empty MaybeLocal.
#

dvm.sh: line 12: Illegal instruction dvm $@
dvm.sh: line 14: Illegal instruction dvm $@
3 changes: 2 additions & 1 deletion test/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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#./}"
}

Expand Down