Skip to content

Commit

Permalink
Enable individual testing with Makefile.jst (ocaml#76)
Browse files Browse the repository at this point in the history
  • Loading branch information
goldfirere committed Dec 8, 2022
1 parent 2a7e501 commit e2d0d9e
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 2 deletions.
22 changes: 22 additions & 0 deletions HACKING.jst.adoc
Expand Up @@ -32,3 +32,25 @@ to start a continuously polling build of the compiler.
Note that the dune-based build system is entirely separate from the main
Makefile, and so you will need to use `make -f Makefile.jst install`
to install after building.

## Testing

As demonstrated above, you can

$ make -f Makefile.jst runtest-upstream

to run the entire testsuite. As a shorter synonym, you may also

$ make -f Makefile.jst test

If you want to run just one test or one test directory, you can

$ make -f Makefile.jst test-one TEST=<<test file here>>
$ make -f Makefile.jst test-one DIR=<<test dir here>>

where the test file or test dir are specified with respect to the
`testsuite/tests` directory. For example:

$ make -f Makefile.jst test-one TEST=typing-local/local.ml
$ make -f Makefile.jst test-one DIR=typing-local

15 changes: 13 additions & 2 deletions Makefile.common-jst
Expand Up @@ -169,8 +169,8 @@ main_build = _build/main

# The following horror will be removed when work to allow the testsuite to
# run on an installed tree (led by David Allsopp) is completed.
.PHONY: runtest-upstream
runtest-upstream: _install
.PHONY: runtest-upstream test install_for_test
install_for_test: _install
rm -rf _runtest
mkdir _runtest
ln -s ../_install _runtest/_install
Expand Down Expand Up @@ -247,6 +247,7 @@ runtest-upstream: _install
# ocamltest itself
mkdir _runtest/ocamltest
cp $(main_build)/$(ocamldir)/ocamltest/ocamltest.byte _runtest/ocamltest/ocamltest
test: install_for_test
if [ "$(middle_end)" = "flambda2" ]; then \
for dir in `cd ocaml/testsuite; ls -1 -d tests/*`; do \
if ! grep -q "^ $$dir " testsuite/flambda2-test-list; then \
Expand Down Expand Up @@ -277,6 +278,16 @@ runtest-upstream: _install
fi \
fi)

runtest-upstream: test

test-one: install_for_test
(export OCAMLSRCDIR=$$(pwd)/_runtest; \
export CAML_LD_LIBRARY_PATH=$$(pwd)/_runtest/lib/ocaml/stublibs; \
if $$(which gfortran > /dev/null 2>&1); then \
export LIBRARY_PATH=$$(dirname $$(gfortran -print-file-name=libgfortran.a)); \
fi; \
cd _runtest/testsuite && make one $(if $(TEST),TEST="tests/$(TEST)") $(if $(DIR),DIR="tests/$(DIR)"))

# This target is like a polling version of upstream "make ocamlopt"
.PHONY: hacking
hacking: _build/_bootinstall
Expand Down

0 comments on commit e2d0d9e

Please sign in to comment.