| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
|
| 23 |
.DEFAULT_GOAL:=all |
| 24 |
|
| 25 |
|
| 26 |
|
| 27 |
|
| 28 |
|
| 29 |
|
| 30 |
|
| 31 |
|
| 32 |
DUNE_CONTEXT:=default |
| 33 |
TEST_SUITE_CONFIG_FILE:=test_suite_config.inc |
| 34 |
|
| 35 |
ifneq ($(MAKECMDGOALS),clean) |
| 36 |
include $(TEST_SUITE_CONFIG_FILE) |
| 37 |
endif |
| 38 |
|
| 39 |
|
| 40 |
ifeq ($(INSIDE_DUNE),) |
| 41 |
CONFIG_TO_MAKE_EXE:=../_build/$(DUNE_CONTEXT)/test-suite/tools/coq_config_to_make.exe |
| 42 |
ROCQ_EXE:=../_build/install/$(DUNE_CONTEXT)/bin/rocq |
| 43 |
|
| 44 |
$(TEST_SUITE_CONFIG_FILE): |
| 45 |
$(SHOW) 'coq_config_to_make > $@' |
| 46 |
$(HIDE)dune build $(CONFIG_TO_MAKE_EXE) |
| 47 |
$(HIDE)$(CONFIG_TO_MAKE_EXE) $(ROCQ_EXE) > $@ |
| 48 |
endif |
| 49 |
|
| 50 |
|
| 51 |
|
| 52 |
|
| 53 |
|
| 54 |
|
| 55 |
|
| 56 |
BIN:=$(COQPREFIX)/bin/ |
| 57 |
|
| 58 |
|
| 59 |
ifeq ($(ARCH),win32) |
| 60 |
export FINDLIB_SEP=; |
| 61 |
|
| 62 |
|
| 63 |
|
| 64 |
|
| 65 |
|
| 66 |
CLEANUP_WINPATH=| sed 's:.\\$(<):./$(<):' |
| 67 |
else |
| 68 |
export FINDLIB_SEP=: |
| 69 |
|
| 70 |
CLEANUP_WINPATH= |
| 71 |
endif |
| 72 |
|
| 73 |
|
| 74 |
|
| 75 |
export OCAMLPATH := $(shell echo $(COQPREFIX)/lib$(FINDLIB_SEP)$$OCAMLPATH) |
| 76 |
export CAML_LD_LIBRARY_PATH:=$(shell echo $(COQPREFIX)/lib/stublibs):$(CAML_LD_LIBRARY_PATH) |
| 77 |
|
| 78 |
|
| 79 |
ROCQLIB?= |
| 80 |
|
| 81 |
ifeq ($(ROCQLIB),) |
| 82 |
|
| 83 |
|
| 84 |
ifneq ($(wildcard $(shell echo $(COQLIBINSTALL))),) |
| 85 |
ROCQLIB := $(shell ocaml ocaml_pwd.ml $(COQLIBINSTALL)) |
| 86 |
endif |
| 87 |
endif |
| 88 |
export ROCQLIB |
| 89 |
|
| 90 |
ifeq ($(wildcard $(ROCQLIB)/theories/Init/Prelude.vo),) |
| 91 |
COQLIB_NOT_FOUND:=true |
| 92 |
else |
| 93 |
COQLIB_NOT_FOUND:=false |
| 94 |
endif |
| 95 |
|
| 96 |
COQEXTRAFLAGS?= |
| 97 |
COQFLAGS?=$(COQEXTRAFLAGS) |
| 98 |
|
| 99 |
coqc := $(BIN)rocq c -q -R prerequisite TestSuite $(COQFLAGS) |
| 100 |
coqchk := $(BIN)rocqchk -R prerequisite TestSuite |
| 101 |
coqdoc := $(BIN)rocq doc |
| 102 |
coqtop := $(BIN)rocq repl -q -test-mode -R prerequisite TestSuite |
| 103 |
|
| 104 |
coqidetop := $(BIN)coqidetop |
| 105 |
|
| 106 |
coqc_interactive := $(coqc) -test-mode |
| 107 |
coqdep := $(BIN)rocq dep |
| 108 |
|
| 109 |
|
| 110 |
OPT=-$(BEST) |
| 111 |
export OPT |
| 112 |
|
| 113 |
QUIET?= |
| 114 |
VERBOSE?= |
| 115 |
|
| 116 |
|
| 117 |
|
| 118 |
SHOW0 := $(if $(strip $(VERBOSE) $(QUIET)),true,echo) |
| 119 |
SHOW := @$(SHOW0) |
| 120 |
HIDE := $(if $(VERBOSE),,@) |
| 121 |
|
| 122 |
|
| 123 |
TIMED?= |
| 124 |
TIMEFMT?="$(1) (real: %e, user: %U, sys: %S, mem: %M ko)" |
| 125 |
|
| 126 |
ifneq (,$(TIMED)) |
| 127 |
ifeq (0,$(shell command time -f "" true >/dev/null 2>/dev/null; echo $$?)) |
| 128 |
STDTIME?=command time --quiet -f $(TIMEFMT) -o $(2) |
| 129 |
else |
| 130 |
ifeq (0,$(shell gtime --quiet -f "" true >/dev/null 2>/dev/null; echo $$?)) |
| 131 |
STDTIME?=gtime -f $(TIMEFMT) -o $(2) |
| 132 |
else |
| 133 |
STDTIME?=command time |
| 134 |
endif |
| 135 |
endif |
| 136 |
else |
| 137 |
STDTIME?=command time -f $(TIMEFMT) -o $(2) |
| 138 |
endif |
| 139 |
|
| 140 |
# args: 1=name of target, 2=command to time, |
| 141 |
|
| 142 |
WITH_TIMER=$(if $(TIMED), $(call STDTIME,$(1),$(if $(3),$(3),$(1).time)) $(2), $(2)) |
| 143 |
|
| 144 |
REPORT_TIMER=$(if $(TIMED),$(foreach f,$(1),cat $(f).time 2>/dev/null || true;),:) |
| 145 |
|
| 146 |
# read out an emacs config and look for coq-prog-args; if such exists, return it |
| 147 |
get_coq_prog_args_helper = sed -n s'/^.*$(1):[[:space:]]*(\([^)]*\)).*/\1/p' $(2) |
| 148 |
get_coq_prog_args = $(strip $(shell $(call get_coq_prog_args_helper,coq-prog-args,$(1)))) |
| 149 |
get_coqchk_prog_args = $(strip $(shell $(call get_coq_prog_args_helper,coqchk-prog-args,$(1))) $(filter "-impredicative-set",$(call get_coq_prog_args,$(1)))) |
| 150 |
SINGLE_QUOTE=" |
| 151 |
|
| 152 |
|
| 153 |
get_coq_prog_args_in_parens = $(subst $(SINGLE_QUOTE),,$(if $(call get_coq_prog_args,$(1)), ($(call get_coq_prog_args,$(1))))) |
| 154 |
get_coqchk_prog_args_in_parens = $(subst $(SINGLE_QUOTE),,$(if $(call get_coqchk_prog_args,$(1)), ($(call get_coqchk_prog_args,$(1))))) |
| 155 |
|
| 156 |
bogomips:= |
| 157 |
ifneq (,$(wildcard /proc/cpuinfo)) |
| 158 |
sedbogo := -e "s/bogomips.*: \([0-9]*\).*/\1/p" # i386, ppc |
| 159 |
sedbogo += -e "s/Cpu0Bogo.*: \([0-9]*\).*/\1/p" # sparc |
| 160 |
sedbogo += -e "s/BogoMIPS.*: \([0-9]*\).*/\1/p" # alpha |
| 161 |
bogomips := $(shell sed -n $(sedbogo) /proc/cpuinfo | head -1) |
| 162 |
endif |
| 163 |
|
| 164 |
ifeq (,$(bogomips)) |
| 165 |
$(warning cannot run complexity tests (no bogomips found)) |
| 166 |
endif |
| 167 |
|
| 168 |
|
| 169 |
log_success = "==========> SUCCESS <==========" |
| 170 |
log_segfault = "==========> FAILURE <==========" |
| 171 |
log_anomaly = "==========> FAILURE <==========" |
| 172 |
log_failure = "==========> FAILURE <==========" |
| 173 |
log_intro = "==========> TESTING $(1) <==========" |
| 174 |
|
| 175 |
FAIL = >&2 echo 'FAILED $@' |
| 176 |
FAIL_CHK = >&2 echo 'FAILED $(patsubst %.v.log,%.chk.log,$@)' |
| 177 |
|
| 178 |
|
| 179 |
|
| 180 |
|
| 181 |
|
| 182 |
|
| 183 |
COMPLEXITY := $(if $(bogomips),complexity) |
| 184 |
INTERACTIVE := interactive |
| 185 |
UNIT_TESTS := unit-tests |
| 186 |
|
| 187 |
|
| 188 |
DISABLED_SUBSYSTEMS?= |
| 189 |
|
| 190 |
VSUBSYSTEMS := prerequisite success failure bugs bugs-nocoqchk output output-coqtop \ |
| 191 |
output-modulo-time $(INTERACTIVE) $(COMPLEXITY) modules stm \ |
| 192 |
coqdoc ssr $(wildcard primitive/*) ltac2 coqchk |
| 193 |
|
| 194 |
|
| 195 |
SUBSYSTEMS := $(filter-out $(DISABLED_SUBSYSTEMS),$(VSUBSYSTEMS) misc ide ide coqchk output-coqchk coqwc coq-makefile precomputed-time-tests tools $(UNIT_TESTS)) |
| 196 |
|
| 197 |
|
| 198 |
.csdp.cache: .csdp.cache.test-suite |
| 199 |
$(SHOW) 'cp $< $@' |
| 200 |
$(HIDE)cp $< $@ |
| 201 |
$(HIDE)chmod u+w $@ |
| 202 |
|
| 203 |
PREREQUISITELOG = $(addsuffix .log,$(wildcard prerequisite/*.v)) .csdp.cache |
| 204 |
|
| 205 |
|
| 206 |
|
| 207 |
|
| 208 |
|
| 209 |
.DELETE_ON_ERROR: |
| 210 |
.PHONY: all run clean $(SUBSYSTEMS) |
| 211 |
|
| 212 |
ifeq ($(COQLIB_NOT_FOUND),true) |
| 213 |
all: |
| 214 |
@echo "" |
| 215 |
@echo "Coq's standard library has not been built; please run: " |
| 216 |
@echo " - make world" |
| 217 |
@echo "(looked in $(COQLIBINSTALL))" |
| 218 |
ifeq ($(COQLIBINSTALL),) |
| 219 |
@echo "config file $(TEST_SUITE_CONFIG_FILE) seems corrupt:" |
| 220 |
@cat $(TEST_SUITE_CONFIG_FILE) |
| 221 |
endif |
| 222 |
@false |
| 223 |
else |
| 224 |
ifeq ($(TIMED),) |
| 225 |
all: run |
| 226 |
$(MAKE) report |
| 227 |
else |
| 228 |
all: |
| 229 |
$(MAKE) run | tee time-of-build.log |
| 230 |
python ../tools/make-one-time-file.py --real time-of-build.log |
| 231 |
$(MAKE) report |
| 232 |
endif |
| 233 |
endif |
| 234 |
|
| 235 |
|
| 236 |
.PHONY: noop |
| 237 |
noop: ; |
| 238 |
|
| 239 |
run: $(SUBSYSTEMS) |
| 240 |
|
| 241 |
clean: |
| 242 |
rm -f trace .csdp.cache .nia.cache .lia.cache |
| 243 |
rm -f misc/universes/all_stdlib.v |
| 244 |
$(SHOW) 'RM <**/*.stamp> <**/*.vo> <**/*.log> <**/*.glob> <**/*.aux> <**/*.time>' |
| 245 |
$(HIDE)find . \( \ |
| 246 |
-name '*.stamp' -o -name '*.vo' -o -name '*.vos' -o -name '*.vok' -o -name '*.log' -o -name '*.glob' -o -name '*.aux' -o -name '*.time' \ |
| 247 |
\) -exec rm -f {} + |
| 248 |
$(SHOW) 'RM <**/*.cmx> <**/*.cmi> <**/*.o> <**/*.test>' |
| 249 |
$(HIDE)find unit-tests \( \ |
| 250 |
-name '*.cmx' -o -name '*.cmi' -o -name '*.o' -o -name '*.test' \ |
| 251 |
\) -exec rm -f {} + |
| 252 |
|
| 253 |
|
| 254 |
|
| 255 |
|
| 256 |
|
| 257 |
define vdeps |
| 258 |
$(1): $(patsubst %.v,%.v.log,$(wildcard $(1)/*.v)) |
| 259 |
endef |
| 260 |
$(foreach S,$(VSUBSYSTEMS),$(eval $(call vdeps,$(S)))) |
| 261 |
|
| 262 |
|
| 263 |
|
| 264 |
|
| 265 |
|
| 266 |
|
| 267 |
summary_dir = echo $(1); find $(2) -name '*.log' -print0 | xargs -0 -L 999 tail -q -n1 | sort |
| 268 |
|
| 269 |
.PHONY: summary summary.log |
| 270 |
|
| 271 |
summary: |
| 272 |
@{ \ |
| 273 |
$(call summary_dir, "Preparing tests", prerequisite); \ |
| 274 |
$(call summary_dir, "Success tests", success); \ |
| 275 |
$(call summary_dir, "Failure tests", failure); \ |
| 276 |
$(call summary_dir, "Bugs tests", bugs); \ |
| 277 |
$(call summary_dir, "Bugs tests (no coqchk)", bugs-nocoqchk); \ |
| 278 |
$(call summary_dir, "Output tests", output); \ |
| 279 |
$(call summary_dir, "Output tests with coqtop", output-coqtop); \ |
| 280 |
$(call summary_dir, "Output (modulo time changes) tests", output-modulo-time); \ |
| 281 |
$(call summary_dir, "Interactive tests", interactive); \ |
| 282 |
$(call summary_dir, "Miscellaneous tests", misc); \ |
| 283 |
$(call summary_dir, "Complexity tests", complexity); \ |
| 284 |
$(call summary_dir, "Module tests", modules); \ |
| 285 |
$(call summary_dir, "Primitive tests", primitive); \ |
| 286 |
$(call summary_dir, "STM tests", stm); \ |
| 287 |
$(call summary_dir, "SSR tests", ssr); \ |
| 288 |
$(call summary_dir, "IDE tests", ide); \ |
| 289 |
$(call summary_dir, "Coqchk tests", coqchk); \ |
| 290 |
$(call summary_dir, "Output tests with coqchk", output-coqchk); \ |
| 291 |
$(call summary_dir, "Coqwc tests", coqwc); \ |
| 292 |
$(call summary_dir, "Coq makefile", coq-makefile); \ |
| 293 |
$(call summary_dir, "Precomputed time tests", precomputed-time-tests); \ |
| 294 |
$(call summary_dir, "Coqdoc tests", coqdoc); \ |
| 295 |
$(call summary_dir, "tools/ tests", tools); \ |
| 296 |
$(call summary_dir, "Unit tests", unit-tests); \ |
| 297 |
$(call summary_dir, "Ltac2 tests", ltac2); \ |
| 298 |
nb_success=`grep -e $(log_success) -r . -l --include="*.log" --exclude-dir=logs | wc -l`; \ |
| 299 |
nb_failure=`grep -e $(log_failure) -r . -l --include="*.log" --exclude-dir=logs | wc -l`; \ |
| 300 |
nb_tests=`expr $$nb_success + $$nb_failure`; \ |
| 301 |
percentage=`expr 100 \* $$nb_success / $$nb_tests`; \ |
| 302 |
echo; \ |
| 303 |
echo "$$nb_success tests passed over $$nb_tests, i.e. $$percentage %"; \ |
| 304 |
} |
| 305 |
|
| 306 |
summary.log: |
| 307 |
$(SHOW) BUILDING SUMMARY FILE |
| 308 |
$(HIDE)$(MAKE) --quiet summary > "$@" |
| 309 |
|
| 310 |
report: summary.log |
| 311 |
$(HIDE)bash report.sh |
| 312 |
|
| 313 |
|
| 314 |
|
| 315 |
|
| 316 |
|
| 317 |
|
| 318 |
|
| 319 |
|
| 320 |
|
| 321 |
OCAMLOPT := $(OCAMLFIND) opt $(CAMLFLAGS) |
| 322 |
OCAMLC := $(OCAMLFIND) ocamlc $(CAMLFLAGS) |
| 323 |
|
| 324 |
|
| 325 |
UNIT_SRCFILES:=$(shell find ./unit-tests/src -name '*.ml') |
| 326 |
UNIT_ALLMLFILES:=$(shell find ./unit-tests -name '*.ml') |
| 327 |
UNIT_MLFILES:=$(filter-out $(UNIT_SRCFILES),$(UNIT_ALLMLFILES)) |
| 328 |
UNIT_LOGFILES:=$(patsubst %.ml,%.ml.log,$(UNIT_MLFILES)) |
| 329 |
|
| 330 |
ifneq ($(BEST),opt) |
| 331 |
UNIT_LINK:=utest.cmo |
| 332 |
OCAMLBEST:=$(OCAMLC) |
| 333 |
else |
| 334 |
UNIT_LINK:=utest.cmx |
| 335 |
OCAMLBEST:=$(OCAMLOPT) |
| 336 |
endif |
| 337 |
|
| 338 |
unit-tests/src/utest.cmx: unit-tests/src/utest.ml unit-tests/src/utest.cmi |
| 339 |
$(SHOW) 'OCAMLOPT $<' |
| 340 |
$(HIDE)$(OCAMLOPT) -c -I unit-tests/src -package ounit2 $< |
| 341 |
unit-tests/src/utest.cmo: unit-tests/src/utest.ml unit-tests/src/utest.cmi |
| 342 |
$(SHOW) 'OCAMLC $<' |
| 343 |
$(HIDE)$(OCAMLC) -c -I unit-tests/src -package ounit2 $< |
| 344 |
unit-tests/src/utest.cmi: unit-tests/src/utest.mli |
| 345 |
$(SHOW) 'OCAMLC $<' |
| 346 |
$(HIDE)$(OCAMLC) -package ounit2 -c $< |
| 347 |
|
| 348 |
unit-tests: $(UNIT_LOGFILES) |
| 349 |
|
| 350 |
|
| 351 |
unit-tests/%.ml.log: unit-tests/%.ml unit-tests/src/$(UNIT_LINK) |
| 352 |
$(SHOW) 'TEST $<' |
| 353 |
$(HIDE)$(OCAMLBEST) -w -29 -linkpkg -package rocq-runtime.toplevel,ounit2 \ |
| 354 |
-I unit-tests/src $(UNIT_LINK) $< -o $<.test; |
| 355 |
$(HIDE)$(call WITH_TIMER,$@,./$<.test) |
| 356 |
$(HIDE)$(call REPORT_TIMER,$@) |
| 357 |
|
| 358 |
|
| 359 |
|
| 360 |
|
| 361 |
|
| 362 |
prerequisite/requires_deprecated_library.v.log: prerequisite/deprecated_library.v.log |
| 363 |
|
| 364 |
$(addsuffix .log,$(wildcard prerequisite/*.v)): %.v.log: %.v |
| 365 |
$(SHOW) "TEST $< $(call get_coq_prog_args_in_parens,"$<")" |
| 366 |
$(HIDE){ \ |
| 367 |
echo $(call log_intro,$<); \ |
| 368 |
$(call WITH_TIMER,$@,$(coqc) "$<" $(call get_coq_prog_args,"$<") 2>&1); R=$$?; times; \ |
| 369 |
if [ $$R != 0 ]; then \ |
| 370 |
echo $(log_failure); \ |
| 371 |
echo " $< ... could not be prepared" ; \ |
| 372 |
$(FAIL); \ |
| 373 |
else \ |
| 374 |
echo $(log_success); \ |
| 375 |
echo " $< ... correctly prepared" ; \ |
| 376 |
fi; \ |
| 377 |
} > "$@" |
| 378 |
$(HIDE)$(call REPORT_TIMER,$@) |
| 379 |
|
| 380 |
$(addsuffix .log,$(wildcard bugs/*.v ssr/*.v success/*.v failure/*.v stm/*.v modules/*.v primitive/*/*.v ltac2/*.v coqchk/*.v)): %.v.log: %.v $(PREREQUISITELOG) |
| 381 |
$(SHOW) "TEST $< $(call get_coq_prog_args_in_parens,"$<")" |
| 382 |
$(HIDE){ \ |
| 383 |
opts="$(if $(findstring modules/,$<),-R modules Mods)"; \ |
| 384 |
echo $(call log_intro,$<); \ |
| 385 |
$(call WITH_TIMER,$@,$(coqc) "$<" $(call get_coq_prog_args,"$<") $$opts 2>&1); R=$$?; times; \ |
| 386 |
if [ $$R = 0 ]; then \ |
| 387 |
echo $(log_success); \ |
| 388 |
echo " $< ... Ok"; \ |
| 389 |
else \ |
| 390 |
echo $(log_failure); \ |
| 391 |
echo " $< ... Error! (should be accepted)"; \ |
| 392 |
$(FAIL); \ |
| 393 |
fi; \ |
| 394 |
} > "$@" |
| 395 |
$(HIDE)$(call REPORT_TIMER,$@) |
| 396 |
@if ! grep -q -F "Error!" $@; then $(SHOW0) "CHECK $< $(call get_coqchk_prog_args_in_parens,"$<")"; fi |
| 397 |
$(HIDE)if ! grep -q -F "Error!" $@; then { \ |
| 398 |
$(call WITH_TIMER,$(patsubst %.v.log,%.chk.log,$@),\ |
| 399 |
$(coqchk) $(call get_coqchk_prog_args,"$<") \ |
| 400 |
$(if $(findstring modules/,$<), \ |
| 401 |
-R modules Mods -norec Mods.$(shell basename $< .v), \ |
| 402 |
-Q $(shell dirname $<) "" -norec $(shell basename $< .v)) 2>&1); R=$$?; \ |
| 403 |
if [ $$R != 0 ]; then \ |
| 404 |
echo $(log_failure); \ |
| 405 |
echo " $< ... could not be checked (Error!)" ; \ |
| 406 |
$(FAIL_CHK); \ |
| 407 |
fi; \ |
| 408 |
} > "$(shell dirname $<)/$(shell basename $< .v).chk.log"; fi |
| 409 |
$(HIDE)$(call REPORT_TIMER,$(patsubst %.v.log,%.chk.log,$@)) |
| 410 |
|
| 411 |
|
| 412 |
$(addsuffix .log,$(wildcard bugs-nocoqchk/*.v)): %.v.log: %.v |
| 413 |
$(SHOW) "TEST $< $(call get_coq_prog_args_in_parens,"$<")" |
| 414 |
$(HIDE){ \ |
| 415 |
echo $(call log_intro,$<); \ |
| 416 |
$(call WITH_TIMER,$@,$(coqc) "$<" $(call get_coq_prog_args,"$<") 2>&1); R=$$?; times; \ |
| 417 |
if [ $$R = 0 ]; then \ |
| 418 |
echo $(log_success); \ |
| 419 |
echo " $< ... Ok"; \ |
| 420 |
else \ |
| 421 |
echo $(log_failure); \ |
| 422 |
echo " $< ... Error! (bug seems to be opened, please check)"; \ |
| 423 |
$(FAIL); \ |
| 424 |
fi; \ |
| 425 |
} > "$@" |
| 426 |
$(HIDE)$(call REPORT_TIMER,$@) |
| 427 |
|
| 428 |
$(addsuffix .log,$(wildcard output/*.v)): %.v.log: %.v %.out $(PREREQUISITELOG) |
| 429 |
$(SHOW) "TEST $< $(call get_coq_prog_args_in_parens,"$<")" |
| 430 |
$(HIDE){ \ |
| 431 |
echo $(call log_intro,$<); \ |
| 432 |
output=$*.out.real; \ |
| 433 |
export LC_CTYPE=C; \ |
| 434 |
export LANG=C; \ |
| 435 |
{ $(call WITH_TIMER,$@,$(coqc_interactive) "$<" $(call get_coq_prog_args,"$<") 2>&1); \ |
| 436 |
R=$$?; \ |
| 437 |
if ! [ $$R = 0 ]; then printf '\ncoqc exited with code %s\n' "$$R"; fi; \ |
| 438 |
} | grep -a -v "Welcome to Rocq" \ |
| 439 |
| grep -a -v "\[Loading ML file" \ |
| 440 |
| grep -a -v "Skipping rcfile loading" \ |
| 441 |
| grep -a -v "^<W>" \ |
| 442 |
$(CLEANUP_WINPATH) \ |
| 443 |
> $$output; \ |
| 444 |
diff -a -u --strip-trailing-cr $*.out $$output 2>&1; R=$$?; times; \ |
| 445 |
if [ $$R = 0 ]; then \ |
| 446 |
echo $(log_success); \ |
| 447 |
echo " $< ... Ok"; \ |
| 448 |
rm $$output; \ |
| 449 |
else \ |
| 450 |
echo $(log_failure); \ |
| 451 |
echo " $< ... Error! (unexpected output)"; \ |
| 452 |
$(FAIL); \ |
| 453 |
fi; \ |
| 454 |
} > "$@" |
| 455 |
$(HIDE)$(call REPORT_TIMER,$@) |
| 456 |
|
| 457 |
$(addsuffix .log,$(wildcard output-coqtop/*.v)): %.v.log: %.v %.out $(PREREQUISITELOG) |
| 458 |
$(SHOW) "TEST $< $(call get_coq_prog_args_in_parens,"$<")" |
| 459 |
$(HIDE){ \ |
| 460 |
echo $(call log_intro,$<); \ |
| 461 |
output=$*.out.real; \ |
| 462 |
$(call WITH_TIMER,$@,$(coqtop) < "$<" $(call get_coq_prog_args,"$<") 2>&1) \ |
| 463 |
| grep -v "Welcome to Rocq" \ |
| 464 |
| grep -v "\[Loading ML file" \ |
| 465 |
| grep -v "Skipping rcfile loading" \ |
| 466 |
| grep -v "^<W>" \ |
| 467 |
> $$output; \ |
| 468 |
diff -u --strip-trailing-cr $*.out $$output 2>&1; R=$$?; times; \ |
| 469 |
if [ $$R = 0 ]; then \ |
| 470 |
echo $(log_success); \ |
| 471 |
echo " $< ... Ok"; \ |
| 472 |
rm $$output; \ |
| 473 |
else \ |
| 474 |
echo $(log_failure); \ |
| 475 |
echo " $< ... Error! (unexpected output)"; \ |
| 476 |
$(FAIL); \ |
| 477 |
fi; \ |
| 478 |
} > "$@" |
| 479 |
$(HIDE)$(call REPORT_TIMER,$@) |
| 480 |
|
| 481 |
output-coqchk: $(addsuffix .log,$(wildcard output-coqchk/*.v)) |
| 482 |
$(addsuffix .log,$(wildcard output-coqchk/*.v)): %.v.log: %.v %.out $(PREREQUISITELOG) |
| 483 |
$(SHOW) "TEST $< $(call get_coq_prog_args_in_parens,"$<")" |
| 484 |
$(HIDE){ \ |
| 485 |
echo $(call log_intro,$<); \ |
| 486 |
$(call WITH_TIMER,$@,$(coqc) "$<" $(call get_coq_prog_args,"$<") 2>&1); R=$$?; times; \ |
| 487 |
if [ $$R = 0 ]; then \ |
| 488 |
echo $(log_success); \ |
| 489 |
echo " $< ... Ok"; \ |
| 490 |
else \ |
| 491 |
echo $(log_failure); \ |
| 492 |
echo " $< ... Error! (should be accepted)"; \ |
| 493 |
$(FAIL); \ |
| 494 |
fi; \ |
| 495 |
} > "$@" |
| 496 |
$(HIDE)$(call REPORT_TIMER,$@) |
| 497 |
@if ! grep -q -F "Error!" $@; then $(SHOW0) "CHECK $< $(call get_coqchk_prog_args_in_parens,"$<")"; fi |
| 498 |
$(HIDE)if ! grep -q -F "Error!" $@; then { \ |
| 499 |
echo $(call log_intro,$<); \ |
| 500 |
output=$*.out.real; \ |
| 501 |
export LC_CTYPE=C; \ |
| 502 |
export LANG=C; \ |
| 503 |
$(call WITH_TIMER,$(patsubst %.v.log,%.chk.log,$@),$(coqchk) -o -silent $(call get_coqchk_prog_args,"$<") -Q $(shell dirname $<) "" -norec $(shell basename $< .v) > $$output 2>&1) ; \ |
| 504 |
diff -a -u --strip-trailing-cr $*.out $$output 2>&1; R=$$?; times; \ |
| 505 |
if [ $$R = 0 ]; then \ |
| 506 |
echo $(log_success); \ |
| 507 |
echo " $< ... Ok"; \ |
| 508 |
rm $$output; \ |
| 509 |
else \ |
| 510 |
echo $(log_failure); \ |
| 511 |
echo " $< ... Error! (unexpected output)"; \ |
| 512 |
$(FAIL); \ |
| 513 |
fi; \ |
| 514 |
} > "$(shell dirname $<)/$(shell basename $< .v).chk.log"; fi |
| 515 |
$(HIDE)$(call REPORT_TIMER,$(patsubst %.v.log,%.chk.log,$@)) |
| 516 |
|
| 517 |
.PHONY: approve-output |
| 518 |
approve-output: output output-coqtop output-coqchk |
| 519 |
$(HIDE)for f in $(addsuffix /*.out.real,$^); do if [ -f "$$f" ]; then \ |
| 520 |
mv "$$f" "$${f%.real}"; \ |
| 521 |
echo "Updated $${f%.real}!"; \ |
| 522 |
fi; done |
| 523 |
|
| 524 |
approve-coqdoc: coqdoc |
| 525 |
$(HIDE)(cd coqdoc; \ |
| 526 |
for f in *.html.out; do if [ -f "$$f" ]; then \ |
| 527 |
cp "Coqdoc.$${f%.out}" "$$f"; \ |
| 528 |
echo "Updated $$f!"; \ |
| 529 |
fi; done; \ |
| 530 |
for f in *.tex.out; do if [ -f "$$f" ]; then \ |
| 531 |
cat "Coqdoc.$${f%.out}" | grep -v "^%%" > "$$f"; \ |
| 532 |
echo "Updated $$f!"; \ |
| 533 |
fi; done) |
| 534 |
|
| 535 |
$(addsuffix .log,$(wildcard output-modulo-time/*.v)): %.v.log: %.v %.out |
| 536 |
$(SHOW) "TEST $< $(call get_coq_prog_args_in_parens,"$<")" |
| 537 |
$(HIDE){ \ |
| 538 |
echo $(call log_intro,$<); \ |
| 539 |
tmpoutput=`mktemp`; \ |
| 540 |
tmpexpected=`mktemp`; \ |
| 541 |
$(call WITH_TIMER,$@,$(coqc_interactive) "$<" $(call get_coq_prog_args,"$<") 2>&1) \ |
| 542 |
| grep -v "Welcome to Rocq" \ |
| 543 |
| grep -v "\[Loading ML file" \ |
| 544 |
| grep -v "Skipping rcfile loading" \ |
| 545 |
| grep -v "^<W>" \ |
| 546 |
| sed -e 's/\s*[-+0-9]*\.[0-9][0-9]*\s*//g' \ |
| 547 |
-e 's/\s*0\.\s*//g' \ |
| 548 |
-e 's/\s*[-+]nan\s*//g' \ |
| 549 |
-e 's/\s*[-+]inf\s*//g' \ |
| 550 |
-e 's/^[^a-zA-Z]*//' \ |
| 551 |
| sort \ |
| 552 |
> $$tmpoutput; \ |
| 553 |
sed -e 's/\s*[-+0-9]*\.[0-9][0-9]*\s*//g' \ |
| 554 |
-e 's/\s*0\.\s*//g' \ |
| 555 |
-e 's/\s*[-+]nan\s*//g' \ |
| 556 |
-e 's/\s*[-+]inf\s*//g' \ |
| 557 |
-e 's/^[^a-zA-Z]*//' \ |
| 558 |
$*.out | sort > $$tmpexpected; \ |
| 559 |
diff --strip-trailing-cr -b -u $$tmpexpected $$tmpoutput 2>&1; R=$$?; times; \ |
| 560 |
if [ $$R = 0 ]; then \ |
| 561 |
echo $(log_success); \ |
| 562 |
echo " $< ... Ok"; \ |
| 563 |
else \ |
| 564 |
echo $(log_failure); \ |
| 565 |
echo " $< ... Error! (unexpected output)"; \ |
| 566 |
$(FAIL); \ |
| 567 |
fi; \ |
| 568 |
rm $$tmpoutput; \ |
| 569 |
rm $$tmpexpected; \ |
| 570 |
} > "$@" |
| 571 |
$(HIDE)$(call REPORT_TIMER,$@) |
| 572 |
|
| 573 |
$(addsuffix .log,$(wildcard interactive/*.v)): %.v.log: %.v $(PREREQUISITELOG) |
| 574 |
$(SHOW) "TEST $< $(call get_coq_prog_args_in_parens,"$<")" |
| 575 |
$(HIDE){ \ |
| 576 |
echo $(call log_intro,$<); \ |
| 577 |
$(call WITH_TIMER,$@,$(coqtop) $(call get_coq_prog_args,"$<") < "$<" 2>&1); R=$$?; times; \ |
| 578 |
if [ $$R = 0 ]; then \ |
| 579 |
echo $(log_success); \ |
| 580 |
echo " $< ... Ok"; \ |
| 581 |
else \ |
| 582 |
echo $(log_failure); \ |
| 583 |
echo " $< ... Error! (should be accepted)"; \ |
| 584 |
$(FAIL); \ |
| 585 |
fi; \ |
| 586 |
} > "$@" |
| 587 |
$(HIDE)$(call REPORT_TIMER,$@) |
| 588 |
|
| 589 |
|
| 590 |
|
| 591 |
|
| 592 |
ifneq (,$(bogomips)) |
| 593 |
$(addsuffix .log,$(wildcard complexity/*.v)): %.v.log: %.v $(PREREQUISITELOG) |
| 594 |
$(SHOW) "TEST $< $(call get_coq_prog_args_in_parens,"$<")" |
| 595 |
$(HIDE){ \ |
| 596 |
echo $(call log_intro,$<); \ |
| 597 |
true "extract effective user time"; \ |
| 598 |
res=`$(call WITH_TIMER,$@,$(coqc_interactive) "$<" $(call get_coq_prog_args,"$<") 2>&1) | sed -n -e "s/Finished .*transaction in .*(\([0-9]*\.[0-9]*\)u.*)/\1/p" | head -1 | sed "s/\r//g"`; \ |
| 599 |
R=$$?; times; \ |
| 600 |
if [ $$R != 0 ]; then \ |
| 601 |
echo $(log_failure); \ |
| 602 |
echo " $< ... Error! (should be accepted)" ; \ |
| 603 |
$(FAIL); \ |
| 604 |
elif [ "$$res" = "" ]; then \ |
| 605 |
echo $(log_failure); \ |
| 606 |
echo " $< ... Error! (couldn't find a time measure)"; \ |
| 607 |
$(FAIL); \ |
| 608 |
else \ |
| 609 |
true "express effective time in centiseconds"; \ |
| 610 |
resorig="$$res"; \ |
| 611 |
res=`echo "$$res"00 | sed -n -e "s/\([0-9]*\)\.\([0-9][0-9]\).*/\1\2/p"`; \ |
| 612 |
if [ "$$res" = "" ]; then \ |
| 613 |
echo $(log_failure); \ |
| 614 |
echo " $< ... Error! (invalid time measure: $$resorig)"; \ |
| 615 |
else \ |
| 616 |
true "find expected time * 100"; \ |
| 617 |
exp=`sed -n -e "s/(\*.*Expected time < \([0-9]\).\([0-9][0-9]\)s.*\*)/\1\2/p" "$<"`; \ |
| 618 |
true "compute corrected effective time, rounded up"; \ |
| 619 |
rescorrected=`expr \( $$res \* $(bogomips) + 6120 - 1 \) / 6120`; \ |
| 620 |
ok=`expr \( $$res \* $(bogomips) \) "<" \( $$exp \* 6120 \)`; \ |
| 621 |
if [ "$$ok" = 1 ]; then \ |
| 622 |
echo $(log_success); \ |
| 623 |
echo " $< ... Ok"; \ |
| 624 |
else \ |
| 625 |
echo $(log_failure); \ |
| 626 |
echo " $< ... Error! (should run faster ($$rescorrected >= $$exp))"; \ |
| 627 |
$(FAIL); \ |
| 628 |
fi; \ |
| 629 |
fi; \ |
| 630 |
fi; \ |
| 631 |
} > "$@" |
| 632 |
$(HIDE)$(call REPORT_TIMER,$@) |
| 633 |
endif |
| 634 |
|
| 635 |
|
| 636 |
$(addsuffix .log,$(wildcard ideal-features/*.v)): %.v.log: %.v $(PREREQUISITELOG) |
| 637 |
$(SHOW) "TEST $< $(call get_coq_prog_args_in_parens,"$<")" |
| 638 |
$(HIDE){ \ |
| 639 |
echo $(call log_intro,$<); \ |
| 640 |
$(call WITH_TIMER,$@,$(coqc) "$<" $(call get_coq_prog_args,"$<") 2>&1); R=$$?; times; \ |
| 641 |
if [ $$R != 0 ]; then \ |
| 642 |
echo $(log_success); \ |
| 643 |
echo " $< ... still wished"; \ |
| 644 |
else \ |
| 645 |
echo $(log_failure); \ |
| 646 |
echo " $< ... Good news! (wish seems to be granted, please check)"; \ |
| 647 |
$(FAIL); \ |
| 648 |
fi; \ |
| 649 |
} > "$@" |
| 650 |
$(HIDE)$(call REPORT_TIMER,$@) |
| 651 |
|
| 652 |
|
| 653 |
COMMON_MODULE_DEPENDENCIES := modules/plik.v |
| 654 |
|
| 655 |
|
| 656 |
|
| 657 |
|
| 658 |
$(addsuffix .log,$(filter-out $(COMMON_MODULE_DEPENDENCIES),$(wildcard modules/*.v))): %.v.log: $(COMMON_MODULE_DEPENDENCIES:.v=.v.log) |
| 659 |
|
| 660 |
|
| 661 |
|
| 662 |
|
| 663 |
|
| 664 |
misc: $(patsubst %.sh,%.log,$(wildcard misc/*.sh)) |
| 665 |
|
| 666 |
misc/universes.log: misc/universes/all_stdlib.v |
| 667 |
|
| 668 |
misc/universes/all_stdlib.v: |
| 669 |
$(SHOW) 'build_all_stdlib' |
| 670 |
$(HIDE)cd misc/universes && ./build_all_stdlib.sh > all_stdlib.v |
| 671 |
|
| 672 |
$(patsubst %.sh,%.log,$(wildcard misc/*.sh)): %.log: %.sh $(PREREQUISITELOG) |
| 673 |
$(SHOW) "TEST $<" |
| 674 |
$(HIDE){ \ |
| 675 |
echo $(call log_intro,$<); \ |
| 676 |
export BIN=$(BIN); \ |
| 677 |
export coqc="eval $(coqc)"; \ |
| 678 |
export coqdep="eval $(coqdep)"; \ |
| 679 |
$(call WITH_TIMER,$@,"$<" 2>&1); R=$$?; times; \ |
| 680 |
if [ $$R = 0 ]; then \ |
| 681 |
echo $(log_success); \ |
| 682 |
echo " $< ... Ok"; \ |
| 683 |
else \ |
| 684 |
echo $(log_failure); \ |
| 685 |
echo " $< ... Error!"; \ |
| 686 |
$(FAIL); \ |
| 687 |
fi; \ |
| 688 |
} > "$@" |
| 689 |
$(HIDE)$(call REPORT_TIMER,$@) |
| 690 |
|
| 691 |
|
| 692 |
|
| 693 |
ide : $(patsubst %.fake,%.fake.log,$(wildcard ide/*.fake)) |
| 694 |
|
| 695 |
ide/fake_ide.exe : ide/fake_ide.ml |
| 696 |
$(SHOW) 'OCAMLC $<' |
| 697 |
$(HIDE)$(OCAMLBEST) -linkpkg -package coqide-server.protocol -package coqide-server.core $< -o $@ |
| 698 |
|
| 699 |
%.fake.log : %.fake ide/fake_ide.exe |
| 700 |
$(SHOW) "TEST $<" |
| 701 |
$(HIDE){ \ |
| 702 |
echo $(call log_intro,$<); \ |
| 703 |
$(call WITH_TIMER,$@,ide/fake_ide.exe $(coqidetop) "$<" "-q -async-proofs on -async-proofs-tactic-error-resilience off -async-proofs-command-error-resilience off $(call get_coq_prog_args,"$<")" 2>&1); \ |
| 704 |
if [ $$? = 0 ]; then \ |
| 705 |
echo $(log_success); \ |
| 706 |
echo " $< ... Ok"; \ |
| 707 |
else \ |
| 708 |
echo $(log_failure); \ |
| 709 |
echo " $< ... Error!"; \ |
| 710 |
$(FAIL); \ |
| 711 |
fi; \ |
| 712 |
} > "$@" |
| 713 |
$(HIDE)$(call REPORT_TIMER,$@) |
| 714 |
|
| 715 |
|
| 716 |
|
| 717 |
coqwc : $(patsubst %.v,%.v.log,$(wildcard coqwc/*.v)) |
| 718 |
|
| 719 |
coqwc/%.v.log : coqwc/%.v |
| 720 |
$(HIDE){ \ |
| 721 |
echo $(call log_intro,$<); \ |
| 722 |
tmpoutput=`mktemp`; \ |
| 723 |
$(BIN)rocq wc $< 2>&1 > $$tmpoutput; \ |
| 724 |
diff -u --strip-trailing-cr coqwc/$*.out $$tmpoutput 2>&1; R=$$?; times; \ |
| 725 |
if [ $$R = 0 ]; then \ |
| 726 |
echo $(log_success); \ |
| 727 |
echo " $< ... Ok"; \ |
| 728 |
else \ |
| 729 |
echo $(log_failure); \ |
| 730 |
echo " $< ... Error! (unexpected output)"; \ |
| 731 |
$(FAIL); \ |
| 732 |
fi; \ |
| 733 |
rm $$tmpoutput; \ |
| 734 |
} > "$@" |
| 735 |
|
| 736 |
|
| 737 |
|
| 738 |
coq-makefile: $(patsubst %/run.sh,%.log,$(wildcard coq-makefile/*/run.sh)) |
| 739 |
precomputed-time-tests: $(patsubst %/run.sh,%.log,$(wildcard precomputed-time-tests/*/run.sh)) |
| 740 |
|
| 741 |
$(patsubst %/run.sh,%.log,$(wildcard coq-makefile/*/run.sh precomputed-time-tests/*/run.sh)): %.log: %/run.sh |
| 742 |
$(SHOW) "TEST $*" |
| 743 |
$(HIDE)(\ |
| 744 |
export COQBIN=$(BIN);\ |
| 745 |
export COQPREFIX=$(COQPREFIX);\ |
| 746 |
cd $* && \ |
| 747 |
$(call WITH_TIMER,$@,bash run.sh 2>&1,../../[email protected]); \ |
| 748 |
if [ $$? = 0 ]; then \ |
| 749 |
echo $(log_success); \ |
| 750 |
echo " $< ... Ok"; \ |
| 751 |
else \ |
| 752 |
echo $(log_failure); \ |
| 753 |
echo " $< ... Error!"; \ |
| 754 |
$(FAIL); \ |
| 755 |
fi; \ |
| 756 |
) > "$@" |
| 757 |
$(HIDE)$(call REPORT_TIMER,$@) |
| 758 |
|
| 759 |
|
| 760 |
|
| 761 |
$(addsuffix .log,$(wildcard coqdoc/*.v)): %.v.log: %.v %.html.out %.tex.out $(PREREQUISITELOG) |
| 762 |
$(SHOW) "TEST $< $(call get_coq_prog_args_in_parens,"$<")" |
| 763 |
$(HIDE){ \ |
| 764 |
echo $(call log_intro,$<); \ |
| 765 |
$(coqc) -R coqdoc Coqdoc $* 2>&1; \ |
| 766 |
cd coqdoc; \ |
| 767 |
f=`basename $*`; \ |
| 768 |
$(coqdoc) -utf8 -R . Coqdoc -coqlib_url http://coq.inria.fr/stdlib --html $$f.v 2>&1; \ |
| 769 |
$(coqdoc) -utf8 -R . Coqdoc -coqlib_url http://coq.inria.fr/stdlib --latex $$f.v 2>&1; \ |
| 770 |
diff -u --strip-trailing-cr $$f.html.out Coqdoc.$$f.html 2>&1; R=$$?; times; \ |
| 771 |
grep -v "^%%" Coqdoc.$$f.tex | diff -u --strip-trailing-cr $$f.tex.out - 2>&1; S=$$?; times; \ |
| 772 |
if [ $$R = 0 -a $$S = 0 ]; then \ |
| 773 |
echo $(log_success); \ |
| 774 |
echo " $< ... Ok"; \ |
| 775 |
else \ |
| 776 |
echo $(log_failure); \ |
| 777 |
echo " $< ... Error! (unexpected output)"; \ |
| 778 |
$(FAIL); \ |
| 779 |
fi; \ |
| 780 |
} > "$@" |
| 781 |
|
| 782 |
|
| 783 |
|
| 784 |
tools: $(patsubst %/run.sh,%.log,$(wildcard tools/*/run.sh)) |
| 785 |
|
| 786 |
tools/%.log : tools/%/run.sh |
| 787 |
$(SHOW) "TEST tools/$*" |
| 788 |
$(HIDE)(\ |
| 789 |
export COQBIN=$(BIN);\ |
| 790 |
cd tools/$* && \ |
| 791 |
bash run.sh 2>&1; \ |
| 792 |
if [ $$? = 0 ]; then \ |
| 793 |
echo $(log_success); \ |
| 794 |
echo " $< ... Ok"; \ |
| 795 |
else \ |
| 796 |
echo $(log_failure); \ |
| 797 |
echo " $< ... Error!"; \ |
| 798 |
$(FAIL); \ |
| 799 |
fi; \ |
| 800 |
) > "$@" |