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. #
|
|
|
|
# #
|
|
|
|
#########################################################################
|
|
|
|
|
2010-03-25 07:51:49 -07:00
|
|
|
BASEDIR=${PWD}
|
2010-05-05 03:03:17 -07:00
|
|
|
NO_PRINT=`($(MAKE) empty --no-print-directory > /dev/null 2>&1) && echo '--no-print-directory' || echo ''`
|
2010-01-25 05:47:28 -08:00
|
|
|
|
|
|
|
default:
|
|
|
|
@echo "Available targets:"
|
2011-06-15 05:14:14 -07:00
|
|
|
@echo " all launches all tests"
|
|
|
|
@echo " list FILE=f launches the tests referenced in file f (one path per line)"
|
|
|
|
@echo " one DIR=p launches the tests located in path p"
|
|
|
|
@echo " promote DIR=p promotes the reference files for the tests located in path p"
|
|
|
|
@echo " lib builds library modules"
|
|
|
|
@echo " clean deletes generated files"
|
|
|
|
@echo " report prints the report for the last execution, if any"
|
2010-01-25 05:47:28 -08:00
|
|
|
|
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
|
|
|
|
|
2010-06-18 02:41:15 -07:00
|
|
|
list: lib
|
2010-01-25 05:47:28 -08:00
|
|
|
@if [ -z $(FILE) ]; then echo "No value set for variable 'FILE'."; exit 1; fi
|
|
|
|
@if [ ! -f $(FILE) ]; then echo "File '$(FILE)' does not exist."; exit 1; fi
|
|
|
|
@while read LINE; do \
|
2010-05-19 05:32:00 -07:00
|
|
|
$(MAKE) $(NO_PRINT) exec-one DIR=$$LINE; \
|
2010-01-25 05:47:28 -08:00
|
|
|
done < $(FILE) 2>&1 | tee _log
|
|
|
|
@$(MAKE) report
|
|
|
|
|
|
|
|
one: lib
|
|
|
|
@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)
|
|
|
|
|
|
|
|
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; \
|
|
|
|
else \
|
|
|
|
echo "Running tests from '$$DIR' ..."; \
|
|
|
|
(cd $(DIR) && $(MAKE) TERM=dumb BASEDIR=$(BASEDIR)); \
|
|
|
|
fi
|
2010-01-25 05:47:28 -08:00
|
|
|
|
2011-06-15 05:14:14 -07:00
|
|
|
promote: FORCE
|
|
|
|
@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)
|
|
|
|
|
2010-01-25 05:47:28 -08:00
|
|
|
lib: FORCE
|
2011-06-15 01:13:13 -07:00
|
|
|
@(cd lib && $(MAKE) -s BASEDIR=$(BASEDIR))
|
2010-01-25 05:47:28 -08:00
|
|
|
|
|
|
|
clean: FORCE
|
2011-06-15 01:13:13 -07:00
|
|
|
@(cd lib && $(MAKE) BASEDIR=$(BASEDIR) clean)
|
|
|
|
@for file in `find interactive tests -name Makefile`; do \
|
|
|
|
(cd `dirname $$file` && $(MAKE) BASEDIR=$(BASEDIR) clean); \
|
2010-04-08 05:44:07 -07:00
|
|
|
done
|
2010-01-25 05:47:28 -08:00
|
|
|
|
|
|
|
report: FORCE
|
|
|
|
@if [ ! -f _log ]; then echo "No '_log' file."; exit 1; fi
|
|
|
|
@echo ''
|
|
|
|
@echo 'Summary:'
|
|
|
|
@echo ' ' `grep 'passed$$' _log | wc -l` 'test(s) passed'
|
|
|
|
@echo ' ' `grep 'failed$$' _log | wc -l` 'test(s) failed'
|
|
|
|
@echo ' ' `grep '^Error' _log | wc -l` 'compilation error(s)'
|
|
|
|
@echo ' ' `grep '^Warning' _log | wc -l` 'compilation warning(s)'
|
2011-07-21 00:13:25 -07:00
|
|
|
@echo ' ' `grep '^make\[2\]: ' _log | wc -l` 'makefile error(s)'
|
2010-01-25 05:47:28 -08:00
|
|
|
|
2010-05-05 03:03:17 -07:00
|
|
|
empty: FORCE
|
|
|
|
|
2010-01-25 05:47:28 -08:00
|
|
|
FORCE:
|