source: branches/stable/UNIT_TESTER/Makefile.suite

Last change on this file was 18352, checked in by westram, 4 years ago
File size: 3.5 KB
Line 
1
2notarget:
3        @echo "Usage: make (init|cleanup|unskip)"
4        false
5
6include Makefile.setup.include
7
8TEST_BASE=`pwd`
9
10TEST_REPORTER = ./reporter.pl
11TEST_DUPSYMWARN = ./dupsymwarn.pl
12TEST_LOG_DIR = ./logs
13TEST_FLAG_DIR = ./flags
14
15JUNIT_LOG = $(TEST_LOG_DIR)/junit_log.xml# see also reporter.pl@JUNITLOGNAME
16
17PATCHNAMEBASE:=TestsOk
18PATCHNAMESUFFIX:=
19
20VALGRIND_INTERNAL=$(findstring B,$(VALGRIND))$(findstring A,$(VALGRIND))
21VALGRIND_EXTERNAL=$(findstring E,$(VALGRIND))
22VALGRIND_ANY=$(VALGRIND_INTERNAL)$(VALGRIND_EXTERNAL)
23
24# -------------------- build patch name
25
26ifneq ('$(RESTRICT_LIB)','')
27PATCHNAMESUFFIX:=$(PATCHNAMESUFFIX)__only_$(RESTRICT_LIB)
28endif
29
30ifneq ($(RESTRICT_MODULE),'.')
31PATCHNAMESUFFIX:=$(PATCHNAMESUFFIX)__notAllFiles
32endif
33
34SKIPPED_SLOW:=$(shell (test -f skipslow.stamp && ls -1 skipslow.stamp))
35ifneq ('$(SKIPPED_SLOW)','')
36        PATCHNAMESUFFIX:=$(PATCHNAMESUFFIX)__SLOW_skipped
37        SYMDIR=./tests
38else
39        SYMDIR=./tests.slow
40endif
41
42ifneq ('$(VALGRIND_ANY)','')
43PATCHNAMESUFFIX:=$(PATCHNAMESUFFIX)__valgrinded_$(VALGRIND_ANY)
44endif
45
46PATCHNAMESUFFIX:=$(subst :,_,$(PATCHNAMESUFFIX))
47
48# -------------------- targets
49
50failed_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
61cleanup_environment:
62        ((./test_environment clean 2>&1) | $(ARBHOME)/SOURCE_TOOLS/asan2msg.pl) || $(MAKE) -f Makefile.suite failed_to_clean
63ifneq ($(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
67endif
68ifeq ($(VALGRIND_EXTERNAL),E)
69        ./valgrind/arb_valgrind_logged WAIT
70endif
71
72tests_passed: cleanup_environment
73        @$(TEST_REPORTER) report $(TEST_LOG_DIR) $(SKIP_SLOW)
74
75update_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
79unskip:
80        @(test -f skipslow.stamp && rm skipslow.stamp) || true
81
82DUPSYMLIST=$(SYMDIR)/dupsym.lst
83SYMFILES=$(wildcard $(SYMDIR)/*.sym)
84
85$(DUPSYMLIST): $(SYMFILES) $(TEST_DUPSYMWARN)
86ifeq ($(DARWIN),1)
87# under OSX output of nm lacks symbol-type-flag => no way to test for duplicate symbols.
88        @echo "Skipped test for duplicated symbols under OSX (nm-output insufficient)"
89else
90        @$(TEST_DUPSYMWARN) $(SYMFILES) > $(DUPSYMLIST) || (rm $(DUPSYMLIST) && false)
91endif
92
93list_duplicate_shared_symbols: $(DUPSYMLIST)
94ifneq ($(DARWIN),1)
95        @cat $(DUPSYMLIST)
96endif
97
98init:
99        @echo "$(SEP) Running unit tests"
100        @rm $(JUNIT_LOG) || true
101#ifeq ($(VALGRIND_EXTERNAL),E)
102        ./valgrind/arb_valgrind_logged INIT "$(VALGRIND_EXTERNAL)" $(CHECK_LEAKS)
103#endif
104        (export CHECK_RESTRICT=$(RESTRICT_LIB); $(TEST_REPORTER) init $(TEST_LOG_DIR) $(SKIP_SLOW))
105
106# 'cleanup' is called after all tests finished:
107cleanup: update_patches_if_passed list_duplicate_shared_symbols
108        ls -al $(JUNIT_LOG)
109        @echo "$(SEP) All unit tests passed"
110
Note: See TracBrowser for help on using the repository browser.