2012-10-17 13:09:16 -07:00
|
|
|
#########################################################################
|
|
|
|
# #
|
|
|
|
# OCaml #
|
|
|
|
# #
|
|
|
|
# Xavier Clerc, SED, INRIA Rocquencourt #
|
|
|
|
# #
|
|
|
|
# Copyright 2010 Institut National de Recherche en Informatique et #
|
|
|
|
# en Automatique. All rights reserved. This file is distributed #
|
|
|
|
# under the terms of the Q Public License version 1.0. #
|
|
|
|
# #
|
|
|
|
#########################################################################
|
|
|
|
|
2013-12-05 02:15:29 -08:00
|
|
|
BASEDIR := $(shell pwd)
|
2013-05-07 02:39:38 -07:00
|
|
|
NO_PRINT=`$(MAKE) empty --no-print-directory >/dev/null 2>&1 && echo '--no-print-directory'`
|
|
|
|
|
|
|
|
FIND=find
|
|
|
|
include ../config/Makefile
|
2010-01-25 05:47:28 -08:00
|
|
|
|
2013-05-14 10:05:21 -07:00
|
|
|
.PHONY: default
|
2010-01-25 05:47:28 -08:00
|
|
|
default:
|
|
|
|
@echo "Available targets:"
|
2013-05-15 00:43:59 -07:00
|
|
|
@echo " all launch all tests"
|
|
|
|
@echo " list FILE=f launch the tests referenced in file f (one path per line)"
|
|
|
|
@echo " one DIR=p launch the tests located in path p"
|
2013-05-14 10:05:21 -07:00
|
|
|
@echo " promote DIR=p promote the reference files for the tests located in path p"
|
|
|
|
@echo " lib build library modules"
|
|
|
|
@echo " clean delete generated files"
|
|
|
|
@echo " report print the report for the last execution, if any"
|
2010-01-25 05:47:28 -08:00
|
|
|
|
2013-05-14 10:05:21 -07:00
|
|
|
.PHONY: all
|
2010-06-18 02:41:15 -07:00
|
|
|
all: lib
|
2010-01-25 05:47:28 -08:00
|
|
|
@for dir in tests/*; do \
|
2010-05-19 05:32:00 -07:00
|
|
|
$(MAKE) $(NO_PRINT) exec-one DIR=$$dir; \
|
2010-01-25 05:47:28 -08:00
|
|
|
done 2>&1 | tee _log
|
|
|
|
@$(MAKE) report
|
|
|
|
|
2013-05-14 10:05:21 -07:00
|
|
|
.PHONY: list
|
2010-06-18 02:41:15 -07:00
|
|
|
list: lib
|
2013-05-07 02:39:38 -07:00
|
|
|
@if [ -z "$(FILE)" ]; \
|
|
|
|
then echo "No value set for variable 'FILE'."; \
|
|
|
|
exit 1; \
|
|
|
|
fi
|
2010-01-25 05:47:28 -08:00
|
|
|
@while read LINE; do \
|
2010-05-19 05:32:00 -07:00
|
|
|
$(MAKE) $(NO_PRINT) exec-one DIR=$$LINE; \
|
2013-05-07 02:39:38 -07:00
|
|
|
done <$(FILE) 2>&1 | tee _log
|
2010-01-25 05:47:28 -08:00
|
|
|
@$(MAKE) report
|
|
|
|
|
2013-05-14 10:05:21 -07:00
|
|
|
.PHONY: one
|
2010-01-25 05:47:28 -08:00
|
|
|
one: lib
|
2013-05-07 02:39:38 -07:00
|
|
|
@if [ -z "$(DIR)" ]; then \
|
|
|
|
echo "No value set for variable 'DIR'."; \
|
|
|
|
exit 1; \
|
|
|
|
fi
|
|
|
|
@if [ ! -d $(DIR) ]; then \
|
|
|
|
echo "Directory '$(DIR)' does not exist."; \
|
|
|
|
exit 1; \
|
|
|
|
fi
|
2010-05-19 05:32:00 -07:00
|
|
|
@$(MAKE) $(NO_PRINT) exec-one DIR=$(DIR)
|
|
|
|
|
2013-05-14 10:05:21 -07:00
|
|
|
.PHONY: exec-one
|
2010-05-19 05:32:00 -07:00
|
|
|
exec-one:
|
2011-06-15 01:13:13 -07:00
|
|
|
@if [ ! -f $(DIR)/Makefile ]; then \
|
|
|
|
for dir in $(DIR)/*; do \
|
|
|
|
if [ -d $$dir ]; then \
|
|
|
|
$(MAKE) exec-one DIR=$$dir; \
|
|
|
|
fi; \
|
|
|
|
done; \
|
2013-05-29 09:45:07 -07:00
|
|
|
else \
|
2011-06-15 01:13:13 -07:00
|
|
|
echo "Running tests from '$$DIR' ..."; \
|
2013-04-29 06:01:02 -07:00
|
|
|
cd $(DIR) && \
|
|
|
|
$(MAKE) TERM=dumb BASEDIR=$(BASEDIR) || echo '=> unexpected error'; \
|
2011-06-15 01:13:13 -07:00
|
|
|
fi
|
2010-01-25 05:47:28 -08:00
|
|
|
|
2013-05-07 02:39:38 -07:00
|
|
|
.PHONY: promote
|
|
|
|
promote:
|
|
|
|
@if [ -z "$(DIR)" ]; then \
|
|
|
|
echo "No value set for variable 'DIR'."; \
|
|
|
|
exit 1; \
|
|
|
|
fi
|
|
|
|
@if [ ! -d $(DIR) ]; then \
|
|
|
|
echo "Directory '$(DIR)' does not exist."; \
|
|
|
|
exit 1; \
|
|
|
|
fi
|
|
|
|
@cd $(DIR) && $(MAKE) TERM=dumb BASEDIR=$(BASEDIR) promote
|
2011-06-15 05:14:14 -07:00
|
|
|
|
2013-05-07 02:39:38 -07:00
|
|
|
.PHONY: lib
|
|
|
|
lib:
|
|
|
|
@cd lib && $(MAKE) -s BASEDIR=$(BASEDIR)
|
2010-01-25 05:47:28 -08:00
|
|
|
|
2013-05-07 02:39:38 -07:00
|
|
|
.PHONY: clean
|
|
|
|
clean:
|
|
|
|
@cd lib && $(MAKE) BASEDIR=$(BASEDIR) clean
|
|
|
|
@for file in `$(FIND) interactive tests -name Makefile`; do \
|
2011-06-15 01:13:13 -07:00
|
|
|
(cd `dirname $$file` && $(MAKE) BASEDIR=$(BASEDIR) clean); \
|
2010-04-08 05:44:07 -07:00
|
|
|
done
|
2010-01-25 05:47:28 -08:00
|
|
|
|
2013-05-07 02:39:38 -07:00
|
|
|
.PHONY: report
|
|
|
|
report:
|
2010-01-25 05:47:28 -08:00
|
|
|
@if [ ! -f _log ]; then echo "No '_log' file."; exit 1; fi
|
2013-04-29 06:01:02 -07:00
|
|
|
@awk -f makefiles/summarize.awk <_log
|
2010-01-25 05:47:28 -08:00
|
|
|
|
2013-05-07 02:39:38 -07:00
|
|
|
.PHONY: empty
|
|
|
|
empty:
|