annotate Makefile @ 273:68b883fe4fad

added *BSD support to the test framework Anders F Bj?rklund <afb@algonet.se> 2005-02-06 mail:36b15bf19097bed2997cbed4a4fdb825@algonet.se
author thomask
date Mon, 07 Feb 2005 00:08:11 +0000
parents 6cd84461e17b
children 368156152168
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
145
553c8aaa0982 added support for detecting segfaults with pseudo return code 1
thomask
parents: 109
diff changeset
1 # $HeadURL$
553c8aaa0982 added support for detecting segfaults with pseudo return code 1
thomask
parents: 109
diff changeset
2 # $Date$
553c8aaa0982 added support for detecting segfaults with pseudo return code 1
thomask
parents: 109
diff changeset
3 # $Author$
553c8aaa0982 added support for detecting segfaults with pseudo return code 1
thomask
parents: 109
diff changeset
4 #
239
c2a96b326f61 repos & copyright maintenance
thomask
parents: 217
diff changeset
5 # GnuMakefile for DStress http://dstress.kuehne.cn/www/dstress.html
c2a96b326f61 repos & copyright maintenance
thomask
parents: 217
diff changeset
6 # Copyright (C) 2004, 2005 Thomas Kuehne
46
1f7f839145de added complex test case(e.g. multi file) support
thomask
parents: 41
diff changeset
7 #
1f7f839145de added complex test case(e.g. multi file) support
thomask
parents: 41
diff changeset
8 # This program is free software; you can redistribute it and/or modify
1f7f839145de added complex test case(e.g. multi file) support
thomask
parents: 41
diff changeset
9 # it under the terms of the GNU General Public License as published by
1f7f839145de added complex test case(e.g. multi file) support
thomask
parents: 41
diff changeset
10 # the Free Software Foundation; either version 2 of the License, or
1f7f839145de added complex test case(e.g. multi file) support
thomask
parents: 41
diff changeset
11 # (at your option) any later version.
1f7f839145de added complex test case(e.g. multi file) support
thomask
parents: 41
diff changeset
12 #
1f7f839145de added complex test case(e.g. multi file) support
thomask
parents: 41
diff changeset
13 # This program is distributed in the hope that it will be useful,
1f7f839145de added complex test case(e.g. multi file) support
thomask
parents: 41
diff changeset
14 # but WITHOUT ANY WARRANTY; without even the implied warranty of
1f7f839145de added complex test case(e.g. multi file) support
thomask
parents: 41
diff changeset
15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1f7f839145de added complex test case(e.g. multi file) support
thomask
parents: 41
diff changeset
16 # GNU General Public License for more details.
1f7f839145de added complex test case(e.g. multi file) support
thomask
parents: 41
diff changeset
17 #
1f7f839145de added complex test case(e.g. multi file) support
thomask
parents: 41
diff changeset
18 # You should have received a copy of the GNU General Public License
1f7f839145de added complex test case(e.g. multi file) support
thomask
parents: 41
diff changeset
19 # along with this program; if not, write to the Free Software
1f7f839145de added complex test case(e.g. multi file) support
thomask
parents: 41
diff changeset
20 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
1f7f839145de added complex test case(e.g. multi file) support
thomask
parents: 41
diff changeset
21 #
0
3269e4627918 init dstress
svnowner
parents:
diff changeset
22
46
1f7f839145de added complex test case(e.g. multi file) support
thomask
parents: 41
diff changeset
23 # dir: temp objects will be placed there
32
315459a24bf4 fixed LOG and OBJ_DIR
thomask
parents: 31
diff changeset
24 ifndef OBJ_DIR
190
f29443c7054c 1) super()
thomask
parents: 145
diff changeset
25 OBJ_DIR := obj
32
315459a24bf4 fixed LOG and OBJ_DIR
thomask
parents: 31
diff changeset
26 endif
315459a24bf4 fixed LOG and OBJ_DIR
thomask
parents: 31
diff changeset
27
46
1f7f839145de added complex test case(e.g. multi file) support
thomask
parents: 41
diff changeset
28 # file: append compiler messages and runtime assertions
83
6a56a7866943 added ?DSTRESS_FLAGS? support (2)
thomask
parents: 80
diff changeset
29 # NOTE: this has to be an absolut path (required for some complex.mak files)
32
315459a24bf4 fixed LOG and OBJ_DIR
thomask
parents: 31
diff changeset
30 ifndef LOG
190
f29443c7054c 1) super()
thomask
parents: 145
diff changeset
31 LOG := $(PWD)/log.txt
32
315459a24bf4 fixed LOG and OBJ_DIR
thomask
parents: 31
diff changeset
32 endif
0
3269e4627918 init dstress
svnowner
parents:
diff changeset
33
46
1f7f839145de added complex test case(e.g. multi file) support
thomask
parents: 41
diff changeset
34 # executeable: the compiler
0
3269e4627918 init dstress
svnowner
parents:
diff changeset
35 ifndef DMD
190
f29443c7054c 1) super()
thomask
parents: 145
diff changeset
36 DMD := dmd
0
3269e4627918 init dstress
svnowner
parents:
diff changeset
37 endif
3269e4627918 init dstress
svnowner
parents:
diff changeset
38
46
1f7f839145de added complex test case(e.g. multi file) support
thomask
parents: 41
diff changeset
39 # executeable: a GNU findutils compatible find (e.g.: find path -regex "?\\.*something")
0
3269e4627918 init dstress
svnowner
parents:
diff changeset
40 ifndef FIND
190
f29443c7054c 1) super()
thomask
parents: 145
diff changeset
41 FIND := find
0
3269e4627918 init dstress
svnowner
parents:
diff changeset
42 endif
3269e4627918 init dstress
svnowner
parents:
diff changeset
43
46
1f7f839145de added complex test case(e.g. multi file) support
thomask
parents: 41
diff changeset
44 # executeable: remove zero or more files (e.g.: rm -f a b c)
0
3269e4627918 init dstress
svnowner
parents:
diff changeset
45 ifndef RM
190
f29443c7054c 1) super()
thomask
parents: 145
diff changeset
46 RM := rm -f
0
3269e4627918 init dstress
svnowner
parents:
diff changeset
47 endif
3269e4627918 init dstress
svnowner
parents:
diff changeset
48
46
1f7f839145de added complex test case(e.g. multi file) support
thomask
parents: 41
diff changeset
49 # executeable: change to a given dir (e.g. cd some/other/dir)
1f7f839145de added complex test case(e.g. multi file) support
thomask
parents: 41
diff changeset
50 ifndef CD
190
f29443c7054c 1) super()
thomask
parents: 145
diff changeset
51 CD := cd
46
1f7f839145de added complex test case(e.g. multi file) support
thomask
parents: 41
diff changeset
52 endif
1f7f839145de added complex test case(e.g. multi file) support
thomask
parents: 41
diff changeset
53
1f7f839145de added complex test case(e.g. multi file) support
thomask
parents: 41
diff changeset
54 # executeable: display a message test (e.g. echo "something to say)
0
3269e4627918 init dstress
svnowner
parents:
diff changeset
55 ifndef ECHO
190
f29443c7054c 1) super()
thomask
parents: 145
diff changeset
56 ECHO := echo
0
3269e4627918 init dstress
svnowner
parents:
diff changeset
57 endif
3269e4627918 init dstress
svnowner
parents:
diff changeset
58
46
1f7f839145de added complex test case(e.g. multi file) support
thomask
parents: 41
diff changeset
59 # executeable: update the timestamp of an existing file or create a new empty file
0
3269e4627918 init dstress
svnowner
parents:
diff changeset
60 ifndef TOUCH
190
f29443c7054c 1) super()
thomask
parents: 145
diff changeset
61 TOUCH := touch
0
3269e4627918 init dstress
svnowner
parents:
diff changeset
62 endif
3269e4627918 init dstress
svnowner
parents:
diff changeset
63
145
553c8aaa0982 added support for detecting segfaults with pseudo return code 1
thomask
parents: 109
diff changeset
64 # executeable: detect if stdin contains "Internal error" (dmd) or "gcc.gnu.org/bugs" (gcd)
553c8aaa0982 added support for detecting segfaults with pseudo return code 1
thomask
parents: 109
diff changeset
65 ifndef GREP
190
f29443c7054c 1) super()
thomask
parents: 145
diff changeset
66 GREP := grep -s '\(Internal error\)\|\(gcc.gnu.org/bugs\)' > /dev/null 2>&1
145
553c8aaa0982 added support for detecting segfaults with pseudo return code 1
thomask
parents: 109
diff changeset
67 endif
553c8aaa0982 added support for detecting segfaults with pseudo return code 1
thomask
parents: 109
diff changeset
68
553c8aaa0982 added support for detecting segfaults with pseudo return code 1
thomask
parents: 109
diff changeset
69 # executeable: used to concat files
553c8aaa0982 added support for detecting segfaults with pseudo return code 1
thomask
parents: 109
diff changeset
70 ifndef CAT
190
f29443c7054c 1) super()
thomask
parents: 145
diff changeset
71 CAT := cat
145
553c8aaa0982 added support for detecting segfaults with pseudo return code 1
thomask
parents: 109
diff changeset
72 endif
553c8aaa0982 added support for detecting segfaults with pseudo return code 1
thomask
parents: 109
diff changeset
73
46
1f7f839145de added complex test case(e.g. multi file) support
thomask
parents: 41
diff changeset
74 ###############################################################################
1f7f839145de added complex test case(e.g. multi file) support
thomask
parents: 41
diff changeset
75 ###############################################################################
1f7f839145de added complex test case(e.g. multi file) support
thomask
parents: 41
diff changeset
76 #
1f7f839145de added complex test case(e.g. multi file) support
thomask
parents: 41
diff changeset
77 # nothing to customize below
1f7f839145de added complex test case(e.g. multi file) support
thomask
parents: 41
diff changeset
78 #
1f7f839145de added complex test case(e.g. multi file) support
thomask
parents: 41
diff changeset
79 ###############################################################################
1f7f839145de added complex test case(e.g. multi file) support
thomask
parents: 41
diff changeset
80 ###############################################################################
6
e238a15dbc74 1) added added html-sourcefile support
thomask
parents: 0
diff changeset
81
83
6a56a7866943 added ?DSTRESS_FLAGS? support (2)
thomask
parents: 80
diff changeset
82 # tools
190
f29443c7054c 1) super()
thomask
parents: 145
diff changeset
83 return__ := ./return__
f29443c7054c 1) super()
thomask
parents: 145
diff changeset
84 ifeq__ := ./ifeq__
f29443c7054c 1) super()
thomask
parents: 145
diff changeset
85 extract__ := ./extract__
251
6cd84461e17b enabled new "dstress.c" test tool
thomask
parents: 239
diff changeset
86 dstress__ := ./dstress__
83
6a56a7866943 added ?DSTRESS_FLAGS? support (2)
thomask
parents: 80
diff changeset
87
72
b0e95b878322 added segfault detection support
thomask
parents: 63
diff changeset
88 # settings
190
f29443c7054c 1) super()
thomask
parents: 145
diff changeset
89 to_log := >> $(LOG) 2>&1
f29443c7054c 1) super()
thomask
parents: 145
diff changeset
90 ext_run := exe
f29443c7054c 1) super()
thomask
parents: 145
diff changeset
91 ext_norun := bin
f29443c7054c 1) super()
thomask
parents: 145
diff changeset
92 ext_nocompile := no
f29443c7054c 1) super()
thomask
parents: 145
diff changeset
93 ext_compile := o
f29443c7054c 1) super()
thomask
parents: 145
diff changeset
94 ext_source := d
f29443c7054c 1) super()
thomask
parents: 145
diff changeset
95 ext_source_html := html
f29443c7054c 1) super()
thomask
parents: 145
diff changeset
96 ext_log := log
f29443c7054c 1) super()
thomask
parents: 145
diff changeset
97 complex_todo := complex.mak
f29443c7054c 1) super()
thomask
parents: 145
diff changeset
98 complex_done := complex.done
f29443c7054c 1) super()
thomask
parents: 145
diff changeset
99 flag_pattern := __DSTRESS_DFLAGS__
0
3269e4627918 init dstress
svnowner
parents:
diff changeset
100
251
6cd84461e17b enabled new "dstress.c" test tool
thomask
parents: 239
diff changeset
101 .PHONY: all basic_tools compile nocompile run norun complex clean distclean clean_log
190
f29443c7054c 1) super()
thomask
parents: 145
diff changeset
102
f29443c7054c 1) super()
thomask
parents: 145
diff changeset
103 .SUFFIXES: $(ext_run) $(ext_norun) $(ext_nocompile) $(ext_compile)
46
1f7f839145de added complex test case(e.g. multi file) support
thomask
parents: 41
diff changeset
104 #
1f7f839145de added complex test case(e.g. multi file) support
thomask
parents: 41
diff changeset
105 # test everything
1f7f839145de added complex test case(e.g. multi file) support
thomask
parents: 41
diff changeset
106 #
1f7f839145de added complex test case(e.g. multi file) support
thomask
parents: 41
diff changeset
107 all : Makefile compile nocompile run norun complex
6
e238a15dbc74 1) added added html-sourcefile support
thomask
parents: 0
diff changeset
108
46
1f7f839145de added complex test case(e.g. multi file) support
thomask
parents: 41
diff changeset
109 #
72
b0e95b878322 added segfault detection support
thomask
parents: 63
diff changeset
110 # the tools
b0e95b878322 added segfault detection support
thomask
parents: 63
diff changeset
111 #
83
6a56a7866943 added ?DSTRESS_FLAGS? support (2)
thomask
parents: 80
diff changeset
112 $(return__) : return__.c Makefile
6a56a7866943 added ?DSTRESS_FLAGS? support (2)
thomask
parents: 80
diff changeset
113 $(CC) $(CFLAGS) $< -o $@
6a56a7866943 added ?DSTRESS_FLAGS? support (2)
thomask
parents: 80
diff changeset
114
6a56a7866943 added ?DSTRESS_FLAGS? support (2)
thomask
parents: 80
diff changeset
115 $(ifeq__) : ifeq__.c Makefile
72
b0e95b878322 added segfault detection support
thomask
parents: 63
diff changeset
116 $(CC) $(CFLAGS) $< -o $@
b0e95b878322 added segfault detection support
thomask
parents: 63
diff changeset
117
83
6a56a7866943 added ?DSTRESS_FLAGS? support (2)
thomask
parents: 80
diff changeset
118 $(extract__) : extract__.c Makefile
72
b0e95b878322 added segfault detection support
thomask
parents: 63
diff changeset
119 $(CC) $(CFLAGS) $< -o $@
b0e95b878322 added segfault detection support
thomask
parents: 63
diff changeset
120
251
6cd84461e17b enabled new "dstress.c" test tool
thomask
parents: 239
diff changeset
121 $(dstress__) : dstress.c Makefile
6cd84461e17b enabled new "dstress.c" test tool
thomask
parents: 239
diff changeset
122 $(CC) $(CFLAGS) $< -o $@
6cd84461e17b enabled new "dstress.c" test tool
thomask
parents: 239
diff changeset
123
6cd84461e17b enabled new "dstress.c" test tool
thomask
parents: 239
diff changeset
124 basic_tools : $(ifeq__) $(return__) $(extract__) $(dstress__)
72
b0e95b878322 added segfault detection support
thomask
parents: 63
diff changeset
125
83
6a56a7866943 added ?DSTRESS_FLAGS? support (2)
thomask
parents: 80
diff changeset
126
72
b0e95b878322 added segfault detection support
thomask
parents: 63
diff changeset
127 #
46
1f7f839145de added complex test case(e.g. multi file) support
thomask
parents: 41
diff changeset
128 # include complex test cases
1f7f839145de added complex test case(e.g. multi file) support
thomask
parents: 41
diff changeset
129 #
190
f29443c7054c 1) super()
thomask
parents: 145
diff changeset
130 complex_makefiles := $(sort $(shell $(FIND) complex -regex ".*$(complex_todo)"))
46
1f7f839145de added complex test case(e.g. multi file) support
thomask
parents: 41
diff changeset
131 include $(complex_makefiles)
6
e238a15dbc74 1) added added html-sourcefile support
thomask
parents: 0
diff changeset
132
83
6a56a7866943 added ?DSTRESS_FLAGS? support (2)
thomask
parents: 80
diff changeset
133 #
6a56a7866943 added ?DSTRESS_FLAGS? support (2)
thomask
parents: 80
diff changeset
134 # extract potential compiling flags from the test case sources
6a56a7866943 added ?DSTRESS_FLAGS? support (2)
thomask
parents: 80
diff changeset
135 #
6a56a7866943 added ?DSTRESS_FLAGS? support (2)
thomask
parents: 80
diff changeset
136 define extract_z_flags
6a56a7866943 added ?DSTRESS_FLAGS? support (2)
thomask
parents: 80
diff changeset
137 $(eval z_flags = $(shell $(extract__) $(flag_pattern) < $<))
6a56a7866943 added ?DSTRESS_FLAGS? support (2)
thomask
parents: 80
diff changeset
138 endef
6a56a7866943 added ?DSTRESS_FLAGS? support (2)
thomask
parents: 80
diff changeset
139
46
1f7f839145de added complex test case(e.g. multi file) support
thomask
parents: 41
diff changeset
140 #
1f7f839145de added complex test case(e.g. multi file) support
thomask
parents: 41
diff changeset
141 # target should fail to compile
1f7f839145de added complex test case(e.g. multi file) support
thomask
parents: 41
diff changeset
142 #
251
6cd84461e17b enabled new "dstress.c" test tool
thomask
parents: 239
diff changeset
143 nocompile : $(dstress__)
6cd84461e17b enabled new "dstress.c" test tool
thomask
parents: 239
diff changeset
144 rm -f nocompile/*.o nocompile/*.$(ext_nocompile)
273
68b883fe4fad added *BSD support to the test framework
thomask
parents: 251
diff changeset
145 find nocompile/ -maxdepth 1 -name "?*.?*" | grep "." | sort | xargs -n 1 echo "$(dstress__) nocompile" > nocompile.sh
251
6cd84461e17b enabled new "dstress.c" test tool
thomask
parents: 239
diff changeset
146 chmod +x nocompile.sh
6cd84461e17b enabled new "dstress.c" test tool
thomask
parents: 239
diff changeset
147 ./nocompile.sh 2>> $(LOG)
17
deb014248067 cleanup of makefile
thomask
parents: 14
diff changeset
148
251
6cd84461e17b enabled new "dstress.c" test tool
thomask
parents: 239
diff changeset
149 # used in some complex test cases
75
edc279c4f7f9 makefile cleanup
thomask
parents: 72
diff changeset
150 define analyse_nocompile
72
b0e95b878322 added segfault detection support
thomask
parents: 63
diff changeset
151 @if $(ifeq__) $(z_return) 0 ; then \
46
1f7f839145de added complex test case(e.g. multi file) support
thomask
parents: 41
diff changeset
152 $(ECHO) "XPASS: $(z_name)"; $(RM) $@; \
1f7f839145de added complex test case(e.g. multi file) support
thomask
parents: 41
diff changeset
153 else \
145
553c8aaa0982 added support for detecting segfaults with pseudo return code 1
thomask
parents: 109
diff changeset
154 if $(CAT) $(z_log) | $(GREP) ; then \
553c8aaa0982 added support for detecting segfaults with pseudo return code 1
thomask
parents: 109
diff changeset
155 $(ECHO) "ERROR: $(z_name) [Internal compiler error]"; $(RM) $@; \
72
b0e95b878322 added segfault detection support
thomask
parents: 63
diff changeset
156 else \
145
553c8aaa0982 added support for detecting segfaults with pseudo return code 1
thomask
parents: 109
diff changeset
157 if $(ifeq__) $(z_return) 256 ; then \
553c8aaa0982 added support for detecting segfaults with pseudo return code 1
thomask
parents: 109
diff changeset
158 $(ECHO) "XFAIL: $(z_name)"; $(TOUCH) $@; \
553c8aaa0982 added support for detecting segfaults with pseudo return code 1
thomask
parents: 109
diff changeset
159 else \
553c8aaa0982 added support for detecting segfaults with pseudo return code 1
thomask
parents: 109
diff changeset
160 $(ECHO) "ERROR: $(z_name) [$(z_return)]"; $(RM) $@; \
553c8aaa0982 added support for detecting segfaults with pseudo return code 1
thomask
parents: 109
diff changeset
161 fi \
72
b0e95b878322 added segfault detection support
thomask
parents: 63
diff changeset
162 fi \
46
1f7f839145de added complex test case(e.g. multi file) support
thomask
parents: 41
diff changeset
163 fi
75
edc279c4f7f9 makefile cleanup
thomask
parents: 72
diff changeset
164 endef
edc279c4f7f9 makefile cleanup
thomask
parents: 72
diff changeset
165
46
1f7f839145de added complex test case(e.g. multi file) support
thomask
parents: 41
diff changeset
166 #
1f7f839145de added complex test case(e.g. multi file) support
thomask
parents: 41
diff changeset
167 # target should compile (excludes linking)
1f7f839145de added complex test case(e.g. multi file) support
thomask
parents: 41
diff changeset
168 #
251
6cd84461e17b enabled new "dstress.c" test tool
thomask
parents: 239
diff changeset
169 compile : $(dstress__)
6cd84461e17b enabled new "dstress.c" test tool
thomask
parents: 239
diff changeset
170 rm -f compile/*.o compile/*.$(ext_compile)
273
68b883fe4fad added *BSD support to the test framework
thomask
parents: 251
diff changeset
171 find compile/ -maxdepth 1 -name "?*.?*" | grep "." | sort | xargs -n 1 echo "$(dstress__) compile" > compile.sh
251
6cd84461e17b enabled new "dstress.c" test tool
thomask
parents: 239
diff changeset
172 chmod +x compile.sh
6cd84461e17b enabled new "dstress.c" test tool
thomask
parents: 239
diff changeset
173 ./compile.sh 2>> $(LOG)
0
3269e4627918 init dstress
svnowner
parents:
diff changeset
174
251
6cd84461e17b enabled new "dstress.c" test tool
thomask
parents: 239
diff changeset
175 # used in some complex test cases
75
edc279c4f7f9 makefile cleanup
thomask
parents: 72
diff changeset
176 define analyse_compile
72
b0e95b878322 added segfault detection support
thomask
parents: 63
diff changeset
177 @if $(ifeq__) $(z_return) 0 ; then \
217
d28e9d734c7f suport multiple file compile targets
thomask
parents: 190
diff changeset
178 $(ECHO) "PASS: $(z_name)"; $(TOUCH) $@; \
46
1f7f839145de added complex test case(e.g. multi file) support
thomask
parents: 41
diff changeset
179 else \
72
b0e95b878322 added segfault detection support
thomask
parents: 63
diff changeset
180 if $(ifeq__) $(z_return) 256 ; then \
b0e95b878322 added segfault detection support
thomask
parents: 63
diff changeset
181 $(ECHO) "FAIL: $(z_name)"; $(RM) $@; \
b0e95b878322 added segfault detection support
thomask
parents: 63
diff changeset
182 else \
75
edc279c4f7f9 makefile cleanup
thomask
parents: 72
diff changeset
183 $(ECHO) "ERROR: $(z_name) [$(z_return)]"; $(RM) $@; \
72
b0e95b878322 added segfault detection support
thomask
parents: 63
diff changeset
184 fi \
46
1f7f839145de added complex test case(e.g. multi file) support
thomask
parents: 41
diff changeset
185 fi
75
edc279c4f7f9 makefile cleanup
thomask
parents: 72
diff changeset
186 endef
edc279c4f7f9 makefile cleanup
thomask
parents: 72
diff changeset
187
46
1f7f839145de added complex test case(e.g. multi file) support
thomask
parents: 41
diff changeset
188 #
1f7f839145de added complex test case(e.g. multi file) support
thomask
parents: 41
diff changeset
189 # target should compile, link and run
1f7f839145de added complex test case(e.g. multi file) support
thomask
parents: 41
diff changeset
190 #
251
6cd84461e17b enabled new "dstress.c" test tool
thomask
parents: 239
diff changeset
191 run : $(dstress__)
6cd84461e17b enabled new "dstress.c" test tool
thomask
parents: 239
diff changeset
192 rm -f run/*.exe run/*.$(ext_run)
273
68b883fe4fad added *BSD support to the test framework
thomask
parents: 251
diff changeset
193 find run/ -maxdepth 1 -name "?*.?*" | grep "." | sort | xargs -n 1 echo "$(dstress__) run" > run.sh
251
6cd84461e17b enabled new "dstress.c" test tool
thomask
parents: 239
diff changeset
194 chmod +x run.sh
6cd84461e17b enabled new "dstress.c" test tool
thomask
parents: 239
diff changeset
195 ./run.sh 2>> $(LOG)
0
3269e4627918 init dstress
svnowner
parents:
diff changeset
196
251
6cd84461e17b enabled new "dstress.c" test tool
thomask
parents: 239
diff changeset
197 # used in some complex testcases
75
edc279c4f7f9 makefile cleanup
thomask
parents: 72
diff changeset
198 define analyse_run
72
b0e95b878322 added segfault detection support
thomask
parents: 63
diff changeset
199 @if $(ifeq__) $(z_return) 0 ; then \
80
72fa445c2fbb minor makefile cleanup
thomask
parents: 75
diff changeset
200 $(eval z_return2 = $(shell $(return__) "./$@ $(to_log)")) \
72fa445c2fbb minor makefile cleanup
thomask
parents: 75
diff changeset
201 if $(ifeq__) $(z_return2) 0 ; then \
46
1f7f839145de added complex test case(e.g. multi file) support
thomask
parents: 41
diff changeset
202 $(ECHO) "PASS: $(z_name)"; \
1f7f839145de added complex test case(e.g. multi file) support
thomask
parents: 41
diff changeset
203 else \
80
72fa445c2fbb minor makefile cleanup
thomask
parents: 75
diff changeset
204 if $(ifeq__) $(z_return2) 256 ; then \
72fa445c2fbb minor makefile cleanup
thomask
parents: 75
diff changeset
205 $(ECHO) "FAIL: $(z_name)"; $(RM) $@; \
72fa445c2fbb minor makefile cleanup
thomask
parents: 75
diff changeset
206 else \
72fa445c2fbb minor makefile cleanup
thomask
parents: 75
diff changeset
207 $(ECHO) "ERROR: $(z_name) [run: $(z_return2)]"; $(RM) $@; \
72fa445c2fbb minor makefile cleanup
thomask
parents: 75
diff changeset
208 fi \
46
1f7f839145de added complex test case(e.g. multi file) support
thomask
parents: 41
diff changeset
209 fi \
1f7f839145de added complex test case(e.g. multi file) support
thomask
parents: 41
diff changeset
210 else \
72
b0e95b878322 added segfault detection support
thomask
parents: 63
diff changeset
211 if $(ifeq__) $(z_return) 256 ; then \
b0e95b878322 added segfault detection support
thomask
parents: 63
diff changeset
212 $(ECHO) "FAIL: $(z_name) (compiling error)"; \
b0e95b878322 added segfault detection support
thomask
parents: 63
diff changeset
213 else \
75
edc279c4f7f9 makefile cleanup
thomask
parents: 72
diff changeset
214 $(ECHO) "ERROR: $(z_name) [$(z_return)]"; \
72
b0e95b878322 added segfault detection support
thomask
parents: 63
diff changeset
215 fi \
46
1f7f839145de added complex test case(e.g. multi file) support
thomask
parents: 41
diff changeset
216 fi
75
edc279c4f7f9 makefile cleanup
thomask
parents: 72
diff changeset
217 endef
46
1f7f839145de added complex test case(e.g. multi file) support
thomask
parents: 41
diff changeset
218
1f7f839145de added complex test case(e.g. multi file) support
thomask
parents: 41
diff changeset
219 #
108
aa6478748245 added makefile diagnostics
thomask
parents: 92
diff changeset
220 # target should compile, link and run
aa6478748245 added makefile diagnostics
thomask
parents: 92
diff changeset
221 # (used for Makefile diagnosis)
aa6478748245 added makefile diagnostics
thomask
parents: 92
diff changeset
222 #
aa6478748245 added makefile diagnostics
thomask
parents: 92
diff changeset
223 %.diagnose.$(ext_run) : %.$(ext_source) basic_tools
aa6478748245 added makefile diagnostics
thomask
parents: 92
diff changeset
224 # destination: $@
aa6478748245 added makefile diagnostics
thomask
parents: 92
diff changeset
225 # source: $<
109
0e5c059a7658 added diagnosis for GNUMake's $(eval ...), $(shell ...) and $(eval ... $(shell ...))
thomask
parents: 108
diff changeset
226 $(eval y_tmp = OK)
0e5c059a7658 added diagnosis for GNUMake's $(eval ...), $(shell ...) and $(eval ... $(shell ...))
thomask
parents: 108
diff changeset
227 # eval: $(y_tmp)
0e5c059a7658 added diagnosis for GNUMake's $(eval ...), $(shell ...) and $(eval ... $(shell ...))
thomask
parents: 108
diff changeset
228 # shell:
0e5c059a7658 added diagnosis for GNUMake's $(eval ...), $(shell ...) and $(eval ... $(shell ...))
thomask
parents: 108
diff changeset
229 @$(ECHO) $(shell $(ECHO) "OK")
0e5c059a7658 added diagnosis for GNUMake's $(eval ...), $(shell ...) and $(eval ... $(shell ...))
thomask
parents: 108
diff changeset
230 $(eval y_tmp = $(shell $(ECHO) "OK"))
0e5c059a7658 added diagnosis for GNUMake's $(eval ...), $(shell ...) and $(eval ... $(shell ...))
thomask
parents: 108
diff changeset
231 # eval.shell: $(y_tmp)
108
aa6478748245 added makefile diagnostics
thomask
parents: 92
diff changeset
232 $(eval z_name = $(subst .diagnose.$(ext_run),,$@))
aa6478748245 added makefile diagnostics
thomask
parents: 92
diff changeset
233 # name: $(z_name)
aa6478748245 added makefile diagnostics
thomask
parents: 92
diff changeset
234 # extract__: $(extract__)
aa6478748245 added makefile diagnostics
thomask
parents: 92
diff changeset
235 # extract__.cmd: $(extract__) $(flag_pattern) < $<
aa6478748245 added makefile diagnostics
thomask
parents: 92
diff changeset
236 $(extract_z_flags)
aa6478748245 added makefile diagnostics
thomask
parents: 92
diff changeset
237 # extract__.result: $(z_flags)
aa6478748245 added makefile diagnostics
thomask
parents: 92
diff changeset
238 # ifeq__: $(ifeq__)
aa6478748245 added makefile diagnostics
thomask
parents: 92
diff changeset
239 # continue if ifeq__ works
aa6478748245 added makefile diagnostics
thomask
parents: 92
diff changeset
240 $(ifeq__) someString someString
aa6478748245 added makefile diagnostics
thomask
parents: 92
diff changeset
241 # return__: $(return__)
aa6478748245 added makefile diagnostics
thomask
parents: 92
diff changeset
242 # dmd: $(DMD)
aa6478748245 added makefile diagnostics
thomask
parents: 92
diff changeset
243 $(eval y_tmp = $(shell $(return__) "$(ifeq__) 1 1"))
aa6478748245 added makefile diagnostics
thomask
parents: 92
diff changeset
244 # return__.return_code_0: $(y_tmp) (expect=0)
aa6478748245 added makefile diagnostics
thomask
parents: 92
diff changeset
245 $(eval y_tmp = $(shell $(return__) "$(DMD) > /dev/null"))
aa6478748245 added makefile diagnostics
thomask
parents: 92
diff changeset
246 # return__.return_code_1: $(y_tmp) (expect=256)
aa6478748245 added makefile diagnostics
thomask
parents: 92
diff changeset
247 # dmd.cmd: $(DMD) $(DFLAGS) $(z_flags) -od$(OBJ_DIR) -of$@ $< $(to_log)
aa6478748245 added makefile diagnostics
thomask
parents: 92
diff changeset
248 $(eval z_return = $(shell $(return__) "$(DMD) $(DFLAGS) $(z_flags) -od$(OBJ_DIR) -of$@ $< $(to_log)"))
aa6478748245 added makefile diagnostics
thomask
parents: 92
diff changeset
249 # dmd.return: $(z_return)
aa6478748245 added makefile diagnostics
thomask
parents: 92
diff changeset
250 # for analyse_run diagnosis: '@if' -> 'if' in 'define analyse_run' (line 185)
aa6478748245 added makefile diagnostics
thomask
parents: 92
diff changeset
251 $(analyse_run)
aa6478748245 added makefile diagnostics
thomask
parents: 92
diff changeset
252
aa6478748245 added makefile diagnostics
thomask
parents: 92
diff changeset
253 #
46
1f7f839145de added complex test case(e.g. multi file) support
thomask
parents: 41
diff changeset
254 # target should compile and link but fail to run
1f7f839145de added complex test case(e.g. multi file) support
thomask
parents: 41
diff changeset
255 #
251
6cd84461e17b enabled new "dstress.c" test tool
thomask
parents: 239
diff changeset
256 norun : $(dstress__)
6cd84461e17b enabled new "dstress.c" test tool
thomask
parents: 239
diff changeset
257 rm -f norun/*.exe norun/*.$(ext_norun)
273
68b883fe4fad added *BSD support to the test framework
thomask
parents: 251
diff changeset
258 find norun/ -maxdepth 1 -name "?*.?*" | grep "." | sort | xargs -n 1 echo "$(dstress__) norun" > norun.sh
251
6cd84461e17b enabled new "dstress.c" test tool
thomask
parents: 239
diff changeset
259 chmod +x norun.sh
6cd84461e17b enabled new "dstress.c" test tool
thomask
parents: 239
diff changeset
260 ./norun.sh 2>> $(LOG)
0
3269e4627918 init dstress
svnowner
parents:
diff changeset
261
251
6cd84461e17b enabled new "dstress.c" test tool
thomask
parents: 239
diff changeset
262 # used in some complex test cases
75
edc279c4f7f9 makefile cleanup
thomask
parents: 72
diff changeset
263 define analyse_norun
72
b0e95b878322 added segfault detection support
thomask
parents: 63
diff changeset
264 @if $(ifeq__) $(z_return) 0; then \
b0e95b878322 added segfault detection support
thomask
parents: 63
diff changeset
265 if ./$@ $(to_log); \
58
eedf04fffdc3 re-aligned test output
thomask
parents: 46
diff changeset
266 then $(ECHO) "XPASS: $(z_name)"; $(RM) $@; \
46
1f7f839145de added complex test case(e.g. multi file) support
thomask
parents: 41
diff changeset
267 else \
72
b0e95b878322 added segfault detection support
thomask
parents: 63
diff changeset
268 $(ECHO) "XFAIL: $(z_name)"; \
46
1f7f839145de added complex test case(e.g. multi file) support
thomask
parents: 41
diff changeset
269 fi \
1f7f839145de added complex test case(e.g. multi file) support
thomask
parents: 41
diff changeset
270 else \
72
b0e95b878322 added segfault detection support
thomask
parents: 63
diff changeset
271 if $(ifeq__) $(z_return) 256 ; then \
b0e95b878322 added segfault detection support
thomask
parents: 63
diff changeset
272 $(ECHO) "FAIL: $(z_name) (compiling error)"; $(RM) $@; \
b0e95b878322 added segfault detection support
thomask
parents: 63
diff changeset
273 else \
75
edc279c4f7f9 makefile cleanup
thomask
parents: 72
diff changeset
274 $(ECHO) "ERROR: $(z_name) [$(z_return)]"; \
72
b0e95b878322 added segfault detection support
thomask
parents: 63
diff changeset
275 fi \
46
1f7f839145de added complex test case(e.g. multi file) support
thomask
parents: 41
diff changeset
276 fi
75
edc279c4f7f9 makefile cleanup
thomask
parents: 72
diff changeset
277 endef
edc279c4f7f9 makefile cleanup
thomask
parents: 72
diff changeset
278
46
1f7f839145de added complex test case(e.g. multi file) support
thomask
parents: 41
diff changeset
279 #
1f7f839145de added complex test case(e.g. multi file) support
thomask
parents: 41
diff changeset
280 # run all complex test cases
1f7f839145de added complex test case(e.g. multi file) support
thomask
parents: 41
diff changeset
281 #
251
6cd84461e17b enabled new "dstress.c" test tool
thomask
parents: 239
diff changeset
282 complex : basic_tools $(sort $(subst $(complex_todo),$(complex_done),$(complex_makefiles)))
32
315459a24bf4 fixed LOG and OBJ_DIR
thomask
parents: 31
diff changeset
283
46
1f7f839145de added complex test case(e.g. multi file) support
thomask
parents: 41
diff changeset
284 #
1f7f839145de added complex test case(e.g. multi file) support
thomask
parents: 41
diff changeset
285 #
1f7f839145de added complex test case(e.g. multi file) support
thomask
parents: 41
diff changeset
286 #
17
deb014248067 cleanup of makefile
thomask
parents: 14
diff changeset
287 distclean : clean_log clean
251
6cd84461e17b enabled new "dstress.c" test tool
thomask
parents: 239
diff changeset
288 $(RM) $(shell $(FIND) . -regex ".*~") $(shell $(FIND) . -regex "\\..*\\.swp") $(shell $(FIND) . -regex "#.*#")
6cd84461e17b enabled new "dstress.c" test tool
thomask
parents: 239
diff changeset
289 $(RM) $(return__) $(ifeq__) $(extract__) $(dstress__) www/*.class
6
e238a15dbc74 1) added added html-sourcefile support
thomask
parents: 0
diff changeset
290
46
1f7f839145de added complex test case(e.g. multi file) support
thomask
parents: 41
diff changeset
291 #
1f7f839145de added complex test case(e.g. multi file) support
thomask
parents: 41
diff changeset
292 # remove compiler and assertion messages
1f7f839145de added complex test case(e.g. multi file) support
thomask
parents: 41
diff changeset
293 #
0
3269e4627918 init dstress
svnowner
parents:
diff changeset
294 clean_log :
3269e4627918 init dstress
svnowner
parents:
diff changeset
295 $(RM) $(LOG)
3269e4627918 init dstress
svnowner
parents:
diff changeset
296
46
1f7f839145de added complex test case(e.g. multi file) support
thomask
parents: 41
diff changeset
297 #
1f7f839145de added complex test case(e.g. multi file) support
thomask
parents: 41
diff changeset
298 # remove targets and all temp objects
1f7f839145de added complex test case(e.g. multi file) support
thomask
parents: 41
diff changeset
299 #
1f7f839145de added complex test case(e.g. multi file) support
thomask
parents: 41
diff changeset
300 clean : $(sort $(subst $(complex_todo),clean,$(complex_makefiles)))
145
553c8aaa0982 added support for detecting segfaults with pseudo return code 1
thomask
parents: 109
diff changeset
301 $(RM) $(OBJ_DIR)/?*.?* nocompile/?*.$(ext_log)
46
1f7f839145de added complex test case(e.g. multi file) support
thomask
parents: 41
diff changeset
302 $(RM) run/?*.$(ext_run) norun/?*.$(ext_norun) compile/?*.$(ext_compile) nocompile/?*.$(ext_nocompile)
251
6cd84461e17b enabled new "dstress.c" test tool
thomask
parents: 239
diff changeset
303 $(RM) run.sh norun.sh compile.sh nocompile.sh
83
6a56a7866943 added ?DSTRESS_FLAGS? support (2)
thomask
parents: 80
diff changeset
304
6a56a7866943 added ?DSTRESS_FLAGS? support (2)
thomask
parents: 80
diff changeset
305 # the empty line above has to remain, otherwise some weired problems can arise