2 # /**-------------------------------------------------------------------**
4 # **-------------------------------------------------------------------**
6 # **-------------------------------------------------------------------**
7 # ** First version: march 6th 2003 **
8 # **-------------------------------------------------------------------**/
10 # makefile for checking.
12 #/*****************************************************************************
13 # * CLooG : the Chunky Loop Generator (experimental) *
14 # *****************************************************************************
16 # * Copyright (C) 2003 Cedric Bastoul *
18 # * This library is free software; you can redistribute it and/or *
19 # * modify it under the terms of the GNU Lesser General Public *
20 # * License as published by the Free Software Foundation; either *
21 # * version 2.1 of the License, or (at your option) any later version. *
23 # * This library is distributed in the hope that it will be useful, *
24 # * but WITHOUT ANY WARRANTY; without even the implied warranty of *
25 # * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
26 # * Lesser General Public License for more details. *
28 # * You should have received a copy of the GNU Lesser General Public *
29 # * License along with this library; if not, write to the Free Software *
30 # * Foundation, Inc., 51 Franklin Street, Fifth Floor, *
31 # * Boston, MA 02110-1301 USA *
33 # * CLooG, the Chunky Loop Generator *
34 # * Written by Cedric Bastoul, Cedric.Bastoul@inria.fr *
35 # * This file has been written with the help of the Bart Kienhuis's checking *
36 # * makefile for PipLib. *
38 # *****************************************************************************/
40 noinst_PROGRAMS = generate_test
41 INCLUDES = -I$(top_builddir)/include -I$(top_srcdir)/include
42 LDADD = ../libcloog-@BACKEND@.la
43 generate_test_SOURCES = generate_test.c
46 ../libcloog-@BACKEND@.la: FORCE
47 cd ..; $(MAKE) $(AM_MAKEFLAGS) libcloog-@BACKEND@.la
51 FINITE_CLOOGTEST_C = \
108 square+triangle-1-1-2-3 \
119 ./non_optimal/nul_complex1 \
120 ./non_optimal/usvd_e_t \
121 ./non_optimal/youcef \
122 ./reservoir/cholesky2 \
123 ./reservoir/fusion1 \
124 ./reservoir/fusion2 \
125 ./reservoir/jacobi2 \
126 ./reservoir/jacobi3 \
127 ./reservoir/lim-lam1 \
128 ./reservoir/lim-lam2 \
129 ./reservoir/lim-lam3 \
130 ./reservoir/lim-lam4 \
131 ./reservoir/lim-lam5 \
132 ./reservoir/lim-lam6 \
133 ./reservoir/liu-zhuge1 \
134 ./reservoir/loechner3 \
135 ./reservoir/loechner4 \
136 ./reservoir/loechner5 \
137 ./reservoir/mg-interp2 \
138 ./reservoir/mg-interp \
139 ./reservoir/mg-psinv \
140 ./reservoir/mg-resid \
141 ./reservoir/mg-rprj3 \
142 ./reservoir/pingali1 \
143 ./reservoir/pingali2 \
144 ./reservoir/pingali3 \
145 ./reservoir/pingali4 \
146 ./reservoir/pingali5 \
147 ./reservoir/pingali6 \
149 ./reservoir/tang-xue1 \
157 $(FINITE_CLOOGTEST_C)
162 CLOOGTEST_FORTRAN = \
168 CLOOGTEST_STRIDED = \
187 "vasilache" "-f 8 -l 9" "\n" \
188 "merge" "-f -1" "\n" \
189 "equality" "-f -1 -l 2 -override" "\n" \
190 "equality2" "-f -1 -l 4 -esp 1 -override" "\n" \
191 "stride" "-f -1 -strides 1" "\n" \
192 "stride2" "-f -1 -strides 1"
195 $(CLOOGTEST_C:%=%.cloog) \
196 $(CLOOGTEST_C:%=isl/%.c) \
197 $(CLOOGTEST_C:%=polylib/%.c) \
198 $(FINITE_CLOOGTEST_C:%=%.good.c) \
199 $(CLOOGTEST_FORTRAN:%=%.cloog) \
200 $(CLOOGTEST_FORTRAN:%=isl/%.f) \
201 $(CLOOGTEST_FORTRAN:%=polylib/%.f) \
202 $(CLOOGTEST_STRIDED:%=%.cloog) \
203 $(CLOOGTEST_STRIDED:%=isl/%.c) \
204 $(CLOOGTEST_STRIDED:%=polylib/%.c) \
205 $(SPECIAL_TESTS:%=%.cloog) \
206 $(SPECIAL_TESTS:%=isl/%.c) \
207 $(SPECIAL_TESTS:%=polylib/%.c) \
208 $(SPECIAL_TESTS:%=%.good.c)
211 @echo " /*-----------------------------------------------*"
212 @echo " * Generate files *"
213 @echo " *-----------------------------------------------*/"
214 @for x in $(CLOOGTEST_C) ; do \
215 echo "Generate $$x.c" ; \
216 $(top_builddir)/cloog $(srcdir)/$$x.cloog -o $(srcdir)/@BACKEND@/$$x.c ; \
218 for x in $(CLOOGTEST_FORTRAN) ; do \
219 echo "Generate $$x.f" ; \
220 $(top_builddir)/cloog $(srcdir)/$$x.cloog -o $(srcdir)/@BACKEND@/$$x.f ; \
222 for x in $(CLOOGTEST_STRIDED) ; do \
223 echo "Generate $$x.c" ; \
224 $(top_builddir)/cloog $(srcdir)/$$x.cloog \
225 -strides 1 -o $(srcdir)/@BACKEND@/$$x.c ; \
227 (echo -e $(SPECIAL_OPTIONS)) | while read x options; do \
228 echo "Generate file $$x ($$options)" ; \
229 $(top_builddir)/cloog$(EXEEXT) $(srcdir)/$$x.cloog \
230 $$options > $(srcdir)/@BACKEND@/$$x.c ; \
234 @for x in $(FINITE_CLOOGTEST_C) ; do \
235 echo "Generate $$x.good.c" ; \
236 $(top_builddir)/cloog$(EXEEXT) -callable 1 $(srcdir)/$$x.cloog -o $(srcdir)/$$x.good.c ; \
238 (echo -e $(SPECIAL_OPTIONS)) | while read x options; do \
239 echo "Generate $$x.good.c ($$options)" ; \
240 $(top_builddir)/cloog$(EXEEXT) -callable 1 $$options $(srcdir)/$$x.cloog -o $(srcdir)/$$x.good.c ; \
244 @echo " /*-----------------------------------------------*"
245 @echo " * Checking files by Valgrind *"
246 @echo " *-----------------------------------------------*/"
247 for x in $(CLOOGTEST_C) ; do \
248 echo "Valgrinding $$x.c" ; \
249 valgrind $(top_builddir)/cloog$(EXEEXT) $(srcdir)/$$x.cloog ; \
251 for x in $(CLOOGTEST_FORTRAN) ; do \
252 echo "Valgrinding $$x.f" ; \
253 valgrind $(top_builddir)/cloog$(EXEEXT) $(srcdir)/$$x.cloog ; \
256 test_run: generate_test$(EXEEXT)
257 @echo " /*-----------------------------------------------*"
258 @echo " * Testing CLooG *"
259 @echo " *-----------------------------------------------*/"
261 echo "--- Testing C files... (correct output)" ; \
262 for x in $(FINITE_CLOOGTEST_C) ; do \
263 echo -n "Verify file $$x... " ; \
264 echo -n "generating... " ; \
265 $(top_builddir)/cloog$(EXEEXT) -q -callable 1 $(srcdir)/$$x.cloog > test_test.c ; \
266 ./generate_test$(EXEEXT) < $(srcdir)/$$x.cloog > test_main.c; \
267 echo -n "compiling... " ; \
268 $(COMPILE) -c test_test.c; \
269 $(COMPILE) -Dtest=good -c $(srcdir)/$$x.good.c -o test_good.o; \
270 $(LINK) test_main.c test_test.o test_good.o > /dev/null; \
271 echo -n "comparing... " ; \
272 ./test_run$(EXEEXT); \
274 if test "$$result" -ne "0" ; then \
275 failedtest=`expr $$failedtest + 1` ; \
280 (echo -e $(SPECIAL_OPTIONS)) | while read x options; do \
281 echo -n "Verify file $$x ($$options)... " ; \
282 echo -n "generating... " ; \
283 $(top_builddir)/cloog$(EXEEXT) -q -callable 1 $$options $(srcdir)/$$x.cloog > test_test.c ; \
284 ./generate_test$(EXEEXT) < $(srcdir)/$$x.cloog > test_main.c; \
285 echo -n "compiling... " ; \
286 $(COMPILE) -c test_test.c; \
287 $(COMPILE) -Dtest=good -c $(srcdir)/$$x.good.c -o test_good.o; \
288 $(LINK) test_main.c test_test.o test_good.o > /dev/null; \
289 echo -n "comparing... " ; \
290 ./test_run$(EXEEXT); \
292 if test "$$result" -ne "0" ; then \
293 failedtest=`expr $$failedtest + 1` ; \
298 (echo -e $(SPECIAL_OPTIONS)) | while read x options; do \
299 echo -n "Verify file $$x ($$options -sh 1)... " ; \
300 echo -n "generating... " ; \
301 $(top_builddir)/cloog$(EXEEXT) -q -callable 1 $$options -sh 1 $(srcdir)/$$x.cloog > test_test.c ; \
302 ./generate_test$(EXEEXT) < $(srcdir)/$$x.cloog > test_main.c; \
303 echo -n "compiling... " ; \
304 $(COMPILE) -c test_test.c; \
305 $(COMPILE) -Dtest=good -c $(srcdir)/$$x.good.c -o test_good.o; \
306 $(LINK) test_main.c test_test.o test_good.o > /dev/null; \
307 echo -n "comparing... " ; \
308 ./test_run$(EXEEXT); \
310 if test "$$result" -ne "0" ; then \
311 failedtest=`expr $$failedtest + 1` ; \
316 if [ $$failedtest != 0 ] ; then \
317 echo "$$failedtest tests failed" ; \
319 echo "CLooG works correctly :-) !" ; \
322 @echo " /*-----------------------------------------------*"
323 @echo " * Testing CLooG *"
324 @echo " *-----------------------------------------------*/"
326 echo "--- Testing C files... (expected output)" ; \
327 for x in $(CLOOGTEST_C) ; do \
328 echo "Verify file $$x" ; \
329 $(top_builddir)/cloog$(EXEEXT) $(srcdir)/$$x.cloog > ttemp ; \
330 diff -u -w --ignore-matching-lines='CLooG' ttemp $(srcdir)/@BACKEND@/$$x.c ; \
332 if [ "$$result" -ne "0" ] ; then \
333 echo "!!! Error: $$x is not the same" ; \
334 failedtest=`expr $$failedtest + 1` ; \
336 echo "$$x passed" ; \
339 echo "--- Testing FORTRAN files..." ; \
340 for x in $(CLOOGTEST_FORTRAN) ; do \
341 echo "Verify file $$x" ; \
342 $(top_builddir)/cloog$(EXEEXT) $(srcdir)/$$x.cloog > ttemp ; \
343 diff -u -w --ignore-matching-lines='CLooG' ttemp $(srcdir)/@BACKEND@/$$x.f ; \
345 if [ "$$result" -ne "0" ] ; then \
346 echo "!!! Error: $$x is not the same" ; \
347 failedtest=`expr $$failedtest + 1` ; \
349 echo "$$x passed" ; \
352 echo "--- Testing STRIDED files..." ; \
353 for x in $(CLOOGTEST_STRIDED) ; do \
354 echo "Verify file $$x" ; \
355 $(top_builddir)/cloog$(EXEEXT) $(srcdir)/$$x.cloog \
356 -strides 1 > ttemp ; \
357 diff -u -w --ignore-matching-lines='CLooG' ttemp $(srcdir)/@BACKEND@/$$x.c ; \
359 if [ "$$result" -ne "0" ] ; then \
360 echo "!!! Error: $$x is not the same" ; \
361 failedtest=`expr $$failedtest + 1` ; \
363 echo "$$x passed" ; \
366 echo "--- Testing SPECIAL OPTIONS files..." ; \
367 (echo -e $(SPECIAL_OPTIONS)) | (while read x options; do \
368 echo "Verify file $$x ($$options)" ; \
369 $(top_builddir)/cloog$(EXEEXT) $(srcdir)/$$x.cloog \
370 $$options > ttemp ; \
371 diff -u -w --ignore-matching-lines='CLooG' ttemp $(srcdir)/@BACKEND@/$$x.c ; \
373 if [ "$$result" -ne "0" ] ; then \
374 echo "!!! Error: $$x is not the same" ; \
375 failedtest=`expr $$failedtest + 1` ; \
377 echo "$$x passed" ; \
379 done; exit $$failedtest; ); \
382 if [ $$failedtest != 0 ] ; then \
383 echo "$$failedtest tests failed" ; \
385 echo "CLooG works correctly :-) !" ; \