add backend independent functions for creating CloogDomains and CloogScatterings
[cloog/uuh.git] / test / Makefile.am
blob6f025645f0138cd1e833bd2e8c1666969b26300d
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         basic-bounds-2                 \
170         nul_basic1                     \
171         nul_basic2                     \
172         nul_lcpc                       \
173         multi-stride                   \
174         multi-stride2                  \
175         reservoir/bastoul3             \
176         reservoir/stride               \
177         reservoir/stride2
179 SPECIAL_TESTS = \
180         vasilache \
181         merge \
182         equality \
183         equality2 \
184         stride \
185         stride2
186 SPECIAL_OPTIONS = \
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"
194 EXTRA_DIST = \
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)
210 generate:
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 ; \
217         done ; \
218         for x in $(CLOOGTEST_FORTRAN) ; do \
219                 echo "Generate $$x.f" ; \
220                 $(top_builddir)/cloog $(srcdir)/$$x.cloog -o $(srcdir)/@BACKEND@/$$x.f ; \
221         done ; \
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 ; \
226         done ; \
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 ; \
231         done
233 generate_good:
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 ; \
237         done; \
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 ; \
241         done
243 valgrind:
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 ; \
250         done ; \
251         for x in $(CLOOGTEST_FORTRAN) ; do \
252                 echo "Valgrinding $$x.f" ; \
253                 valgrind $(top_builddir)/cloog$(EXEEXT) $(srcdir)/$$x.cloog ; \
254         done
256 test_run: generate_test$(EXEEXT)
257         @echo "             /*-----------------------------------------------*"
258         @echo "              *                 Testing CLooG                 *"
259         @echo "              *-----------------------------------------------*/"
260         @failedtest=0 ; \
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); \
273                 result=$$?; \
274                 if test "$$result" -ne "0" ; then \
275                         failedtest=`expr $$failedtest + 1` ; \
276                 fi; \
277                 $(RM) $@; \
278                 echo; \
279         done; \
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); \
291                 result=$$?; \
292                 if test "$$result" -ne "0" ; then \
293                         failedtest=`expr $$failedtest + 1` ; \
294                 fi; \
295                 $(RM) $@; \
296                 echo; \
297         done; \
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); \
309                 result=$$?; \
310                 if test "$$result" -ne "0" ; then \
311                         failedtest=`expr $$failedtest + 1` ; \
312                 fi; \
313                 $(RM) $@; \
314                 echo; \
315         done; \
316         if [ $$failedtest != 0 ] ; then \
317                 echo "$$failedtest tests failed" ; \
318         else \
319                 echo "CLooG works correctly :-) !" ; \
320         fi
321 test:
322         @echo "             /*-----------------------------------------------*"
323         @echo "              *                 Testing CLooG                 *"
324         @echo "              *-----------------------------------------------*/"
325         @failedtest=0 ; \
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 ; \
331                 result=$$?; \
332                 if [ "$$result" -ne "0" ] ; then \
333                         echo "!!! Error: $$x is not the same" ; \
334                         failedtest=`expr $$failedtest + 1` ; \
335                 else \
336                         echo "$$x passed" ; \
337                 fi ; \
338         done ; \
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 ; \
344                 result=$$?; \
345                 if [ "$$result" -ne "0" ] ; then \
346                         echo "!!! Error: $$x is not the same" ; \
347                         failedtest=`expr $$failedtest + 1` ; \
348                 else \
349                         echo "$$x passed" ; \
350                 fi ; \
351         done ; \
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 ; \
358                 result=$$?; \
359                 if [ "$$result" -ne "0" ] ; then \
360                         echo "!!! Error: $$x is not the same" ; \
361                         failedtest=`expr $$failedtest + 1` ; \
362                 else \
363                         echo "$$x passed" ; \
364                 fi ; \
365         done ; \
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 ; \
372                 result=$$?; \
373                 if [ "$$result" -ne "0" ] ; then \
374                         echo "!!! Error: $$x is not the same" ; \
375                         failedtest=`expr $$failedtest + 1` ; \
376                 else \
377                         echo "$$x passed" ; \
378                 fi ; \
379         done; exit $$failedtest; ); \
380         failedtest=$$?; \
381         rm ttemp ; \
382         if [ $$failedtest != 0 ] ; then \
383                 echo "$$failedtest tests failed" ; \
384         else \
385                 echo "CLooG works correctly :-) !" ; \
386         fi