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 = \
179 "vasilache" "-f 8 -l 9" "\n" \
180 "merge" "-f -1" "\n" \
181 "equality" "-f -1 -l 2 -override" "\n" \
182 "equality2" "-f -1 -l 4 -esp 1 -override"
185 $(CLOOGTEST_C:%=%.cloog) \
186 $(CLOOGTEST_C:%=isl/%.c) \
187 $(CLOOGTEST_C:%=polylib/%.c) \
188 $(FINITE_CLOOGTEST_C:%=%.good.c) \
189 $(CLOOGTEST_FORTRAN:%=%.cloog) \
190 $(CLOOGTEST_FORTRAN:%=isl/%.f) \
191 $(CLOOGTEST_FORTRAN:%=polylib/%.f) \
192 $(CLOOGTEST_STRIDED:%=%.cloog) \
193 $(CLOOGTEST_STRIDED:%=isl/%.c) \
194 $(CLOOGTEST_STRIDED:%=polylib/%.c) \
195 isl/vasilache.c polylib/vasilache.c vasilache.cloog \
196 isl/merge.c polylib/merge.c merge.cloog \
197 isl/equality.c polylib/equality.c equality.cloog \
198 isl/equality2.c polylib/equality2.c equality2.cloog
201 @echo " /*-----------------------------------------------*"
202 @echo " * Generate files *"
203 @echo " *-----------------------------------------------*/"
204 @for x in $(CLOOGTEST_C) ; do \
205 echo "Generate $$x.c" ; \
206 $(top_builddir)/cloog $(srcdir)/$$x.cloog -o $(srcdir)/@BACKEND@/$$x.c ; \
208 for x in $(CLOOGTEST_FORTRAN) ; do \
209 echo "Generate $$x.f" ; \
210 $(top_builddir)/cloog $(srcdir)/$$x.cloog -o $(srcdir)/@BACKEND@/$$x.f ; \
212 for x in $(CLOOGTEST_STRIDED) ; do \
213 echo "Generate $$x.c" ; \
214 $(top_builddir)/cloog $(srcdir)/$$x.cloog \
215 -strides 1 -o $(srcdir)/@BACKEND@/$$x.c ; \
217 (echo -e $(SPECIAL_OPTIONS)) | while read x options; do \
218 echo "Generate file $$x ($$options)" ; \
219 $(top_builddir)/cloog$(EXEEXT) $(srcdir)/$$x.cloog \
220 $$options > $(srcdir)/@BACKEND@/$$x.c ; \
224 @for x in $(FINITE_CLOOGTEST_C) ; do \
225 echo "Generate $$x.good.c" ; \
226 $(top_builddir)/cloog$(EXEEXT) -callable 1 $(srcdir)/$$x.cloog -o $(srcdir)/$$x.good.c ; \
228 (echo -e $(SPECIAL_OPTIONS)) | while read x options; do \
229 echo "Generate $$x.good.c ($$options)" ; \
230 $(top_builddir)/cloog$(EXEEXT) -callable 1 $$options $(srcdir)/$$x.cloog -o $(srcdir)/$$x.good.c ; \
234 @echo " /*-----------------------------------------------*"
235 @echo " * Checking files by Valgrind *"
236 @echo " *-----------------------------------------------*/"
237 for x in $(CLOOGTEST_C) ; do \
238 echo "Valgrinding $$x.c" ; \
239 valgrind $(top_builddir)/cloog$(EXEEXT) $(srcdir)/$$x.cloog ; \
241 for x in $(CLOOGTEST_FORTRAN) ; do \
242 echo "Valgrinding $$x.f" ; \
243 valgrind $(top_builddir)/cloog$(EXEEXT) $(srcdir)/$$x.cloog ; \
246 test_run: generate_test$(EXEEXT)
247 @echo " /*-----------------------------------------------*"
248 @echo " * Testing CLooG *"
249 @echo " *-----------------------------------------------*/"
251 echo "--- Testing C files... (correct output)" ; \
252 for x in $(FINITE_CLOOGTEST_C) ; do \
253 echo -n "Verify file $$x... " ; \
254 echo -n "generating... " ; \
255 $(top_builddir)/cloog$(EXEEXT) -q -callable 1 $(srcdir)/$$x.cloog > test_test.c ; \
256 ./generate_test$(EXEEXT) < $(srcdir)/$$x.cloog > test_main.c; \
257 echo -n "compiling... " ; \
258 $(COMPILE) -c test_test.c; \
259 $(COMPILE) -Dtest=good -c $(srcdir)/$$x.good.c -o test_good.o; \
260 $(LINK) test_main.c test_test.o test_good.o > /dev/null; \
261 echo -n "comparing... " ; \
262 ./test_run$(EXEEXT); \
264 if test "$$result" -ne "0" ; then \
265 failedtest=`expr $$failedtest + 1` ; \
270 (echo -e $(SPECIAL_OPTIONS)) | while read x options; do \
271 echo -n "Verify file $$x ($$options)... " ; \
272 echo -n "generating... " ; \
273 $(top_builddir)/cloog$(EXEEXT) -q -callable 1 $$options $(srcdir)/$$x.cloog > test_test.c ; \
274 ./generate_test$(EXEEXT) < $(srcdir)/$$x.cloog > test_main.c; \
275 echo -n "compiling... " ; \
276 $(COMPILE) -c test_test.c; \
277 $(COMPILE) -Dtest=good -c $(srcdir)/$$x.good.c -o test_good.o; \
278 $(LINK) test_main.c test_test.o test_good.o > /dev/null; \
279 echo -n "comparing... " ; \
280 ./test_run$(EXEEXT); \
282 if test "$$result" -ne "0" ; then \
283 failedtest=`expr $$failedtest + 1` ; \
288 (echo -e $(SPECIAL_OPTIONS)) | while read x options; do \
289 echo -n "Verify file $$x ($$options -sh 1)... " ; \
290 echo -n "generating... " ; \
291 $(top_builddir)/cloog$(EXEEXT) -q -callable 1 $$options -sh 1 $(srcdir)/$$x.cloog > test_test.c ; \
292 ./generate_test$(EXEEXT) < $(srcdir)/$$x.cloog > test_main.c; \
293 echo -n "compiling... " ; \
294 $(COMPILE) -c test_test.c; \
295 $(COMPILE) -Dtest=good -c $(srcdir)/$$x.good.c -o test_good.o; \
296 $(LINK) test_main.c test_test.o test_good.o > /dev/null; \
297 echo -n "comparing... " ; \
298 ./test_run$(EXEEXT); \
300 if test "$$result" -ne "0" ; then \
301 failedtest=`expr $$failedtest + 1` ; \
306 if [ $$failedtest != 0 ] ; then \
307 echo "$$failedtest tests failed" ; \
309 echo "CLooG works correctly :-) !" ; \
312 @echo " /*-----------------------------------------------*"
313 @echo " * Testing CLooG *"
314 @echo " *-----------------------------------------------*/"
316 echo "--- Testing C files... (expected output)" ; \
317 for x in $(CLOOGTEST_C) ; do \
318 echo "Verify file $$x" ; \
319 $(top_builddir)/cloog$(EXEEXT) $(srcdir)/$$x.cloog > ttemp ; \
320 diff -u -w --ignore-matching-lines='CLooG' ttemp $(srcdir)/@BACKEND@/$$x.c ; \
322 if [ "$$result" -ne "0" ] ; then \
323 echo "!!! Error: $$x is not the same" ; \
324 failedtest=`expr $$failedtest + 1` ; \
326 echo "$$x passed" ; \
329 echo "--- Testing FORTRAN files..." ; \
330 for x in $(CLOOGTEST_FORTRAN) ; do \
331 echo "Verify file $$x" ; \
332 $(top_builddir)/cloog$(EXEEXT) $(srcdir)/$$x.cloog > ttemp ; \
333 diff -u -w --ignore-matching-lines='CLooG' ttemp $(srcdir)/@BACKEND@/$$x.f ; \
335 if [ "$$result" -ne "0" ] ; then \
336 echo "!!! Error: $$x is not the same" ; \
337 failedtest=`expr $$failedtest + 1` ; \
339 echo "$$x passed" ; \
342 echo "--- Testing STRIDED files..." ; \
343 for x in $(CLOOGTEST_STRIDED) ; do \
344 echo "Verify file $$x" ; \
345 $(top_builddir)/cloog$(EXEEXT) $(srcdir)/$$x.cloog \
346 -strides 1 > ttemp ; \
347 diff -u -w --ignore-matching-lines='CLooG' ttemp $(srcdir)/@BACKEND@/$$x.c ; \
349 if [ "$$result" -ne "0" ] ; then \
350 echo "!!! Error: $$x is not the same" ; \
351 failedtest=`expr $$failedtest + 1` ; \
353 echo "$$x passed" ; \
356 echo "--- Testing SPECIAL OPTIONS files..." ; \
357 (echo -e $(SPECIAL_OPTIONS)) | (while read x options; do \
358 echo "Verify file $$x ($$options)" ; \
359 $(top_builddir)/cloog$(EXEEXT) $(srcdir)/$$x.cloog \
360 $$options > ttemp ; \
361 diff -u -w --ignore-matching-lines='CLooG' ttemp $(srcdir)/@BACKEND@/$$x.c ; \
363 if [ "$$result" -ne "0" ] ; then \
364 echo "!!! Error: $$x is not the same" ; \
365 failedtest=`expr $$failedtest + 1` ; \
367 echo "$$x passed" ; \
369 done; exit $$failedtest; ); \
372 if [ $$failedtest != 0 ] ; then \
373 echo "$$failedtest tests failed" ; \
375 echo "CLooG works correctly :-) !" ; \