1 | |
---|
2 | notarget: |
---|
3 | @echo "Usage: make (init|cleanup|unskip)" |
---|
4 | false |
---|
5 | |
---|
6 | include Makefile.setup.include |
---|
7 | |
---|
8 | TEST_BASE=`pwd` |
---|
9 | |
---|
10 | TEST_REPORTER = ./reporter.pl |
---|
11 | TEST_DUPSYMWARN = ./dupsymwarn.pl |
---|
12 | TEST_LOG_DIR = ./logs |
---|
13 | TEST_FLAG_DIR = ./flags |
---|
14 | |
---|
15 | JUNIT_LOG = $(TEST_LOG_DIR)/junit_log.xml# see also reporter.pl@JUNITLOGNAME |
---|
16 | |
---|
17 | PATCHNAMEBASE:=TestsOk |
---|
18 | PATCHNAMESUFFIX:= |
---|
19 | |
---|
20 | VALGRIND_INTERNAL=$(findstring B,$(VALGRIND))$(findstring A,$(VALGRIND)) |
---|
21 | VALGRIND_EXTERNAL=$(findstring E,$(VALGRIND)) |
---|
22 | VALGRIND_ANY=$(VALGRIND_INTERNAL)$(VALGRIND_EXTERNAL) |
---|
23 | |
---|
24 | # -------------------- build patch name |
---|
25 | |
---|
26 | ifneq ('$(RESTRICT_LIB)','') |
---|
27 | PATCHNAMESUFFIX:=$(PATCHNAMESUFFIX)__only_$(RESTRICT_LIB) |
---|
28 | endif |
---|
29 | |
---|
30 | ifneq ($(RESTRICT_MODULE),'.') |
---|
31 | PATCHNAMESUFFIX:=$(PATCHNAMESUFFIX)__notAllFiles |
---|
32 | endif |
---|
33 | |
---|
34 | SKIPPED_SLOW:=$(shell (test -f skipslow.stamp && ls -1 skipslow.stamp)) |
---|
35 | ifneq ('$(SKIPPED_SLOW)','') |
---|
36 | PATCHNAMESUFFIX:=$(PATCHNAMESUFFIX)__SLOW_skipped |
---|
37 | SYMDIR=./tests |
---|
38 | else |
---|
39 | SYMDIR=./tests.slow |
---|
40 | endif |
---|
41 | |
---|
42 | ifneq ('$(VALGRIND_ANY)','') |
---|
43 | PATCHNAMESUFFIX:=$(PATCHNAMESUFFIX)__valgrinded_$(VALGRIND_ANY) |
---|
44 | endif |
---|
45 | |
---|
46 | PATCHNAMESUFFIX:=$(subst :,_,$(PATCHNAMESUFFIX)) |
---|
47 | |
---|
48 | # -------------------- targets |
---|
49 | |
---|
50 | failed_to_clean: |
---|
51 | @echo "$(TEST_BASE)/Makefile.suite:45: Error: Failed to clean environment" |
---|
52 | @echo "If there are any changing|failed*.flag files listed here:" |
---|
53 | @ls -al $(TEST_FLAG_DIR)/changing*.flag $(TEST_FLAG_DIR)/failed*.flag |
---|
54 | @echo "then some test_environment failed to setup or cleanup properly!" |
---|
55 | @echo "[Note: removing flag-files now to avoid failure of next test-run]" |
---|
56 | rm $(TEST_FLAG_DIR)/changing*.flag $(TEST_FLAG_DIR)/failed*.flag |
---|
57 | @echo "$(TEST_BASE)/$(TEST_LOG_DIR):0: Hint: if no error is reported further below, you may also find the cause in these log-files" |
---|
58 | @grep -in 'arb-backtrace\|segv' $(TEST_BASE)/$(TEST_LOG_DIR)/*.log | grep -v 'GBK_install_SIGSEGV_handler' |
---|
59 | # do NOT fail here, otherwise reporter will get no chance to list failure-reason |
---|
60 | |
---|
61 | cleanup_environment: |
---|
62 | ((./test_environment clean 2>&1) | $(ARBHOME)/SOURCE_TOOLS/asan2msg.pl) || $(MAKE) -f Makefile.suite failed_to_clean |
---|
63 | ifneq ($(SANITIZE),0) |
---|
64 | # delay until servers were able to append to log (before reporter scans logs) |
---|
65 | # cannot be ensured as they run asynchronous |
---|
66 | sleep 1 |
---|
67 | endif |
---|
68 | ifeq ($(VALGRIND_EXTERNAL),E) |
---|
69 | ./valgrind/arb_valgrind_logged WAIT |
---|
70 | endif |
---|
71 | |
---|
72 | tests_passed: cleanup_environment |
---|
73 | @$(TEST_REPORTER) report $(TEST_LOG_DIR) $(SKIP_SLOW) |
---|
74 | |
---|
75 | update_patches_if_passed: tests_passed |
---|
76 | @../SOURCE_TOOLS/arb_create_patch.sh $(PATCHNAMEBASE)$(PATCHNAMESUFFIX) |
---|
77 | @../SOURCE_TOOLS/arb_cleanup_patches.pl $(PATCHNAMEBASE) $(PATCHES_KEEP_HOURS) $(PATCHES_MIN_KEPT) |
---|
78 | |
---|
79 | unskip: |
---|
80 | @(test -f skipslow.stamp && rm skipslow.stamp) || true |
---|
81 | |
---|
82 | DUPSYMLIST=$(SYMDIR)/dupsym.lst |
---|
83 | SYMFILES=$(wildcard $(SYMDIR)/*.sym) |
---|
84 | |
---|
85 | $(DUPSYMLIST): $(SYMFILES) $(TEST_DUPSYMWARN) |
---|
86 | ifeq ($(DARWIN),1) |
---|
87 | # under OSX output of nm lacks symbol-type-flag => no way to test for duplicate symbols. |
---|
88 | @echo "Note: Skipped test for duplicated symbols under OSX (nm-output insufficient)" |
---|
89 | else |
---|
90 | ifeq ($(SYMFILES),) |
---|
91 | @echo "Note: Skipped test for duplicated symbols (no .sym files seen)" |
---|
92 | else |
---|
93 | @$(TEST_DUPSYMWARN) $(SYMFILES) > $(DUPSYMLIST) || (rm $(DUPSYMLIST) && false) |
---|
94 | endif |
---|
95 | endif |
---|
96 | |
---|
97 | list_duplicate_shared_symbols: $(DUPSYMLIST) |
---|
98 | @-(test -f $(DUPSYMLIST) && cat $(DUPSYMLIST)) |
---|
99 | |
---|
100 | init: |
---|
101 | @echo "$(SEP) Running unit tests" |
---|
102 | @rm $(JUNIT_LOG) || true |
---|
103 | #ifeq ($(VALGRIND_EXTERNAL),E) |
---|
104 | ./valgrind/arb_valgrind_logged INIT "$(VALGRIND_EXTERNAL)" $(CHECK_LEAKS) |
---|
105 | #endif |
---|
106 | (export CHECK_RESTRICT=$(RESTRICT_LIB); $(TEST_REPORTER) init $(TEST_LOG_DIR) $(SKIP_SLOW)) |
---|
107 | |
---|
108 | # 'cleanup' is called after all tests finished: |
---|
109 | cleanup: update_patches_if_passed list_duplicate_shared_symbols |
---|
110 | ls -al $(JUNIT_LOG) |
---|
111 | @echo "$(SEP) All unit tests passed" |
---|
112 | |
---|