Skip to content

Use dune test stanza #1631

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

Merged
merged 5 commits into from
Dec 2, 2024
Merged
Show file tree
Hide file tree
Changes from all 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
1 change: 1 addition & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

## Features/Changes
* Lib: fix the type of some DOM properties and methods (#1747)
* Test: use dune test stanzas (#1631)

# 5.9.0 (2024-11-22) - Lille

Expand Down
30 changes: 7 additions & 23 deletions compiler/tests-env/dune
Original file line number Diff line number Diff line change
@@ -1,27 +1,11 @@
(executable
(test
(modes js)
(js_of_ocaml
(javascript_files setup.js)
(flags :standard --setenv JSOO_C=from-jsoo-args))
(name test))

(rule
(target test.js)
(action
(with-outputs-to
%{target}
(cat %{dep:setup.js} %{dep:./test.bc.js}))))

(rule
(target test.output)
(action
(with-outputs-to
%{target}
(setenv
JSOO_B
from-env
(run node %{dep:./test.js})))))

(rule
(alias runtest)
(action
(diff test.reference test.output)))
(setenv
JSOO_B
from-env
(run node %{test})))
(name test))
File renamed without changes.
24 changes: 20 additions & 4 deletions compiler/tests-jsoo/dune
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,32 @@
(preprocess
(pps ppx_expect)))

(library
(name jsoo_testsuite_parsing)
(modules test_parsing calc_parser calc_lexer)
(libraries unix compiler-libs.common js_of_ocaml-compiler)
(enabled_if
(>= %{ocaml_version} 5.1.1))
(inline_tests
(modes js best))
(preprocess
(pps ppx_expect)))

(library
(name jsoo_testsuite)
(modules
(:standard \ test_io test_floats test_marshal_compressed))
(:standard
\
test_io
test_floats
test_marshal_compressed
test_parsing
calc_parser
calc_lexer))
(libraries unix compiler-libs.common js_of_ocaml-compiler)
(foreign_stubs
(language c)
(names bigarray_stubs flush_stubs))
(js_of_ocaml
(javascript_files runtime.js))
(names bigarray_stubs))
(inline_tests
(modes js best))
(preprocess
Expand Down
12 changes: 0 additions & 12 deletions compiler/tests-jsoo/flush_stubs.c

This file was deleted.

15 changes: 10 additions & 5 deletions compiler/tests-jsoo/lib-effects/dune
Original file line number Diff line number Diff line change
@@ -1,12 +1,17 @@
(env
(using-effects)
(wasm)
(wasm-effects)
(_
(js_of_ocaml
(flags
(:standard --enable effects)))))

(library
(name jsoo_testsuite_effect)
(enabled_if
(and
(>= %{ocaml_version} 5)
(= %{profile} using-effects)))
(>= %{ocaml_version} 5))
(inline_tests
;; This requires the unreleased dune 3.7 to work
(enabled_if true)
(modes js best))
(preprocess
(pps ppx_expect)))
2 changes: 0 additions & 2 deletions compiler/tests-jsoo/runtime.js

This file was deleted.

9 changes: 1 addition & 8 deletions compiler/tests-jsoo/test_parsing.ml
Original file line number Diff line number Diff line change
Expand Up @@ -17,22 +17,15 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*)

(* see https://github.com/ocaml/ocaml/pull/12046 *)
external flush_stdout_stderr : unit -> unit = "flush_stdout_stderr"

let parse s =
flush_stdout_stderr ();
try
let lexbuf = Lexing.from_string s in
while true do
let result = Calc_parser.main Calc_lexer.token lexbuf in
flush_stdout_stderr ();
print_int result;
print_newline ()
done
with Calc_lexer.Eof ->
flush_stdout_stderr ();
print_endline "EOF"
with Calc_lexer.Eof -> print_endline "EOF"

let%expect_test "parsing" =
let (old : bool) = Parsing.set_trace true in
Expand Down
14 changes: 1 addition & 13 deletions compiler/tests-linkall/dune
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
(js_of_ocaml
(compilation_mode separate))))

