summaryrefslogtreecommitdiff
path: root/ocaml-binary-annot/testsuite/Makefile
blob: d7a975699c2a5786e1175fcf86d6cdcd67fe08e3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
# $Id$

BASEDIR=${PWD}
NO_PRINT=`($(MAKE) empty --no-print-directory > /dev/null 2>&1) && echo '--no-print-directory' || echo ''`

default:
	@echo "Available targets:"
	@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 "  lib           builds library modules"
	@echo "  clean         deletes generated files"
	@echo "  report        prints the report for the last execution, if any"

all: lib
	@for dir in tests/*; do \
	  $(MAKE) $(NO_PRINT) exec-one DIR=$$dir; \
	done 2>&1 | tee _log
	@$(MAKE) report

list: lib
	@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 \
	  $(MAKE) $(NO_PRINT) exec-one DIR=$$LINE; \
	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
	@$(MAKE) $(NO_PRINT) exec-one DIR=$(DIR)

exec-one:
	@echo "Running tests from '$$DIR' ..."
	@(cd $(DIR) && $(MAKE) TERM=dumb BASEDIR=$(BASEDIR) && cd ../..)

lib: FORCE
	@(cd lib && $(MAKE) -s BASEDIR=$(BASEDIR) && cd ..)

clean: FORCE
	@(cd lib && $(MAKE) BASEDIR=$(BASEDIR) clean && cd ..)
	@for file in tests/*; do \
	  if [ -d $$file ]; then \
	    (cd $$file && $(MAKE) BASEDIR=$(BASEDIR) clean && cd ../..); \
	  fi \
	done
	@for file in interactive/*; do \
	  if [ -d $$file ]; then \
	    (cd $$file && $(MAKE) BASEDIR=$(BASEDIR) clean && cd ../..); \
	  fi \
	done

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)'

empty: FORCE

FORCE: