Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[interpreter] Dune test suite #1478

Merged
merged 7 commits into from
May 17, 2022
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
File renamed without changes.
5 changes: 4 additions & 1 deletion interpreter/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: dunetest for consistency.

Can you also add such a target for the dune build itself?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed and added.


test: $(OPT) smallint
$(TESTDIR)/run.py --wasm `pwd`/$(OPT) $(if $(JS),--js '$(JS)',)
Expand Down Expand Up @@ -168,6 +168,9 @@ quiettest/%: $(OPT)
smallinttest: smallint
@./smallint.native

dune-test:
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))))