Skip to content

Commit 9d6df66

Browse files
authored
Merge pull request #128 from ocaml-wasm/env-var
Use environment variable to disable some tests when testing Wasm_of_ocaml
2 parents 1a7305e + aa1c9c9 commit 9d6df66

File tree

17 files changed

+124
-196
lines changed

17 files changed

+124
-196
lines changed

compiler/tests-compiler/dune.inc

Lines changed: 55 additions & 55 deletions
Large diffs are not rendered by default.

compiler/tests-compiler/gen-rules/gen.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ let () =
7777
(library
7878
;; %s%s.ml
7979
(name %s_%d)
80-
(enabled_if (and %s (<> %%{profile} wasm) (<> %%{profile} wasm-effects)))
80+
(enabled_if (and %s %%{env:js-enabled=}))
8181
(modules %s)
8282
(libraries js_of_ocaml_compiler unix str jsoo_compiler_expect_tests_helper)
8383
(inline_tests

compiler/tests-dynlink-js/dune

Lines changed: 6 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
(executable
22
(name main)
3-
(enabled_if
4-
(and
5-
(<> %{profile} wasm)
6-
(<> %{profile} wasm-effects)))
3+
(enabled_if %{env:js-enabled=})
74
(modules main)
85
(libraries js_of_ocaml)
96
(link_flags
@@ -40,10 +37,7 @@
4037

4138
(rule
4239
(target main.js)
43-
(enabled_if
44-
(and
45-
(<> %{profile} wasm)
46-
(<> %{profile} wasm-effects)))
40+
(enabled_if %{env:js-enabled=})
4741
(action
4842
(run %{bin:js_of_ocaml} --linkall %{read-strings:effects_flags.txt} -o
4943
%{target} %{dep:main.bc})))
@@ -73,10 +67,7 @@
7367

7468
(rule
7569
(target main.out)
76-
(enabled_if
77-
(and
78-
(<> %{profile} wasm)
79-
(<> %{profile} wasm-effects)))
70+
(enabled_if %{env:js-enabled=})
8071
(deps plugin.js plugin2.js)
8172
(action
8273
(with-outputs-to
@@ -85,10 +76,7 @@
8576

8677
(rule
8778
(target main.out2)
88-
(enabled_if
89-
(and
90-
(<> %{profile} wasm)
91-
(<> %{profile} wasm-effects)))
79+
(enabled_if %{env:js-enabled=})
9280
(deps plugin.js plugin2.js)
9381
(action
9482
(with-outputs-to
@@ -97,18 +85,12 @@
9785

9886
(rule
9987
(alias runtest)
100-
(enabled_if
101-
(and
102-
(<> %{profile} wasm)
103-
(<> %{profile} wasm-effects)))
88+
(enabled_if %{env:js-enabled=})
10489
(action
10590
(diff main.out.expected main.out)))
10691

10792
(rule
10893
(alias runtest)
109-
(enabled_if
110-
(and
111-
(<> %{profile} wasm)
112-
(<> %{profile} wasm-effects)))
94+
(enabled_if %{env:js-enabled=})
11395
(action
11496
(diff main.out.expected main.out2)))

compiler/tests-dynlink/dune

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,13 @@
11
(executable
22
(name main)
3-
(enabled_if
4-
(and
5-
(<> %{profile} wasm)
6-
(<> %{profile} wasm-effects)))
3+
(enabled_if %{env:js-enabled=})
74
(modules main)
85
(libraries dynlink js_of_ocaml-compiler.dynlink)
96
(modes byte))
107

118
(rule
129
(target main.js)
13-
(enabled_if
14-
(and
15-
(<> %{profile} wasm)
16-
(<> %{profile} wasm-effects)))
10+
(enabled_if %{env:js-enabled=})
1711
(deps plugin.cmo export)
1812
(action
1913
(run %{bin:js_of_ocaml} --dynlink --export export --pretty -o %{target}
@@ -26,10 +20,7 @@
2620

2721
(rule
2822
(target main.out)
29-
(enabled_if
30-
(and
31-
(<> %{profile} wasm)
32-
(<> %{profile} wasm-effects)))
23+
(enabled_if %{env:js-enabled=})
3324
(deps plugin.cmo)
3425
(action
3526
(with-outputs-to
@@ -38,9 +29,6 @@
3829

3930
(rule
4031
(alias runtest)
41-
(enabled_if
42-
(and
43-
(<> %{profile} wasm)
44-
(<> %{profile} wasm-effects)))
32+
(enabled_if %{env:js-enabled=})
4533
(action
4634
(diff main.out.expected main.out)))

compiler/tests-io/dune

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,7 @@
3232
(action
3333
(copy cat.bc.wasm.js cat.bc.js))
3434
(enabled_if
35-
(or
36-
(= %{profile} wasm)
37-
(= %{profile} wasm-effects))))
35+
(not %{env:js-enabled=})))
3836

3937
(rule
4038
(target md5-native.stdout)
@@ -83,6 +81,4 @@
8381
(action
8482
(copy md5.bc.wasm.js md5.bc.js))
8583
(enabled_if
86-
(or
87-
(= %{profile} wasm)
88-
(= %{profile} wasm-effects))))
84+
(not %{env:js-enabled=})))

compiler/tests-jsoo/bin/dune

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -59,9 +59,7 @@
5959
(action
6060
(copy error1.bc.wasm.js error1.bc.js))
6161
(enabled_if
62-
(or
63-
(= %{profile} wasm)
64-
(= %{profile} wasm-effects))))
62+
(not %{env:js-enabled=})))
6563

6664
(rule
6765
(target error2.js.actual)
@@ -118,6 +116,4 @@
118116
(action
119117
(copy error2.bc.wasm.js error2.bc.js))
120118
(enabled_if
121-
(or
122-
(= %{profile} wasm)
123-
(= %{profile} wasm-effects))))
119+
(not %{env:js-enabled=})))
Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,22 @@
1+
(env
2+
(using-effects)
3+
(wasm)
4+
(wasm-effects)
5+
(_
6+
(js_of_ocaml
7+
(flags
8+
(:standard --enable effects))
9+
;; separate compilation doesn't work when using
10+
;; features such as 'effects' or 'use-js-string'
11+
;; because dune doesn't know that it should compile
12+
;; multiple versions of the dependencies
13+
(compilation_mode whole_program))))
14+
115
(library
216
(name jsoo_testsuite_effect)
317
(enabled_if
4-
(and
5-
(>= %{ocaml_version} 5)
6-
(or
7-
(= %{profile} using-effects)
8-
(= %{profile} wasm-effects))))
18+
(>= %{ocaml_version} 5))
919
(inline_tests
10-
;; This requires the unreleased dune 3.7 to work
11-
(enabled_if true)
1220
(modes js wasm best))
1321
(preprocess
1422
(pps ppx_expect)))

compiler/tests-num/dune

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,7 @@
22
(name main)
33
(modules main test_nats test test_big_ints test_ratios test_nums test_io)
44
(libraries num)
5-
(enabled_if
6-
(and
7-
(<> %{profile} wasm)
8-
(<> %{profile} wasm-effects)))
5+
(enabled_if %{env:js-enabled=})
96
(modes
107
js
118
(best exe))

compiler/tests-ocaml/lib-hashtbl/dune

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,10 @@
1717
(rule
1818
(action
1919
(copy hfun.expected-js hfun.expected))
20-
(enabled_if
21-
(and
22-
(<> %{profile} wasm)
23-
(<> %{profile} wasm-effects))))
20+
(enabled_if %{env:js-enabled=}))
2421

2522
(rule
2623
(action
2724
(copy hfun.expected-wasm hfun.expected))
2825
(enabled_if
29-
(or
30-
(= %{profile} wasm)
31-
(= %{profile} wasm-effects))))
26+
(not %{env:js-enabled=})))

compiler/tests-toplevel/dune

Lines changed: 5 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
(executables
22
(names test_toplevel)
3-
(enabled_if
4-
(and
5-
(<> %{profile} wasm)
6-
(<> %{profile} wasm-effects)))
3+
(enabled_if %{env:js-enabled=})
74
(libraries js_of_ocaml-compiler.dynlink compiler-libs.toplevel)
85
(flags
96
(:standard -linkall))
@@ -13,20 +10,13 @@
1310

1411
(rule
1512
(targets test_toplevel.js)
16-
(enabled_if
17-
(and
18-
(<> %{profile} wasm)
19-
(<> %{profile} wasm-effects)))
13+
(enabled_if %{env:js-enabled=})
2014
(action
2115
(run %{bin:js_of_ocaml} --toplevel %{dep:test_toplevel.bc} -o %{targets})))
2216

2317
(rule
2418
(target test_toplevel.bc.js.actual)
25-
(enabled_if
26-
(and
27-
(>= %{ocaml_version} 5.2)
28-
(<> %{profile} wasm)
29-
(<> %{profile} wasm-effects)))
19+
(enabled_if %{env:js-enabled=})
3020
(action
3121
(with-stdout-to
3222
%{target}
@@ -37,8 +27,7 @@
3727
(enabled_if
3828
(and
3929
(>= %{ocaml_version} 5.2)
40-
(<> %{profile} wasm)
41-
(<> %{profile} wasm-effects)))
30+
%{env:js-enabled=}))
4231
(action
4332
(with-stdout-to
4433
%{target}
@@ -49,8 +38,7 @@
4938
(enabled_if
5039
(and
5140
(>= %{ocaml_version} 5.2)
52-
(<> %{profile} wasm)
53-
(<> %{profile} wasm-effects)))
41+
%{env:js-enabled=}))
5442
(action
5543
(progn
5644
(diff test_toplevel.expected test_toplevel.bc.js.actual)

0 commit comments

Comments
 (0)