@@ -9,7 +9,7 @@ include mk/common.mk
9
9
FSTAR_DEFAULT_GOAL ?= build
10
10
.DEFAULT_GOAL := $(FSTAR_DEFAULT_GOAL )
11
11
12
- all : stage1 stage2 stage3-bare lib-fsharp
12
+ all : stage1 stage2 1.tests 2.tests stage3-bare lib-fsharp
13
13
all-packages : package-1 package-2 package-src-1 package-src-2
14
14
15
15
# ## STAGES
@@ -38,12 +38,14 @@ FSTAR0_EXE ?= stage0/out/bin/fstar.exe
38
38
# stage 1 libraries for the stage 2, which does not need them at all (currently?).
39
39
#
40
40
# I'd love a better alternative.
41
- FSTAR1_BARE_EXE := stage1/dune/_build/default/fstarc-bare/fstarc1_bare.exe
42
- FSTAR1_FULL_EXE := stage1/dune/_build/default/fstarc-full/fstarc1_full.exe
41
+ FSTAR1_BARE_EXE := stage1/dune/_build/default/fstarc-bare/fstarc1_bare.exe
42
+ FSTAR1_FULL_EXE := stage1/dune/_build/default/fstarc-full/fstarc1_full.exe
43
43
INSTALLED_FSTAR1_FULL_EXE := stage1/out/bin/fstar.exe
44
- FSTAR2_BARE_EXE := stage2/dune/_build/default/fstarc-bare/fstarc2_bare.exe
45
- FSTAR2_FULL_EXE := stage2/dune/_build/default/fstarc-full/fstarc2_full.exe
44
+ FSTAR2_BARE_EXE := stage2/dune/_build/default/fstarc-bare/fstarc2_bare.exe
45
+ FSTAR2_FULL_EXE := stage2/dune/_build/default/fstarc-full/fstarc2_full.exe
46
46
INSTALLED_FSTAR2_FULL_EXE := stage2/out/bin/fstar.exe
47
+ TESTS1_EXE := stage1/dune/_build/default/tests/fstarc1_tests.exe
48
+ TESTS2_EXE := stage2/dune/_build/default/tests/fstarc2_tests.exe
47
49
48
50
.PHONY : .force
49
51
.force :
@@ -59,10 +61,12 @@ endif
59
61
build : 2
60
62
61
63
0 : $(FSTAR0_EXE )
62
- 1.bare : $(FSTAR1_BARE_EXE )
63
- 1.full : $(FSTAR1_FULL_EXE )
64
- 2.bare : $(FSTAR2_BARE_EXE )
65
- 2.full : $(FSTAR2_FULL_EXE )
64
+ 1.bare : $(FSTAR1_BARE_EXE )
65
+ 1.tests : $(TESTS1_EXE )
66
+ 1.full : $(FSTAR1_FULL_EXE )
67
+ 2.bare : $(FSTAR2_BARE_EXE )
68
+ 2.tests : $(TESTS2_EXE )
69
+ 2.full : $(FSTAR2_FULL_EXE )
66
70
67
71
# This file's timestamp is updated whenever anything in stage0/
68
72
# (excluding some build directories)
@@ -92,13 +96,27 @@ stage0/out/bin/fstar.exe: .stage0.touch
92
96
env \
93
97
SRC=src/ \
94
98
FSTAR_EXE=$(FSTAR0_EXE ) \
99
+ FSTAR_LIB=$(abspath ulib) \
95
100
CACHE_DIR=stage1/fstarc.checked/ \
96
101
OUTPUT_DIR=stage1/fstarc.ml/ \
97
102
CODEGEN=OCaml \
98
103
TAG=fstarc \
99
104
TOUCH=$@ \
100
105
$(MAKE ) -f mk/fstar-01.mk ocaml
101
106
107
+ .tests1.src.touch : .bare1.src.touch $(FSTAR0_EXE ) .force
108
+ $(call bold_msg, "EXTRACT", "STAGE 1 TESTS")
109
+ env \
110
+ SRC=src/ \
111
+ FSTAR_EXE=$(FSTAR0_EXE ) \
112
+ FSTAR_LIB=$(abspath ulib) \
113
+ CACHE_DIR=stage1/tests.checked/ \
114
+ OUTPUT_DIR=stage1/tests.ml/ \
115
+ CODEGEN=PluginNoLib \
116
+ TAG=fstarc \
117
+ TOUCH=$@ \
118
+ $(MAKE ) -f mk/tests-1.mk ocaml
119
+
102
120
# These files are regenerated as soon as *any* ml file reachable from
103
121
# stage*/dune changes. This makes sure we trigger dune rebuilds when we
104
122
# modify base ML files. However this will not catch deletion of a file.
@@ -111,6 +129,14 @@ $(FSTAR1_BARE_EXE): .bare1.src.touch .src.ml.touch $(MAYBEFORCE)
111
129
$(MAKE ) -C stage1 fstarc-bare
112
130
touch -c $@
113
131
132
+ $(TESTS1_EXE ) : .tests1.src.touch .src.ml.touch $(MAYBEFORCE )
133
+ $(call bold_msg, "BUILD", "STAGE 1 TESTS")
134
+ $(MAKE ) -C stage1 tests
135
+ touch -c $@
136
+
137
+ stage1-unit-tests : $(TESTS1_EXE )
138
+ FSTAR_LIB=$(CURDIR ) /ulib $(TESTS1_EXE )
139
+
114
140
.full1.src.touch : $(FSTAR1_BARE_EXE ) .force
115
141
$(call bold_msg, "EXTRACT", "STAGE 1 PLUGINS")
116
142
env \
@@ -183,6 +209,19 @@ $(FSTAR1_FULL_EXE): .bare1.src.touch .full1.src.touch .src.ml.touch $(MAYBEFORCE
183
209
TOUCH=$@ \
184
210
$(MAKE ) -f mk/fstar-12.mk ocaml
185
211
212
+ .tests2.src.touch : .bare2.src.touch $(FSTAR1_FULL_EXE ) .force
213
+ $(call bold_msg, "EXTRACT", "STAGE 2 TESTS")
214
+ env \
215
+ SRC=src/ \
216
+ FSTAR_EXE=$(FSTAR1_FULL_EXE ) \
217
+ FSTAR_LIB=$(abspath ulib) \
218
+ CACHE_DIR=stage2/tests.checked/ \
219
+ OUTPUT_DIR=stage2/tests.ml/ \
220
+ CODEGEN=PluginNoLib \
221
+ TAG=fstarc \
222
+ TOUCH=$@ \
223
+ $(MAKE ) -f mk/tests-2.mk ocaml
224
+
186
225
$(FSTAR2_BARE_EXE ) : .bare2.src.touch .src.ml.touch $(MAYBEFORCE )
187
226
$(call bold_msg, "BUILD", "STAGE 2 FSTARC-BARE")
188
227
$(MAKE ) -C stage2 fstarc-bare FSTAR_DUNE_RELEASE=1
@@ -191,6 +230,14 @@ $(FSTAR2_BARE_EXE): .bare2.src.touch .src.ml.touch $(MAYBEFORCE)
191
230
# it is still part of the build of the full fstar, so
192
231
# we set the release flag to have a more incremental build.
193
232
233
+ $(TESTS2_EXE ) : .tests2.src.touch .src.ml.touch $(MAYBEFORCE )
234
+ $(call bold_msg, "BUILD", "STAGE 2 TESTS")
235
+ $(MAKE ) -C stage2 tests
236
+ touch -c $@
237
+
238
+ stage2-unit-tests : $(TESTS2_EXE )
239
+ FSTAR_LIB=$(CURDIR ) /ulib $(TESTS2_EXE )
240
+
194
241
.full2.src.touch : $(FSTAR2_BARE_EXE ) .force
195
242
$(call bold_msg, "EXTRACT", "STAGE 2 PLUGINS")
196
243
env \
@@ -385,14 +432,14 @@ package-2: .stage2.src.touch .force
385
432
INSTALL_RULE=__do-install-stage2 \
386
433
$(MAKE ) __do-archive
387
434
388
- package-src-1 : .stage1.src.touch .force
435
+ package-src-1 : .stage1.src.touch .tests1.src.touch . force
389
436
env \
390
437
PKGTMP=_srcpak1 \
391
438
BROOT=stage1/ \
392
439
ARCHIVE=fstar$(FSTAR_TAG ) -stage1-src \
393
440
$(MAKE ) __do-src-archive
394
441
395
- package-src-2 : .stage2.src.touch .force
442
+ package-src-2 : .stage2.src.touch .tests2.src.touch . force
396
443
env \
397
444
PKGTMP=_srcpak2 \
398
445
BROOT=stage2/ \
@@ -451,7 +498,7 @@ _examples: need_fstar_exe .force
451
498
452
499
ci : .force
453
500
+$(MAKE ) 2
454
- +$(MAKE ) test lib-fsharp stage3-diff
501
+ +$(MAKE ) test lib-fsharp stage3-diff test-2-bare stage2-unit-tests
455
502
456
503
save : stage0_new
457
504
0 commit comments