detect strides even if the remainder of the lower bound depends on outer iterators
[cloog.git] / test / Makefile.am
blob4f8d4719cd1f9ef83f6b0dc787e1590f5df0ed0b
2 #   /**-------------------------------------------------------------------**
3 #    **                              CLooG                                **
4 #    **-------------------------------------------------------------------**
5 #    **                            makefile                               **
6 #    **-------------------------------------------------------------------**
7 #    **                   First version: march 6th 2003                   **
8 #    **-------------------------------------------------------------------**/
10 # makefile for checking.
12 #/*****************************************************************************
13 # *               CLooG : the Chunky Loop Generator (experimental)            *
14 # *****************************************************************************
15 # *                                                                           *
16 # * Copyright (C) 2003 Cedric Bastoul                                         *
17 # *                                                                           *
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.        *
22 # *                                                                           *
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.                           *
27 # *                                                                           *
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                                               *
32 # *                                                                           *
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.                                                      *
37 # *                                                                           *
38 # *****************************************************************************/
40 if NO_ISL
41 GENERATE_TEST =
42 else
43 GENERATE_TEST = generate_test
44 endif
45 noinst_PROGRAMS = $(GENERATE_TEST)
46 INCLUDES = -I$(top_builddir)/include -I$(top_srcdir)/include
47 LDADD = ../libcloog-isl.la
48 generate_test_SOURCES = generate_test.c
50 FORCE:
51 ../libcloog-isl.la: FORCE
52         cd ..; $(MAKE) $(AM_MAKEFLAGS) libcloog-isl.la
54 ROOT = ..
56 FINITE_CLOOGTEST_C =                   \
57         0D-1                           \
58         0D-2                           \
59         0D-3                           \
60         1point-1                       \
61         1point-2                       \
62         4-param                        \
63         basic-bounds-1                 \
64         basic-bounds-2                 \
65         basic-bounds-3                 \
66         basic-bounds-4                 \
67         basic-bounds-5                 \
68         basic-bounds-6                 \
69         block                          \
70         block2                         \
71         byu98-1-2-3                    \
72         cholesky                       \
73         cholesky2                      \
74         classen                        \
75         classen2                       \
76         constbound                     \
77         darte                          \
78         dealII                         \
79         donotsimp                      \
80         dot                            \
81         dot2                           \
82         double                         \
83         durbin_e_s                     \
84         emploi                         \
85         esced                          \
86         ex1                            \
87         forwardsub-1-1-2               \
88         forwardsub-2-1-2-3             \
89         forwardsub-3-1-2               \
90         gauss                          \
91         gesced                         \
92         gesced2                        \
93         gesced3                        \
94         guide                          \
95         iftest                         \
96         iftest2                        \
97         largeur                        \
98         levenshtein-1-2-3              \
99         lex                            \
100         lineality-1-2                  \
101         lineality-2-1-2                \
102         logo                           \
103         logopar                        \
104         lu                             \
105         lu2                            \
106         lub                            \
107         lux                            \
108         min-1-1                        \
109         min-2-1                        \
110         min-3-1                        \
111         min-4-1                        \
112         mode                           \
113         multi-mm-1                     \
114         no_lindep                      \
115         orc                            \
116         rectangle                      \
117         singleton                      \
118         square+triangle-1-1-2-3        \
119         swim                           \
120         test                           \
121         thomasset                      \
122         tiling                         \
123         uday_scalars                   \
124         vivien                         \
125         vivien2                        \
126         walters                        \
127         walters2                       \
128         wavefront                      \
129         yosr                           \
130         yosr2                          \
131         ./non_optimal/nul_complex1     \
132         ./non_optimal/usvd_e_t         \
133         ./non_optimal/youcef           \
134         ./reservoir/cholesky2          \
135         ./reservoir/fusion1            \
136         ./reservoir/fusion2            \
137         ./reservoir/jacobi2            \
138         ./reservoir/jacobi3            \
139         ./reservoir/lim-lam1           \
140         ./reservoir/lim-lam2           \
141         ./reservoir/lim-lam3           \
142         ./reservoir/lim-lam4           \
143         ./reservoir/lim-lam5           \
144         ./reservoir/lim-lam6           \
145         ./reservoir/liu-zhuge1         \
146         ./reservoir/loechner3          \
147         ./reservoir/loechner4          \
148         ./reservoir/loechner5          \
149         ./reservoir/mg-interp2         \
150         ./reservoir/mg-interp          \
151         ./reservoir/mg-psinv           \
152         ./reservoir/mg-resid           \
153         ./reservoir/mg-rprj3           \
154         ./reservoir/pingali1           \
155         ./reservoir/pingali2           \
156         ./reservoir/pingali3           \
157         ./reservoir/pingali4           \
158         ./reservoir/pingali5           \
159         ./reservoir/pingali6           \
160         ./reservoir/QR                 \
161         ./reservoir/tang-xue1          \
162         ./reservoir/two   
164 CLOOGTEST_C =                          \
165         infinite                       \
166         infinite2                      \
167         infinite3                      \
168         infinite4                      \
169         $(FINITE_CLOOGTEST_C)
171 #       ./reservoir/long               \
172 #       faber
174 CLOOGTEST_FORTRAN =                    \
175         dartef                         \
176         iftestf                        \
177         levenshtein-1-2-3f             \
178         yosrf
180 CLOOGTEST_STRIDED =                    \
181         basic-bounds-2                 \
182         mod4                           \
183         nul_basic1                     \
184         nul_basic2                     \
185         nul_lcpc                       \
186         multi-stride                   \
187         multi-stride2                  \
188         stride3                        \
189         reservoir/bastoul3             \
190         reservoir/stride               \
191         reservoir/stride2
193 SPECIAL_TESTS = \
194         vasilache \
195         merge \
196         equality \
197         equality2 \
198         param-split \
199         stride \
200         stride2 \
201         sor1d
202 SPECIAL_OPTIONS = \
203         'vasilache -f 8 -l 9' \
204         'merge -f -1' \
205         'equality -f -1 -l 2 -override' \
206         'equality2 -f -1 -l 4 -esp 1 -override' \
207         'otl -block 1 -esp 0 -otl 0' \
208         'param-split -f -1' \
209         'stride -f -1 -strides 1' \
210         'stride2 -f -1 -strides 1' \
211         'sor1d -f -1'
213 EXTRA_DIST = \
214         $(CLOOGTEST_C:%=%.cloog) \
215         $(CLOOGTEST_C:%=%.c) \
216         $(FINITE_CLOOGTEST_C:%=%.good.c) \
217         $(CLOOGTEST_FORTRAN:%=%.cloog) \
218         $(CLOOGTEST_FORTRAN:%=%.f) \
219         $(CLOOGTEST_STRIDED:%=%.cloog) \
220         $(CLOOGTEST_STRIDED:%=%.c) \
221         $(SPECIAL_TESTS:%=%.cloog) \
222         $(SPECIAL_TESTS:%=%.c) \
223         $(SPECIAL_TESTS:%=%.good.c)
225 generate:
226         @echo "             /*-----------------------------------------------*"
227         @echo "              *                 Generate files                *"
228         @echo "              *-----------------------------------------------*/"
229         @for x in $(CLOOGTEST_C) ; do \
230                 echo "Generate $$x.c" ; \
231                 $(top_builddir)/cloog $(srcdir)/$$x.cloog -o $(srcdir)/$$x.c ; \
232         done ; \
233         for x in $(CLOOGTEST_FORTRAN) ; do \
234                 echo "Generate $$x.f" ; \
235                 $(top_builddir)/cloog $(srcdir)/$$x.cloog -o $(srcdir)/$$x.f ; \
236         done ; \
237         for x in $(CLOOGTEST_STRIDED) ; do \
238                 echo "Generate $$x.c" ; \
239                 $(top_builddir)/cloog $(srcdir)/$$x.cloog \
240                         -strides 1 -o $(srcdir)/$$x.c ; \
241         done ; \
242         for line in $(SPECIAL_OPTIONS); do echo $$line | while read x options; do \
243                 echo "Generate file $$x ($$options)" ; \
244                 $(top_builddir)/cloog$(EXEEXT) $(srcdir)/$$x.cloog \
245                     $$options > $(srcdir)/$$x.c ; \
246         done; done
248 generate_good:
249         @for x in $(FINITE_CLOOGTEST_C) ; do \
250                 echo "Generate $$x.good.c" ; \
251                 $(top_builddir)/cloog$(EXEEXT) -callable 1 $(srcdir)/$$x.cloog -o $(srcdir)/$$x.good.c ; \
252         done; \
253         for line in $(SPECIAL_OPTIONS); do echo $$line | while read x options; do \
254                 echo "Generate $$x.good.c ($$options)" ; \
255                 $(top_builddir)/cloog$(EXEEXT) -callable 1 $$options $(srcdir)/$$x.cloog -o $(srcdir)/$$x.good.c ; \
256         done; done
258 valgrind:
259         @echo "             /*-----------------------------------------------*"
260         @echo "              *            Checking files by Valgrind         *"
261         @echo "              *-----------------------------------------------*/"
262         for x in $(CLOOGTEST_C) ; do \
263                 echo "Valgrinding $$x.c" ; \
264                 valgrind $(top_builddir)/cloog$(EXEEXT) $(srcdir)/$$x.cloog ; \
265         done ; \
266         for x in $(CLOOGTEST_FORTRAN) ; do \
267                 echo "Valgrinding $$x.f" ; \
268                 valgrind $(top_builddir)/cloog$(EXEEXT) $(srcdir)/$$x.cloog ; \
269         done
271 test_run: generate_test$(EXEEXT)
272         @echo "             /*-----------------------------------------------*"
273         @echo "              *                 Testing CLooG                 *"
274         @echo "              *-----------------------------------------------*/"
275         @failedtest=0 ; \
276         echo "--- Testing C files... (correct output)" ; \
277         for x in $(FINITE_CLOOGTEST_C) ; do \
278                 echo -n "Verify file $$x... " ; \
279                 echo -n "generating... " ; \
280                 $(top_builddir)/cloog$(EXEEXT) -q -callable 1 $(srcdir)/$$x.cloog > test_test.c ; \
281                 ./generate_test$(EXEEXT) < $(srcdir)/$$x.cloog > test_main.c; \
282                 echo -n "compiling... " ; \
283                 $(COMPILE) -c test_test.c; \
284                 $(COMPILE) -Dtest=good -c $(srcdir)/$$x.good.c -o test_good.o; \
285                 $(LINK) test_main.c test_test.o test_good.o > /dev/null; \
286                 echo -n "comparing... " ; \
287                 ./test_run$(EXEEXT); \
288                 result=$$?; \
289                 if test "$$result" -ne "0" ; then \
290                         failedtest=`expr $$failedtest + 1` ; \
291                 fi; \
292                 $(RM) $@; \
293                 echo; \
294         done; \
295         for line in $(SPECIAL_OPTIONS); do echo $$line | while read x options; do \
296                 echo -n "Verify file $$x ($$options)... " ; \
297                 echo -n "generating... " ; \
298                 $(top_builddir)/cloog$(EXEEXT) -q -callable 1 $$options $(srcdir)/$$x.cloog > test_test.c ; \
299                 ./generate_test$(EXEEXT) < $(srcdir)/$$x.cloog > test_main.c; \
300                 echo -n "compiling... " ; \
301                 $(COMPILE) -c test_test.c; \
302                 $(COMPILE) -Dtest=good -c $(srcdir)/$$x.good.c -o test_good.o; \
303                 $(LINK) test_main.c test_test.o test_good.o > /dev/null; \
304                 echo -n "comparing... " ; \
305                 ./test_run$(EXEEXT); \
306                 result=$$?; \
307                 if test "$$result" -ne "0" ; then \
308                         failedtest=`expr $$failedtest + 1` ; \
309                 fi; \
310                 $(RM) $@; \
311                 echo; \
312         done; done; \
313         for line in $(SPECIAL_OPTIONS); do echo $$line | while read x options; do \
314                 echo -n "Verify file $$x ($$options -sh 1)... " ; \
315                 echo -n "generating... " ; \
316                 $(top_builddir)/cloog$(EXEEXT) -q -callable 1 $$options -sh 1 $(srcdir)/$$x.cloog > test_test.c ; \
317                 ./generate_test$(EXEEXT) < $(srcdir)/$$x.cloog > test_main.c; \
318                 echo -n "compiling... " ; \
319                 $(COMPILE) -c test_test.c; \
320                 $(COMPILE) -Dtest=good -c $(srcdir)/$$x.good.c -o test_good.o; \
321                 $(LINK) test_main.c test_test.o test_good.o > /dev/null; \
322                 echo -n "comparing... " ; \
323                 ./test_run$(EXEEXT); \
324                 result=$$?; \
325                 if test "$$result" -ne "0" ; then \
326                         failedtest=`expr $$failedtest + 1` ; \
327                 fi; \
328                 $(RM) $@; \
329                 echo; \
330         done; done; \
331         if [ $$failedtest != 0 ] ; then \
332                 echo "$$failedtest tests failed" ; \
333         else \
334                 echo "CLooG works correctly :-) !" ; \
335         fi
336 test:
337         @echo "             /*-----------------------------------------------*"
338         @echo "              *                 Testing CLooG                 *"
339         @echo "              *-----------------------------------------------*/"
340         @failedtest=0 ; \
341         echo "--- Testing C files... (expected output)" ; \
342         for x in $(CLOOGTEST_C) ; do \
343                 echo "Verify file $$x" ; \
344                 $(top_builddir)/cloog$(EXEEXT) $(srcdir)/$$x.cloog > ttemp ; \
345                 diff -u -w --ignore-matching-lines='CLooG' ttemp $(srcdir)/$$x.c ; \
346                 result=$$?; \
347                 if [ "$$result" -ne "0" ] ; then \
348                         echo "!!! Error: $$x is not the same" ; \
349                         failedtest=`expr $$failedtest + 1` ; \
350                 else \
351                         echo "$$x passed" ; \
352                 fi ; \
353         done ; \
354         echo "--- Testing FORTRAN files..." ; \
355         for x in $(CLOOGTEST_FORTRAN) ; do \
356                 echo "Verify file $$x" ; \
357                 $(top_builddir)/cloog$(EXEEXT) $(srcdir)/$$x.cloog > ttemp ; \
358                 diff -u -w --ignore-matching-lines='CLooG' ttemp $(srcdir)/$$x.f ; \
359                 result=$$?; \
360                 if [ "$$result" -ne "0" ] ; then \
361                         echo "!!! Error: $$x is not the same" ; \
362                         failedtest=`expr $$failedtest + 1` ; \
363                 else \
364                         echo "$$x passed" ; \
365                 fi ; \
366         done ; \
367         echo "--- Testing STRIDED files..." ; \
368         for x in $(CLOOGTEST_STRIDED) ; do \
369                 echo "Verify file $$x" ; \
370                 $(top_builddir)/cloog$(EXEEXT) $(srcdir)/$$x.cloog \
371                 -strides 1 > ttemp ; \
372                 diff -u -w --ignore-matching-lines='CLooG' ttemp $(srcdir)/$$x.c ; \
373                 result=$$?; \
374                 if [ "$$result" -ne "0" ] ; then \
375                         echo "!!! Error: $$x is not the same" ; \
376                         failedtest=`expr $$failedtest + 1` ; \
377                 else \
378                         echo "$$x passed" ; \
379                 fi ; \
380         done ; \
381         echo "--- Testing SPECIAL OPTIONS files..." ; \
382         for line in $(SPECIAL_OPTIONS); do echo $$line | while read x options; do \
383                 echo "Verify file $$x ($$options)" ; \
384                 $(top_builddir)/cloog$(EXEEXT) $(srcdir)/$$x.cloog \
385                         $$options > ttemp ; \
386                 diff -u -w --ignore-matching-lines='CLooG' ttemp $(srcdir)/$$x.c ; \
387                 result=$$?; \
388                 if [ "$$result" -ne "0" ] ; then \
389                         echo "!!! Error: $$x is not the same" ; \
390                         failedtest=`expr $$failedtest + 1` ; \
391                 else \
392                         echo "$$x passed" ; \
393                 fi ; \
394         done; done; \
395         rm ttemp ; \
396         if [ $$failedtest != 0 ] ; then \
397                 echo "$$failedtest tests failed" ; \
398         else \
399                 echo "CLooG works correctly :-) !" ; \
400         fi