2 ##########################################################################
4 # Copyright 2011 Jose Fonseca
7 # Permission is hereby granted, free of charge, to any person obtaining a copy
8 # of this software and associated documentation files (the "Software"), to deal
9 # in the Software without restriction, including without limitation the rights
10 # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11 # copies of the Software, and to permit persons to whom the Software is
12 # furnished to do so, subject to the following conditions:
14 # The above copyright notice and this permission notice shall be included in
15 # all copies or substantial portions of the Software.
17 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18 # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20 # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21 # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22 # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
25 ##########################################################################/
28 '''Apitrace test suite based on Mesa demos.'''
36 from test import Report, TestCase
39 def runtest(report, demo):
40 app = os.path.join(options.mesa_demos, 'src', demo)
41 dirname, basename = os.path.split(app)
42 name = demo.replace('/', '-')
43 args = [os.path.join('.', basename)]
49 build = options.build,
50 results = options.results,
57 'trivial/clear-color',
59 'trivial/clear-fbo-scissor',
60 'trivial/clear-fbo-tex',
61 'trivial/clear-random',
62 'trivial/clear-repeat',
63 'trivial/clear-scissor',
64 'trivial/clear-undefined',
66 'trivial/dlist-begin-call-end',
67 'trivial/dlist-dangling',
68 'trivial/dlist-degenerate',
69 'trivial/dlist-edgeflag',
70 'trivial/dlist-edgeflag-dangling',
71 'trivial/dlist-flat-tri',
72 'trivial/dlist-mat-tri',
73 'trivial/dlist-recursive-call',
74 'trivial/dlist-tri-flat-tri',
75 'trivial/dlist-tri-mat-tri',
76 'trivial/draw2arrays',
78 'trivial/drawelements',
79 'trivial/drawelements-large',
87 'trivial/line-smooth',
88 'trivial/line-stipple-wide',
89 'trivial/line-userclip',
90 'trivial/line-userclip-clip',
91 'trivial/line-userclip-nop',
92 'trivial/line-userclip-nop-clip',
96 'trivial/lineloop-clip',
97 'trivial/lineloop-elts',
99 'trivial/linestrip-clip',
100 'trivial/linestrip-flat-stipple',
101 'trivial/linestrip-stipple',
102 'trivial/linestrip-stipple-wide',
103 'trivial/long-fixed-func',
106 'trivial/point-clip',
107 'trivial/point-param',
108 'trivial/point-sprite',
109 'trivial/point-wide',
110 'trivial/point-wide-smooth',
113 'trivial/poly-flat-clip',
114 'trivial/poly-flat-unfilled-clip',
115 'trivial/poly-unfilled',
118 'trivial/quad-clip-all-vertices',
119 'trivial/quad-clip-nearplane',
120 'trivial/quad-degenerate',
122 'trivial/quad-offset-factor',
123 'trivial/quad-offset-unfilled',
124 'trivial/quad-offset-units',
125 'trivial/quad-tex-2d',
126 'trivial/quad-tex-3d',
127 'trivial/quad-tex-alpha',
128 'trivial/quad-tex-pbo',
129 'trivial/quad-tex-sub',
130 'trivial/quad-unfilled',
131 'trivial/quad-unfilled-clip',
132 'trivial/quad-unfilled-stipple',
135 'trivial/quadstrip-clip',
136 'trivial/quadstrip-cont',
137 'trivial/quadstrip-flat',
138 'trivial/readpixels',
143 'trivial/tri-alpha-tex',
144 'trivial/tri-array-interleaved',
146 'trivial/tri-blend-color',
147 'trivial/tri-blend-max',
148 'trivial/tri-blend-min',
149 'trivial/tri-blend-revsub',
150 'trivial/tri-blend-sub',
154 'trivial/tri-cull-both',
156 'trivial/tri-edgeflag',
157 'trivial/tri-edgeflag-array',
159 'trivial/tri-fbo-tex',
160 'trivial/tri-fbo-tex-mip',
162 'trivial/tri-flat-clip',
165 'trivial/tri-fp-const-imm',
167 'trivial/tri-lit-material',
168 'trivial/tri-logicop-none',
169 'trivial/tri-logicop-xor',
170 'trivial/tri-mask-tri',
171 'trivial/tri-multitex-vbo',
173 'trivial/tri-point-line-clipped',
175 'trivial/tri-repeat',
176 'trivial/tri-scissor-tri',
177 'trivial/tri-square',
178 'trivial/tri-stencil',
179 'trivial/tri-stipple',
181 'trivial/tri-tex-1d',
182 'trivial/tri-tex-3d',
184 'trivial/tri-unfilled',
185 'trivial/tri-unfilled-clip',
186 'trivial/tri-unfilled-edgeflag',
187 'trivial/tri-unfilled-fog',
188 'trivial/tri-unfilled-point',
189 'trivial/tri-unfilled-smooth',
190 'trivial/tri-unfilled-tri',
191 'trivial/tri-unfilled-tri-lit',
192 'trivial/tri-unfilled-userclip',
193 'trivial/tri-unfilled-userclip-stip',
194 'trivial/tri-userclip',
195 'trivial/tri-viewport',
200 'trivial/trifan-flat',
201 'trivial/trifan-flat-clip',
202 'trivial/trifan-flat-unfilled-clip',
203 'trivial/trifan-unfilled',
205 'trivial/tristrip-clip',
206 'trivial/tristrip-flat',
207 'trivial/vbo-drawarrays',
208 'trivial/vbo-drawelements',
209 'trivial/vbo-drawrange',
210 'trivial/vbo-noninterleaved',
213 'trivial/vp-array-hf',
214 'trivial/vp-array-int',
216 'trivial/vp-line-clip',
219 'trivial/vp-tri-cb-pos',
220 'trivial/vp-tri-cb-tex',
221 'trivial/vp-tri-imm',
222 'trivial/vp-tri-invariant',
223 'trivial/vp-tri-swap',
224 'trivial/vp-tri-tex',
225 'trivial/vp-unfilled',
240 'demos/fbo_firecube',
267 'demos/singlebuffer',
283 #'fp/fp-tri', # XXX: parameterized
288 'fp/tri-depthwrite2',
304 'glsl/geom-stipple-lines',
305 'glsl/geom-wide-lines',
316 'glsl/shadow_sampler',
324 'glsl/vert-or-frag-only',
331 #'perf/drawoverhead',
355 'redbook/convolution',
383 'redbook/picksquare',
391 'redbook/sccolorlight',
401 'redbook/surfpoints',
402 'redbook/teaambient',
411 'redbook/texturesurf',
457 'tests/arbfptexture',
461 'tests/arbnpot-mipmap',
465 'tests/arbvpwarpmesh',
466 'tests/arraytexture',
474 'tests/bug_texstore_i8',
476 'tests/calibrate_rast',
478 #'tests/copypixrate', # XXX: benchmark
483 'tests/drawbuffers2',
486 'tests/ext422square',
490 #'tests/fillrate', # XXX: benchmark
506 'tests/mipmap_comp_tests',
507 'tests/mipmap_limits',
508 'tests/mipmap_tunnel',
511 'tests/multitexarray',
515 'tests/packedpixels',
519 'tests/prog_parameter',
522 #'tests/readrate', # XXX: benchmark
525 'tests/scissor-viewport',
527 'tests/shader-interp',
529 'tests/shadow-sample',
531 'tests/stencilreaddraw',
534 'tests/streaming_rect',
536 #'tests/subtexrate', # XXX: benchmark
539 'tests/texcompress2',
549 'tests/unfilledclip',
569 #'xdemos/glthreads', # XXX: multithreaded
570 'xdemos/glxcontexts',
573 'xdemos/glxgears_fbconfig',
574 'xdemos/glxgears_pixmap',
580 'xdemos/glxswapcontrol',
586 'xdemos/opencloseopen',
592 #'xdemos/sharedtex_mt', # XXX: multithreaded
593 'xdemos/texture_from_pixmap',
596 'xdemos/xrotfontdemo',
597 'xdemos/yuvrect_client',
610 # Parse command line options
611 optparser = optparse.OptionParser(
612 usage='\n\t%prog [options] [demo] ...',
614 optparser.add_option(
615 '--build', metavar='PATH',
616 type='string', dest='build', default='.',
617 help='path to apitrace build [default=%default]')
618 optparser.add_option(
619 '--results', metavar='PATH',
620 type='string', dest='results', default='results',
621 help='results directory [default=%default]')
622 optparser.add_option(
623 '--mesa-demos', metavar='PATH',
624 type='string', dest='mesa_demos', default=os.environ.get('MESA_DEMOS'),
625 help='path to Mesa demos [default=%default]')
627 (options, args) = optparser.parse_args(sys.argv[1:])
629 if not options.mesa_demos:
630 optparser.error('path to Mesa demos not specified')
635 if arg.endswith('/'):
637 if test.startswith(arg):
638 testlist.append(test)
644 report = Report(options.results)
645 for test in testlist:
646 runtest(report, test)
649 if __name__ == '__main__':