|
13 | 13 | include $(TESTSROOTDIR)/Makefile.common
|
14 | 14 |
|
15 | 15 | # List of disabled tests
|
16 |
| -DISABLED_TESTS:=$(shell awk '/^DISABLED/{f=1;next};/<END>/{f=0}f' TODO | cut -d' ' -f1) |
| 16 | +DISABLED_TESTS:=$(shell awk '/^DISABLED TESTS/{f=1;next};/^END DISABLED/{f=0}f' TODO | cut -d' ' -f1) |
| 17 | + |
| 18 | +# List of serial tests |
| 19 | +SERIAL_TESTS:=$(shell awk '/^SERIAL TESTS/{f=1;next};/^END SERIAL/{f=0}f' TODO | cut -d' ' -f1) |
17 | 20 |
|
18 | 21 | # When SKIPSSL is on, skip running tests which rely on SSL
|
19 | 22 | ifeq ($(SKIPSSL),1)
|
@@ -41,41 +44,56 @@ ifeq ($(subst all,,$(MAKECMDGOALS)),) #if cmdgoals empty or 'all'
|
41 | 44 | DOALL:=1
|
42 | 45 | endif
|
43 | 46 |
|
44 |
| -# List of all tests that need to run. |
| 47 | +.PHONY: all all_tests all_nonserial_tests all_serial_tests |
| 48 | + |
| 49 | +all_tests: all_nonserial_tests all_serial_tests |
| 50 | +all: init basicops all_tests |
| 51 | + |
| 52 | +CANON_SERIAL := $(patsubst %.test,%, $(SERIAL_TESTS)) |
| 53 | + |
| 54 | +# Read alltests.txt if present |
45 | 55 | ifeq ($(wildcard alltests.txt),alltests.txt)
|
46 |
| - # If file alltests.txt exists, only run the tests in that file (one line per test) |
47 |
| - export ALL_TESTS:=$(patsubst %.test, %, $(shell sort -u alltests.txt) ) |
| 56 | + SELECTED := $(patsubst %.test,%, \ |
| 57 | + $(shell awk 'NF && $$1 !~ /^#/' alltests.txt | sed 's/[[:space:]]\+.*//' )) |
| 58 | + # Ignore DISABLED if using alltests.txt |
| 59 | + ALL_SERIAL_TESTS := $(filter $(CANON_SERIAL),$(SELECTED)) # preserves order of SELECTED |
| 60 | + ALL_TESTS := $(filter-out $(ALL_SERIAL_TESTS),$(SELECTED)) |
48 | 61 | else
|
49 |
| - ifneq ($(DISABLED_TESTS),) |
50 |
| - DISABLED_TESTS:=" $(shell echo $(DISABLED_TESTS) | tr ' ' '\n' | sort -u) " |
51 |
| - endif |
52 |
| - |
| 62 | + DISABLED_TESTS := $(strip $(sort $(DISABLED_TESTS))) |
| 63 | + CANON_DISABLED := $(patsubst %.test,%, $(DISABLED_TESTS)) |
53 | 64 | ifeq ($(INCLUDE_LONG_RUNNING),1)
|
54 | 65 | FLG=
|
55 | 66 | else
|
56 | 67 | # by default exclude all tests which run longer than 1 hour
|
57 | 68 | FLG=--skip-long-running
|
58 | 69 | endif
|
| 70 | + ALL_CANDIDATES := $(patsubst %.test,%, $(shell $(TESTSROOTDIR)/tools/get_tests_inorder.sh $(FLG))) |
59 | 71 |
|
60 |
| - # This is the list of all non-disabled tests. |
61 |
| - export ALL_TESTS:=$(patsubst %.test, %, $(filter-out $(DISABLED_TESTS), \ |
62 |
| - $(shell $(TESTSROOTDIR)/tools/get_tests_inorder.sh $(FLG)))) |
| 72 | + ALL_SERIAL_TESTS := $(filter-out $(CANON_DISABLED), $(CANON_SERIAL)) |
| 73 | + ALL_TESTS := $(filter-out $(ALL_SERIAL_TESTS) $(CANON_DISABLED), $(ALL_CANDIDATES)) |
63 | 74 | endif
|
64 | 75 |
|
| 76 | +# ----- execution ----- |
| 77 | +all_nonserial_tests: $(ALL_TESTS) |
| 78 | + @echo "Non-serial tests complete" |
| 79 | + |
| 80 | +all_serial_tests: all_nonserial_tests |
| 81 | + @echo "Running serial tests: $(ALL_SERIAL_TESTS)" |
| 82 | + @set -e; \ |
| 83 | + for t in $(ALL_SERIAL_TESTS); do \ |
| 84 | + $(MAKE) --no-print-directory $$t; \ |
| 85 | + done |
| 86 | + |
65 | 87 | # get number of TOTAL tests running: used for printing progress report of tests
|
66 | 88 | TOTAL=$(words $(MAKECMDGOALS) )
|
67 | 89 | ifeq ($(DOALL),1)
|
68 | 90 | TOTAL=$(words $(ALL_TESTS) )
|
69 | 91 | endif
|
70 | 92 |
|
71 |
| -all: init basicops all_tests |
72 | 93 |
|
73 | 94 | init:
|
74 | 95 | @mkdir -p ${TESTDIR}
|
75 | 96 |
|
76 |
| -# Run all non-disabled tests. |
77 |
| -all_tests: $(ALL_TESTS) |
78 |
| - |
79 | 97 | basicops_nokey: init
|
80 | 98 | $(shell which git > /dev/null 2>&1 && git rev-parse --abbrev-ref HEAD | xargs echo "Branch" >> ${TESTDIR}/test.log)
|
81 | 99 | $(shell which git > /dev/null 2>&1 && git rev-parse --short HEAD | xargs echo "SHA " >> ${TESTDIR}/test.log)
|
|
0 commit comments