cloog_names_alloc: fix typo in comment
[cloog.git] / test / Makefile.am
blob529f94aff3e195b244bc01a9f94a1d4868faa249
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 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
45 FORCE:
46 ../libcloog-@BACKEND@.la: FORCE
47         cd ..; $(MAKE) $(AM_MAKEFLAGS) libcloog-@BACKEND@.la
49 ROOT = ..
51 FINITE_CLOOGTEST_C =                   \
52         0D-1                           \
53         0D-2                           \
54         0D-3                           \
55         1point-1                       \
56         1point-2                       \
57         4-param                        \
58         basic-bounds-1                 \
59         basic-bounds-2                 \
60         basic-bounds-3                 \
61         basic-bounds-4                 \
62         basic-bounds-5                 \
63         basic-bounds-6                 \
64         block                          \
65         byu98-1-2-3                    \
66         cholesky                       \
67         cholesky2                      \
68         classen                        \
69         constbound                     \
70         darte                          \
71         donotsimp                      \
72         dot                            \
73         dot2                           \
74         double                         \
75         durbin_e_s                     \
76         emploi                         \
77         esced                          \
78         ex1                            \
79         forwardsub-1-1-2               \
80         forwardsub-2-1-2-3             \
81         forwardsub-3-1-2               \
82         gauss                          \
83         gesced                         \
84         gesced2                        \
85         gesced3                        \
86         guide                          \
87         iftest                         \
88         iftest2                        \
89         largeur                        \
90         levenshtein-1-2-3              \
91         lineality-1-2                  \
92         lineality-2-1-2                \
93         logo                           \
94         logopar                        \
95         lu                             \
96         lu2                            \
97         lub                            \
98         lux                            \
99         min-1-1                        \
100         min-2-1                        \
101         min-3-1                        \
102         min-4-1                        \
103         mode                           \
104         multi-mm-1                     \
105         no_lindep                      \
106         orc                            \
107         rectangle                      \
108         square+triangle-1-1-2-3        \
109         swim                           \
110         test                           \
111         thomasset                      \
112         tiling                         \
113         uday_scalars                   \
114         vivien                         \
115         vivien2                        \
116         wavefront                      \
117         yosr                           \
118         yosr2                          \
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           \
148         ./reservoir/QR                 \
149         ./reservoir/tang-xue1          \
150         ./reservoir/two   
152 CLOOGTEST_C =                          \
153         infinite                       \
154         infinite2                      \
155         infinite3                      \
156         infinite4                      \
157         $(FINITE_CLOOGTEST_C)
159 #       ./reservoir/long               \
160 #       faber
162 CLOOGTEST_FORTRAN =                    \
163         dartef                         \
164         iftestf                        \
165         levenshtein-1-2-3f             \
166         yosrf
168 CLOOGTEST_STRIDED =                    \
169         nul_basic1                     \
170         nul_basic2                     \
171         nul_lcpc                       \
172         multi-stride                   \
173         multi-stride2                  \
174         reservoir/bastoul3             \
175         reservoir/stride               \
176         reservoir/stride2
178 SPECIAL_OPTIONS = \
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"
184 EXTRA_DIST = \
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
200 generate:
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 ; \
207         done ; \
208         for x in $(CLOOGTEST_FORTRAN) ; do \
209                 echo "Generate $$x.f" ; \
210                 $(top_builddir)/cloog $(srcdir)/$$x.cloog -o $(srcdir)/@BACKEND@/$$x.f ; \
211         done ; \
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 ; \
216         done ; \
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 ; \
221         done
223 generate_good:
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 ; \
227         done; \
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 ; \
231         done
233 valgrind:
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 ; \
240         done ; \
241         for x in $(CLOOGTEST_FORTRAN) ; do \
242                 echo "Valgrinding $$x.f" ; \
243                 valgrind $(top_builddir)/cloog$(EXEEXT) $(srcdir)/$$x.cloog ; \
244         done
246 test_run: generate_test$(EXEEXT)
247         @echo "             /*-----------------------------------------------*"
248         @echo "              *                 Testing CLooG                 *"
249         @echo "              *-----------------------------------------------*/"
250         @failedtest=0 ; \
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); \
263                 result=$$?; \
264                 if test "$$result" -ne "0" ; then \
265                         failedtest=`expr $$failedtest + 1` ; \
266                 fi; \
267                 $(RM) $@; \
268                 echo; \
269         done; \
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); \
281                 result=$$?; \
282                 if test "$$result" -ne "0" ; then \
283                         failedtest=`expr $$failedtest + 1` ; \
284                 fi; \
285                 $(RM) $@; \
286                 echo; \
287         done; \
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); \
299                 result=$$?; \
300                 if test "$$result" -ne "0" ; then \
301                         failedtest=`expr $$failedtest + 1` ; \
302                 fi; \
303                 $(RM) $@; \
304                 echo; \
305         done; \
306         if [ $$failedtest != 0 ] ; then \
307                 echo "$$failedtest tests failed" ; \
308         else \
309                 echo "CLooG works correctly :-) !" ; \
310         fi
311 test:
312         @echo "             /*-----------------------------------------------*"
313         @echo "              *                 Testing CLooG                 *"
314         @echo "              *-----------------------------------------------*/"
315         @failedtest=0 ; \
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 ; \
321                 result=$$?; \
322                 if [ "$$result" -ne "0" ] ; then \
323                         echo "!!! Error: $$x is not the same" ; \
324                         failedtest=`expr $$failedtest + 1` ; \
325                 else \
326                         echo "$$x passed" ; \
327                 fi ; \
328         done ; \
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 ; \
334                 result=$$?; \
335                 if [ "$$result" -ne "0" ] ; then \
336                         echo "!!! Error: $$x is not the same" ; \
337                         failedtest=`expr $$failedtest + 1` ; \
338                 else \
339                         echo "$$x passed" ; \
340                 fi ; \
341         done ; \
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 ; \
348                 result=$$?; \
349                 if [ "$$result" -ne "0" ] ; then \
350                         echo "!!! Error: $$x is not the same" ; \
351                         failedtest=`expr $$failedtest + 1` ; \
352                 else \
353                         echo "$$x passed" ; \
354                 fi ; \
355         done ; \
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 ; \
362                 result=$$?; \
363                 if [ "$$result" -ne "0" ] ; then \
364                         echo "!!! Error: $$x is not the same" ; \
365                         failedtest=`expr $$failedtest + 1` ; \
366                 else \
367                         echo "$$x passed" ; \
368                 fi ; \
369         done; exit $$failedtest; ); \
370         failedtest=$$?; \
371         rm ttemp ; \
372         if [ $$failedtest != 0 ] ; then \
373                 echo "$$failedtest tests failed" ; \
374         else \
375                 echo "CLooG works correctly :-) !" ; \
376         fi