Skip to content

Commit

Permalink
[interpreter] Dune test suite (#1478)
Browse files Browse the repository at this point in the history
  • Loading branch information
vapourismo committed May 17, 2022
1 parent 656e20a commit 1b849c7
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 6 deletions.
File renamed without changes.
9 changes: 7 additions & 2 deletions interpreter/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ JS = # set to JS shell command to run JS tests

# Main targets

.PHONY: default opt unopt libopt libunopt jslib all land zip smallint
.PHONY: default opt unopt libopt libunopt jslib all land zip smallint dunebuild

default: opt
debug: unopt
Expand All @@ -41,6 +41,8 @@ land: $(WINMAKE) all
zip: $(ZIP)
smallint: smallint.native

dunebuild:
dune build

# Building executable

Expand Down Expand Up @@ -136,7 +138,7 @@ TESTDIR = ../test/core
TESTFILES = $(shell cd $(TESTDIR); ls *.wast; ls [a-z]*/*.wast)
TESTS = $(TESTFILES:%.wast=%)
.PHONY: test debugtest partest
.PHONY: test debugtest partest dune-test
test: $(OPT) smallint
$(TESTDIR)/run.py --wasm `pwd`/$(OPT) $(if $(JS),--js '$(JS)',)
Expand Down Expand Up @@ -168,6 +170,9 @@ quiettest/%: $(OPT)
smallinttest: smallint
@./smallint.native
dunetest:
dune test
# Miscellaneous targets
.PHONY: clean
Expand Down
27 changes: 23 additions & 4 deletions interpreter/dune
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@
(library
(name wasm)
; The 'main' module shall not be part of the library, as it would start the
; WASM REPL every time in all the dependencies.
; Wasm REPL every time in all the dependencies.
; We also need to exclude the 'wasm' module as it overlaps with the library
; name.
(modules :standard \ main wasm))
; 'smallint' is a separate test module.
(modules :standard \ main wasm smallint))

(executable
(name main)
Expand All @@ -15,6 +16,13 @@
(flags
(-open Wasm)))

(executable
(name smallint)
(modules smallint)
(libraries wasm)
(flags
(-open Wasm)))

(subdir
text
(rule
Expand All @@ -28,6 +36,17 @@
(modules parser)))

(env
(dev
(_
(flags
(-w +a-4-27-42-44-45 -warn-error +a-3))))
(-w +a-4-27-42-44-45-70 -warn-error +a-3))))

(rule
(alias runtest)
(deps
./main.exe
./smallint.exe
(source_tree ../test))
(action
(progn
(run ../test/core/run.py --wasm ./main.exe)
(run ./smallint.exe))))

0 comments on commit 1b849c7

Please sign in to comment.