"Initial commit to Gerrit"
[profile/ivi/cogl.git] / tests / conform / Makefile.am
1 include $(top_srcdir)/build/autotools/Makefile.am.silent
2
3 NULL =
4
5 noinst_PROGRAMS = test-conformance
6
7 common_sources = \
8         test-utils.h \
9         test-utils.c \
10         test-conform-main.c \
11         $(NULL)
12
13 unported_test_sources = \
14         test-fixed.c \
15         test-materials.c \
16         test-viewport.c \
17         test-multitexture.c \
18         test-npot-texture.c \
19         test-object.c \
20         test-premult.c \
21         test-readpixels.c \
22         test-texture-get-set-data.c \
23         test-texture-mipmaps.c \
24         test-texture-pixmap-x11.c \
25         test-texture-rectangle.c \
26         test-atlas-migration.c \
27         test-vertex-buffer-contiguous.c \
28         test-vertex-buffer-interleved.c \
29         test-vertex-buffer-mutability.c \
30         $(NULL)
31
32 test_sources = \
33         test-bitmask.c \
34         test-blend-strings.c \
35         test-depth-test.c \
36         test-color-mask.c \
37         test-backface-culling.c \
38         test-just-vertex-shader.c \
39         test-path.c \
40         test-pipeline-user-matrix.c \
41         test-pipeline-uniforms.c \
42         test-pixel-buffer.c \
43         test-snippets.c \
44         test-wrap-modes.c \
45         test-sub-texture.c \
46         test-custom-attributes.c \
47         test-offscreen.c \
48         test-primitive.c \
49         test-texture-3d.c \
50         test-sparse-pipeline.c \
51         test-read-texture-formats.c \
52         test-write-texture-formats.c \
53         test-point-size.c \
54         test-point-sprite.c \
55         $(NULL)
56
57 test_conformance_SOURCES = $(common_sources) $(test_sources)
58
59 if OS_WIN32
60 SHEXT =
61 else
62 SHEXT = $(EXEEXT)
63 endif
64
65 # For convenience, this provides a way to easily run individual unit tests:
66 .PHONY: wrappers clean-wrappers
67
68 wrappers: stamp-test-conformance
69         @true
70 stamp-test-conformance: Makefile $(srcdir)/test-conform-main.c
71         @mkdir -p wrappers
72         @sed -n -e 's/^ \{1,\}ADD_TEST *( *\([a-zA-Z0-9_]\{1,\}\).*/\1/p' $(srcdir)/test-conform-main.c > unit-tests
73         @chmod +x test-launcher.sh
74         @( echo "/stamp-test-conformance" ; \
75            echo "/test-conformance$(EXEEXT)" ; \
76            echo "*.o" ; \
77            echo ".gitignore" ; \
78            echo "unit-tests" ; ) > .gitignore
79         @for i in `cat unit-tests`; \
80         do \
81                 unit=`basename $$i | sed -e s/_/-/g`; \
82                 echo "  GEN    $$unit"; \
83                 ( echo "#!/bin/sh" ; echo "$(abs_builddir)/test-launcher.sh '$$i' \"\$$@\"" ) > $$unit$(SHEXT) ; \
84                 chmod +x $$unit$(SHEXT); \
85                 echo "/$$unit$(SHEXT)" >> .gitignore; \
86         done \
87         && echo timestamp > $(@F)
88
89 clean-wrappers:
90         @for i in `cat unit-tests`; \
91         do \
92                 unit=`basename $$i | sed -e s/_/-/g`; \
93                 echo "  RM     $$unit"; \
94                 rm -f $$unit$(SHEXT) ; \
95         done \
96         && rm -f unit-tests \
97         && rm -f stamp-test-conformance
98
99 # NB: BUILT_SOURCES here a misnomer. We aren't building source, just inserting
100 # a phony rule that will generate symlink scripts for running individual tests
101 BUILT_SOURCES = wrappers
102
103 # The include of the $(buildir)/cogl directory here is to make it so
104 # that tests that directly include Cogl source code for whitebox
105 # testing (such as test-bitmask) will still compile
106 INCLUDES = \
107         -I$(top_srcdir) \
108         -I$(top_builddir)/cogl
109
110 test_conformance_CPPFLAGS = \
111         -DCOGL_ENABLE_EXPERIMENTAL_API \
112         -DCOGL_DISABLE_DEPRECATED \
113         -DTESTS_DATADIR=\""$(top_srcdir)/tests/data"\" \
114         -DCLUTTER_COMPILATION
115
116 test_conformance_CFLAGS = -g3 -O0 $(COGL_DEP_CFLAGS) $(COGL_EXTRA_CFLAGS)
117 test_conformance_LDADD = $(COGL_DEP_LIBS) $(top_builddir)/cogl/libcogl.la
118 test_conformance_LDFLAGS = -export-dynamic
119
120 test: wrappers
121         @$(top_srcdir)/tests/conform/run-tests.sh $(abs_builddir)/config.env
122
123 # XXX: we could prevent the conformance test suite from running
124 #      by simply defining this variable conditionally
125 TEST_PROGS = test-conformance
126
127 .PHONY: test
128
129 EXTRA_DIST = test-launcher.sh.in run-tests.sh
130 DISTCLEANFILES = test-launcher.sh .gitignore
131
132 dist-hook: ../../build/win32/vs9/test-conformance-cogl.vcproj ../../build/win32/vs10/test-conformance-cogl.vcxproj ../../build/win32/vs10/test-conformance-cogl.vcxproj.filters
133
134 ../../build/win32/vs9/test-conformance-cogl.vcproj: $(top_srcdir)/build/win32/vs9/test-conformance-cogl.vcprojin
135         for F in $(test_conformance_SOURCES); do \
136                 case $$F in \
137                 *.c)    echo '   <File RelativePath="..\..\..\tests\conform\'$$F'" />' \
138                         ;; \
139                 esac; \
140         done >testconformance.sourcefiles
141         $(CPP) -P - <$(top_srcdir)/build/win32/vs9/test-conformance-cogl.vcprojin >$@
142         rm testconformance.sourcefiles
143
144 ../../build/win32/vs10/test-conformance-cogl.vcxproj: $(top_srcdir)/build/win32/vs10/test-conformance-cogl.vcxprojin
145         for F in $(test_conformance_SOURCES); do \
146                 case $$F in \
147                 *.c)    echo '    <ClCompile Include="..\..\..\tests\conform\'$$F'" />' \
148                         ;; \
149                 esac; \
150         done >testconformance.vs10.sourcefiles
151         $(CPP) -P - <$(top_srcdir)/build/win32/vs10/test-conformance-cogl.vcxprojin >$@
152         rm testconformance.vs10.sourcefiles
153
154 ../../build/win32/vs10/test-conformance-cogl.vcxproj.filters: $(top_srcdir)/build/win32/vs10/test-conformance-cogl.vcxproj.filtersin
155         for F in $(test_conformance_SOURCES); do \
156                 case $$F in \
157                 *.c)    echo '    <ClCompile Include="..\..\..\tests\conform\'$$F'"><Filter>Sources</Filter></ClCompile>' \
158                         ;; \
159                 esac; \
160         done >testconformance.vs10.sourcefiles.filters
161         $(CPP) -P - <$(top_srcdir)/build/win32/vs10/test-conformance-cogl.vcxproj.filtersin >$@
162         rm testconformance.vs10.sourcefiles.filters
163
164 # Let the VS9/VS10 Project files be cleared out before they are re-expanded...
165 DISTCLEANFILES += ../../build/win32/vs9/test-conformance-cogl.vcproj    \
166                   ../../build/win32/vs10/test-conformance-cogl.vcxproj  \
167                   ../../build/win32/vs10/test-conformance-cogl.vcxproj.filters
168
169 # we override the clean-generic target to clean up the wrappers so
170 # we cannot use CLEANFILES
171 clean-generic: clean-wrappers
172         $(QUIET_RM)rm -f .log