]> git.cworth.org Git - apitrace-tests/blob - mesademos.py
21b0af444b7c86e15315e93716a1d829a8fb1c81
[apitrace-tests] / mesademos.py
1 #!/usr/bin/env python
2 ##########################################################################
3 #
4 # Copyright 2011 Jose Fonseca
5 # All Rights Reserved.
6 #
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:
13 #
14 # The above copyright notice and this permission notice shall be included in
15 # all copies or substantial portions of the Software.
16 #
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
23 # THE SOFTWARE.
24 #
25 ##########################################################################/
26
27
28 '''Apitrace test suite based on Mesa demos.'''
29
30
31
32 import os.path
33 import optparse
34 import sys
35
36 from test import Report, TestCase
37
38
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)]
44
45     test = TestCase(
46         name = name,
47         args = args,
48         cwd = dirname,
49         build = options.build,
50         results = options.results,
51     )
52     test.run(report)
53
54
55
56 tests = [
57     'trivial/clear-color',
58     'trivial/clear-fbo',
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',
65     'trivial/createwin',
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',
77     'trivial/drawarrays',
78     'trivial/drawelements',
79     'trivial/drawelements-large',
80     'trivial/drawrange',
81     'trivial/flat-clip',
82     'trivial/fs-tri',
83     'trivial/line',
84     'trivial/line-clip',
85     'trivial/line-cull',
86     'trivial/line-flat',
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',
93     'trivial/line-wide',
94     'trivial/line-xor',
95     'trivial/lineloop',
96     'trivial/lineloop-clip',
97     'trivial/lineloop-elts',
98     'trivial/linestrip',
99     'trivial/linestrip-clip',
100     'trivial/linestrip-flat-stipple',
101     'trivial/linestrip-stipple',
102     'trivial/linestrip-stipple-wide',
103     'trivial/long-fixed-func',
104     'trivial/pgon-mode',
105     'trivial/point',
106     'trivial/point-clip',
107     'trivial/point-param',
108     'trivial/point-sprite',
109     'trivial/point-wide',
110     'trivial/point-wide-smooth',
111     'trivial/poly',
112     'trivial/poly-flat',
113     'trivial/poly-flat-clip',
114     'trivial/poly-flat-unfilled-clip',
115     'trivial/poly-unfilled',
116     'trivial/quad',
117     'trivial/quad-clip',
118     'trivial/quad-clip-all-vertices',
119     'trivial/quad-clip-nearplane',
120     'trivial/quad-degenerate',
121     'trivial/quad-flat',
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',
133     'trivial/quads',
134     'trivial/quadstrip',
135     'trivial/quadstrip-clip',
136     'trivial/quadstrip-cont',
137     'trivial/quadstrip-flat',
138     'trivial/readpixels',
139     'trivial/sub-tex',
140     'trivial/tex-quads',
141     'trivial/tri',
142     'trivial/tri-alpha',
143     'trivial/tri-alpha-tex',
144     'trivial/tri-array-interleaved',
145     'trivial/tri-blend',
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',
151     'trivial/tri-clear',
152     'trivial/tri-clip',
153     'trivial/tri-cull',
154     'trivial/tri-cull-both',
155     'trivial/tri-dlist',
156     'trivial/tri-edgeflag',
157     'trivial/tri-edgeflag-array',
158     'trivial/tri-fbo',
159     'trivial/tri-fbo-tex',
160     'trivial/tri-fbo-tex-mip',
161     'trivial/tri-flat',
162     'trivial/tri-flat-clip',
163     'trivial/tri-fog',
164     'trivial/tri-fp',
165     'trivial/tri-fp-const-imm',
166     'trivial/tri-lit',
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',
172     'trivial/tri-orig',
173     'trivial/tri-point-line-clipped',
174     'trivial/tri-query',
175     'trivial/tri-repeat',
176     'trivial/tri-scissor-tri',
177     'trivial/tri-square',
178     'trivial/tri-stencil',
179     'trivial/tri-stipple',
180     'trivial/tri-tex',
181     'trivial/tri-tex-1d',
182     'trivial/tri-tex-3d',
183     'trivial/tri-tri',
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',
196     'trivial/tri-z',
197     'trivial/tri-z-9',
198     'trivial/tri-z-eq',
199     'trivial/trifan',
200     'trivial/trifan-flat',
201     'trivial/trifan-flat-clip',
202     'trivial/trifan-flat-unfilled-clip',
203     'trivial/trifan-unfilled',
204     'trivial/tristrip',
205     'trivial/tristrip-clip',
206     'trivial/tristrip-flat',
207     'trivial/vbo-drawarrays',
208     'trivial/vbo-drawelements',
209     'trivial/vbo-drawrange',
210     'trivial/vbo-noninterleaved',
211     'trivial/vbo-tri',
212     'trivial/vp-array',
213     'trivial/vp-array-hf',
214     'trivial/vp-array-int',
215     'trivial/vp-clip',
216     'trivial/vp-line-clip',
217     'trivial/vp-tri',
218     'trivial/vp-tri-cb',
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',
226
227     'demos/arbfplight',
228     'demos/arbfslight',
229     'demos/arbocclude',
230     'demos/arbocclude2',
231     'demos/bounce',
232     'demos/clearspd',
233     'demos/copypix',
234     'demos/cubemap',
235     'demos/cuberender',
236     'demos/dinoshade',
237     'demos/dissolve',
238     'demos/drawpix',
239     'demos/engine',
240     'demos/fbo_firecube',
241     'demos/fbotexture',
242     'demos/fire',
243     'demos/fogcoord',
244     'demos/fplight',
245     'demos/fslight',
246     'demos/gamma',
247     'demos/gearbox',
248     'demos/gears',
249     'demos/geartrain',
250     'demos/glinfo',
251     'demos/gloss',
252     'demos/gltestperf',
253     'demos/ipers',
254     'demos/isosurf',
255     'demos/lodbias',
256     'demos/morph3d',
257     'demos/multiarb',
258     'demos/paltex',
259     'demos/pointblast',
260     'demos/projtex',
261     'demos/rain',
262     'demos/ray',
263     'demos/readpix',
264     'demos/reflect',
265     'demos/renormal',
266     'demos/shadowtex',
267     'demos/singlebuffer',
268     'demos/spectex',
269     'demos/spriteblast',
270     'demos/stex3d',
271     'demos/teapot',
272     'demos/terrain',
273     'demos/tessdemo',
274     'demos/texcyl',
275     'demos/texenv',
276     'demos/textures',
277     'demos/trispd',
278     'demos/tunnel',
279     'demos/tunnel2',
280     'demos/vao_demo',
281     'demos/winpos',
282
283     #'fp/fp-tri', # XXX: parameterized
284     'fp/point-position',
285     'fp/tri-depth',
286     'fp/tri-depth2',
287     'fp/tri-depthwrite',
288     'fp/tri-depthwrite2',
289     'fp/tri-param',
290     'fp/tri-tex',
291
292     #'fpglsl/fp-tri',
293
294     'glsl/array',
295     'glsl/bezier',
296     'glsl/bitmap',
297     'glsl/brick',
298     'glsl/bump',
299     'glsl/convolutions',
300     'glsl/deriv',
301     'glsl/fragcoord',
302     'glsl/fsraytrace',
303     'glsl/geom-sprites',
304     'glsl/geom-stipple-lines',
305     'glsl/geom-wide-lines',
306     'glsl/identity',
307     'glsl/linktest',
308     'glsl/mandelbrot',
309     'glsl/multinoise',
310     'glsl/multitex',
311     'glsl/noise',
312     'glsl/noise2',
313     'glsl/pointcoord',
314     'glsl/points',
315     'glsl/samplers',
316     'glsl/shadow_sampler',
317     'glsl/shtest',
318     'glsl/skinning',
319     'glsl/texaaline',
320     'glsl/texdemo1',
321     'glsl/toyball',
322     'glsl/trirast',
323     'glsl/twoside',
324     'glsl/vert-or-frag-only',
325     'glsl/vert-tex',
326     'glsl/vsraytrace',
327
328     #'gs/gs-tri',
329
330     #'perf/copytex',
331     #'perf/drawoverhead',
332     #'perf/fbobind',
333     #'perf/fill',
334     #'perf/genmipmap',
335     #'perf/readpixels',
336     #'perf/swapbuffers',
337     #'perf/teximage',
338     #'perf/vbo',
339     #'perf/vertexrate',
340
341     'redbook/aaindex',
342     'redbook/aapoly',
343     'redbook/aargb',
344     'redbook/accanti',
345     'redbook/accpersp',
346     'redbook/alpha',
347     'redbook/alpha3D',
348     'redbook/anti',
349     'redbook/bezcurve',
350     'redbook/bezmesh',
351     'redbook/checker',
352     'redbook/clip',
353     'redbook/colormat',
354     'redbook/combiner',
355     'redbook/convolution',
356     'redbook/cube',
357     'redbook/cubemap',
358     'redbook/depthcue',
359     'redbook/dof',
360     'redbook/double',
361     'redbook/drawf',
362     'redbook/feedback',
363     'redbook/fog',
364     'redbook/fogcoord',
365     'redbook/fogindex',
366     'redbook/font',
367     'redbook/hello',
368     'redbook/histogram',
369     'redbook/image',
370     'redbook/light',
371     'redbook/lines',
372     'redbook/list',
373     'redbook/material',
374     'redbook/minmax',
375     'redbook/mipmap',
376     'redbook/model',
377     'redbook/movelight',
378     'redbook/multisamp',
379     'redbook/multitex',
380     'redbook/mvarray',
381     'redbook/nurbs',
382     'redbook/pickdepth',
383     'redbook/picksquare',
384     'redbook/plane',
385     'redbook/planet',
386     'redbook/pointp',
387     'redbook/polyoff',
388     'redbook/polys',
389     'redbook/quadric',
390     'redbook/robot',
391     'redbook/sccolorlight',
392     'redbook/scene',
393     'redbook/scenebamb',
394     'redbook/sceneflat',
395     'redbook/select',
396     'redbook/shadowmap',
397     'redbook/smooth',
398     'redbook/stencil',
399     'redbook/stroke',
400     'redbook/surface',
401     'redbook/surfpoints',
402     'redbook/teaambient',
403     'redbook/teapots',
404     'redbook/tess',
405     'redbook/tesswind',
406     'redbook/texbind',
407     'redbook/texgen',
408     'redbook/texprox',
409     'redbook/texsub',
410     'redbook/texture3d',
411     'redbook/texturesurf',
412     'redbook/torus',
413     'redbook/trim',
414     'redbook/unproject',
415     'redbook/varray',
416     'redbook/wrap',
417
418     'samples/accum',
419     'samples/bitmap1',
420     'samples/bitmap2',
421     'samples/blendeq',
422     'samples/blendxor',
423     'samples/copy',
424     'samples/cursor',
425     'samples/depth',
426     'samples/eval',
427     'samples/fog',
428     'samples/font',
429     'samples/line',
430     'samples/logo',
431     'samples/nurb',
432     'samples/oglinfo',
433     'samples/olympic',
434     'samples/overlay',
435     'samples/point',
436     'samples/prim',
437     'samples/quad',
438     'samples/rgbtoppm',
439     'samples/select',
440     'samples/shape',
441     'samples/sphere',
442     'samples/star',
443     'samples/stencil',
444     'samples/stretch',
445     'samples/texture',
446     'samples/tri',
447     'samples/wave',
448
449     #'slang/cltest',
450     #'slang/sotest',
451     #'slang/vstest',
452
453     'tests/afsmultiarb',
454     'tests/antialias',
455     'tests/arbfpspec',
456     'tests/arbfptest1',
457     'tests/arbfptexture',
458     'tests/arbfptrig',
459     'tests/arbgpuprog',
460     'tests/arbnpot',
461     'tests/arbnpot-mipmap',
462     'tests/arbvptest1',
463     'tests/arbvptest3',
464     'tests/arbvptorus',
465     'tests/arbvpwarpmesh',
466     'tests/arraytexture',
467     'tests/auxbuffer',
468     'tests/blendxor',
469     'tests/blitfb',
470     'tests/bufferobj',
471     'tests/bug_3050',
472     'tests/bug_3101',
473     'tests/bug_3195',
474     'tests/bug_texstore_i8',
475     'tests/bumpmap',
476     'tests/calibrate_rast',
477     'tests/condrender',
478     #'tests/copypixrate', # XXX: benchmark
479     'tests/cva',
480     'tests/cva_huge',
481     'tests/cylwrap',
482     'tests/drawbuffers',
483     'tests/drawbuffers2',
484     'tests/drawstencil',
485     'tests/exactrast',
486     'tests/ext422square',
487     'tests/fbotest1',
488     'tests/fbotest2',
489     'tests/fbotest3',
490     #'tests/fillrate', # XXX: benchmark
491     'tests/floattex',
492     'tests/fogcoord',
493     'tests/fptest1',
494     'tests/fptexture',
495     'tests/getteximage',
496     'tests/glutfx',
497     'tests/interleave',
498     'tests/invert',
499     'tests/jkrahntest',
500     'tests/lineclip',
501     'tests/manytex',
502     'tests/mapbufrange',
503     'tests/minmag',
504     'tests/mipgen',
505     'tests/mipmap_comp',
506     'tests/mipmap_comp_tests',
507     'tests/mipmap_limits',
508     'tests/mipmap_tunnel',
509     'tests/mipmap_view',
510     'tests/multipal',
511     'tests/multitexarray',
512     'tests/multiwindow',
513     'tests/no_s3tc',
514     'tests/occlude',
515     'tests/packedpixels',
516     'tests/pbo',
517     'tests/persp_hint',
518     'tests/prim',
519     'tests/prog_parameter',
520     'tests/quads',
521     'tests/random',
522     #'tests/readrate', # XXX: benchmark
523     'tests/rubberband',
524     'tests/scissor',
525     'tests/scissor-viewport',
526     'tests/seccolor',
527     'tests/shader-interp',
528     'tests/shader_api',
529     'tests/shadow-sample',
530     'tests/sharedtex',
531     'tests/stencilreaddraw',
532     'tests/stencilwrap',
533     'tests/step',
534     'tests/streaming_rect',
535     'tests/subtex',
536     #'tests/subtexrate', # XXX: benchmark
537     'tests/tex1d',
538     'tests/texcmp',
539     'tests/texcompress2',
540     'tests/texcompsub',
541     'tests/texdown',
542     'tests/texfilt',
543     'tests/texgenmix',
544     'tests/texleak',
545     'tests/texline',
546     'tests/texobj',
547     'tests/texobjshare',
548     'tests/texrect',
549     'tests/unfilledclip',
550     'tests/vparray',
551     'tests/vpeval',
552     'tests/vptest1',
553     'tests/vptest2',
554     'tests/vptest3',
555     'tests/vptorus',
556     'tests/vpwarpmesh',
557     'tests/yuvrect',
558     'tests/yuvsquare',
559     'tests/zbitmap',
560     'tests/zcomp',
561     'tests/zdrawpix',
562     'tests/zreaddraw',
563
564     #'vp/vp-tris',
565     #'vpglsl/vp-tris',
566
567     'xdemos/corender',
568     'xdemos/glsync',
569     #'xdemos/glthreads', # XXX: multithreaded
570     'xdemos/glxcontexts',
571     'xdemos/glxdemo',
572     'xdemos/glxgears',
573     'xdemos/glxgears_fbconfig',
574     'xdemos/glxgears_pixmap',
575     'xdemos/glxheads',
576     'xdemos/glxinfo',
577     'xdemos/glxpbdemo',
578     'xdemos/glxpixmap',
579     'xdemos/glxsnoop',
580     'xdemos/glxswapcontrol',
581     'xdemos/manywin',
582     'xdemos/msctest',
583     'xdemos/multictx',
584     'xdemos/offset',
585     'xdemos/omlsync',
586     'xdemos/opencloseopen',
587     'xdemos/overlay',
588     'xdemos/pbdemo',
589     'xdemos/pbinfo',
590     'xdemos/shape',
591     'xdemos/sharedtex',
592     #'xdemos/sharedtex_mt', # XXX: multithreaded
593     'xdemos/texture_from_pixmap',
594     'xdemos/wincopy',
595     'xdemos/xfont',
596     'xdemos/xrotfontdemo',
597     'xdemos/yuvrect_client',
598 ]
599
600
601 _tests = [
602     'trivial/tri',
603     'trivial/tri-tex',
604 ]
605
606
607 def main():
608     global options
609
610     # Parse command line options
611     optparser = optparse.OptionParser(
612         usage='\n\t%prog [options] [demo] ...',
613         version='%%prog')
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]')
626
627     (options, args) = optparser.parse_args(sys.argv[1:])
628
629     if not options.mesa_demos:
630         optparser.error('path to Mesa demos not specified')
631
632     if args:
633         testlist = []
634         for arg in args:
635             if arg.endswith('/'):
636                 for test in tests:
637                     if test.startswith(arg):
638                         testlist.append(test)
639             else:
640                 testlist.append(arg)
641     else:
642         testlist = tests
643
644     report = Report(options.results)
645     for test in testlist:
646        runtest(report, test)
647
648
649 if __name__ == '__main__':
650     main()