(executable
(test
(name test)
(modes byte js)
(libraries dynlink)
Expand All @@ -15,15 +15,3 @@
;; Let's use it for the test
(link_flags
(:standard -linkall)))

(rule
(target test.output)
(action
(with-stdout-to
%{target}
(run node %{dep:test.bc.js}))))

(rule
(alias runtest)
(action
(diff test.reference test.output)))
18 changes: 2 additions & 16 deletions compiler/tests-num/dune
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
(executable
(test
(name main)
(modules main test_nats test test_big_ints test_ratios test_nums test_io)
(libraries num)
Expand All @@ -9,23 +9,9 @@
(:standard -linkall -w -3-7-33-35-37 -safe-string -no-strict-sequence)))

(rule
(target main.referencejs)
(deps main.bc.js)
(action
(with-stdout-to
%{target}
(run node ./main.bc.js))))

(rule
(target main.reference)
(target main.expected)
(deps main.exe)
(action
(with-stdout-to
%{target}
(run ./main.exe))))

(rule
(alias runtest)
(deps main.reference main.referencejs)
(action
(diff main.reference main.referencejs)))
16 changes: 1 addition & 15 deletions compiler/tests-ocaml/basic-modules/dune
Original file line number Diff line number Diff line change
@@ -1,18 +1,4 @@
(executables
(tests
(names recursive_module_init)
(libraries)
(modes js))

(rule
(target recursive_module_init.referencejs)
(deps recursive_module_init.bc.js)
(action
(with-stdout-to
%{target}
(run node ./recursive_module_init.bc.js))))

(rule
(alias runtest)
(deps recursive_module_init.reference recursive_module_init.referencejs)
(action
(diff recursive_module_init.reference recursive_module_init.referencejs)))
11 changes: 2 additions & 9 deletions compiler/tests-ocaml/lib-atomic/dune
Original file line number Diff line number Diff line change
@@ -1,10 +1,3 @@
(executables
(names test_atomic)
(libraries)
(test
(name test_atomic)
(modes js))

(rule
(alias runtest)
(deps test_atomic.bc.js)
(action
(run node test_atomic.bc.js)))
72 changes: 1 addition & 71 deletions compiler/tests-ocaml/lib-bigarray/dune
Original file line number Diff line number Diff line change
@@ -1,74 +1,4 @@
(executables
(tests
(names bigarrays change_layout fftba pr5115 weak_bigarray)
(libraries)
(modes js))

(rule
(target bigarrays.referencejs)
(deps bigarrays.bc.js)
(action
(with-stdout-to
%{target}
(run node ./bigarrays.bc.js))))

(rule
(alias runtest)
(deps bigarrays.reference bigarrays.referencejs)
(action
(diff bigarrays.reference bigarrays.referencejs)))

(rule
(target change_layout.referencejs)
(deps change_layout.bc.js)
(action
(with-stdout-to
%{target}
(run node ./change_layout.bc.js))))

(rule
(alias runtest)
(deps change_layout.reference change_layout.referencejs)
(action
(diff change_layout.reference change_layout.referencejs)))

(rule
(target fftba.referencejs)
(deps fftba.bc.js)
(action
(with-stdout-to
%{target}
(run node ./fftba.bc.js))))

(rule
(alias runtest)
(deps fftba.reference fftba.referencejs)
(action
(diff fftba.reference fftba.referencejs)))

(rule
(target pr5115.referencejs)
(deps pr5115.bc.js)
(action
(with-stdout-to
%{target}
(run node ./pr5115.bc.js))))

(rule
(alias runtest)
(deps pr5115.reference pr5115.referencejs)
(action
(diff pr5115.reference pr5115.referencejs)))

(rule
(target weak_bigarray.referencejs)
(deps weak_bigarray.bc.js)
(action
(with-stdout-to
%{target}
(run node ./weak_bigarray.bc.js))))

(rule
(alias runtest)
(deps weak_bigarray.reference weak_bigarray.referencejs)
(action
(diff weak_bigarray.reference weak_bigarray.referencejs)))
16 changes: 1 addition & 15 deletions compiler/tests-ocaml/lib-bool/dune
Original file line number Diff line number Diff line change
@@ -1,18 +1,4 @@
(executables
(tests
(names test)
(libraries)
(modes js))

(rule
(target test.referencejs)
(deps test.bc.js)
(action
(with-stdout-to
%{target}
(run node ./test.bc.js))))

(rule
(alias runtest)
(deps test.reference test.referencejs)
(action
(diff test.reference test.referencejs)))
16 changes: 1 addition & 15 deletions compiler/tests-ocaml/lib-buffer/dune
Original file line number Diff line number Diff line change
@@ -1,18 +1,4 @@
(executables
(tests
(names test)
(libraries)
(modes js))

(rule
(target test.referencejs)
(deps test.bc.js)
(action
(with-stdout-to
%{target}
(run node ./test.bc.js))))

(rule
(alias runtest)
(deps test.reference test.referencejs)
(action
(diff test.reference test.referencejs)))
16 changes: 1 addition & 15 deletions compiler/tests-ocaml/lib-bytes-utf/dune
Original file line number Diff line number Diff line change
@@ -1,22 +1,8 @@
(executables
(tests
(names test)
(libraries)
(flags
(:standard \ -strict-sequence))
(modes
js
(best exe)))

(rule
(target test.referencejs)
(deps test.bc.js)
(action
(with-stdout-to
%{target}
(run node ./test.bc.js))))

(rule
(alias runtest)
(deps test.reference test.referencejs)
(action
(diff test.reference test.referencejs)))
Loading