]> git.cworth.org Git - apitrace-tests/commitdiff
Make it easier to add more tests.
authorJosé Fonseca <jose.r.fonseca@gmail.com>
Sat, 17 Mar 2012 14:50:04 +0000 (14:50 +0000)
committerJosé Fonseca <jose.r.fonseca@gmail.com>
Sat, 17 Mar 2012 14:50:04 +0000 (14:50 +0000)
.gitignore
tool_driver.py
traces/CMakeLists.txt
traces/incomplete-call.ref.txt [deleted file]
traces/incomplete-call.script [new file with mode: 0644]
traces/zlib-no-eof.ref.txt [deleted file]
traces/zlib-no-eof.script [new file with mode: 0644]

index 00e5a4e0e81f1627c23e4409d9f1513f58d1bd10..76d923f346b650c5f9309de4aeab045c642fd423 100644 (file)
@@ -1,12 +1,13 @@
 .*.sw?
 *.a
+*.diff.*
+*.diff.*
 *.o
 *.pyc
 *.so
-*.diff.*
-*.thumb.*
 *.src.*
-*.diff.*
+*.thumb.*
+*.trace
 index.html
 CMakeCache.txt
 CMakeFiles
index 4cc36c65bab78bf7584a947dd6c656bd03675861..4cbcc374f5c59ec0be4ab224d4a61b82965d8c76 100755 (executable)
@@ -37,13 +37,9 @@ from base_driver import *
 
 class AsciiComparer:
 
-    def __init__(self, srcStream, refFileName, verbose=False):
+    def __init__(self, srcStream, refStream, verbose=False):
         self.srcStream = srcStream
-        self.refFileName = refFileName
-        if refFileName:
-            self.refStream = open(refFileName, 'rt')
-        else:
-            self.refStream = None
+        self.refStream = refStream
     
     def readLines(self, stream):
         lines = []
@@ -76,42 +72,29 @@ class AsciiComparer:
 
 class ToolDriver(Driver):
 
-    def runTool(self):
+    def runScript(self, refScript):
         '''Run the application standalone, skipping this test if it fails by
         some reason.'''
 
-        if self.options.ref_dump:
-            stdout = subprocess.PIPE
-        else:
-            stdout = None
+        refStream = open(refScript, 'rt')
 
-        cmd = [self.options.apitrace] + self.args
-        p = popen(cmd, cwd=options.cwd, stdout=stdout)
+        args = refStream.readline().split()
+        cmd = [self.options.apitrace] + args
+        cwd = os.path.dirname(os.path.abspath(refScript))
+        p = popen(cmd, cwd=cwd, stdout=subprocess.PIPE)
 
-        if self.options.ref_dump:
-            comparer = AsciiComparer(p.stdout, self.options.ref_dump, self.options.verbose)
-            comparer.compare()
+        comparer = AsciiComparer(p.stdout, refStream, self.options.verbose)
+        comparer.compare()
 
         p.wait()
         if p.returncode != 0:
             fail('tool returned code %i' % p.returncode)
     
-    def createOptParser(self):
-        optparser = Driver.createOptParser(self)
-
-        optparser.add_option(
-            '--ref-dump', metavar='PATH',
-            type='string', dest='ref_dump', default=None,
-            help='reference dump')
-
-        return optparser
-
     def run(self):
-        global options
-
-        (options, args) = self.parseOptions()
+        self.parseOptions()
 
-        self.runTool()
+        for arg in self.args:
+            self.runScript(arg)
 
         pass_()
 
index ab18a523a64275ef42d09489c81be99e1f0a593b..5262164282a9799b2e58fb4bd6fdcd69a8cacbf4 100644 (file)
@@ -1,16 +1,11 @@
-set (traces
-    incomplete-call
-    zlib-no-eof
-)
+file (GLOB scripts RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.script)
 
-foreach (trace ${traces})
+foreach (script ${scripts})
     add_test(
-        NAME trace_${trace}
+        NAME ${script}
         COMMAND
         python ${CMAKE_SOURCE_DIR}/tool_driver.py
             --apitrace ${APITRACE_EXECUTABLE}
-            --ref-dump ${CMAKE_CURRENT_SOURCE_DIR}/${trace}.ref.txt
-            --
-            dump --call-nos=no ${CMAKE_CURRENT_SOURCE_DIR}/${trace}.trace
+            ${CMAKE_CURRENT_SOURCE_DIR}/${script}
     )
-endforeach (trace)
+endforeach (script)
diff --git a/traces/incomplete-call.ref.txt b/traces/incomplete-call.ref.txt
deleted file mode 100644 (file)
index e277c19..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-glXChooseFBConfig(dpy = 0xa7d2a0, screen = 0, attribList = {GLX_RED_SIZE, 1, GLX_GREEN_SIZE, 1, GLX_BLUE_SIZE, 1, GLX_ALPHA_SIZE, 1, GLX_DOUBLEBUFFER, 1, 0}, nitems = &12) = {0xa9c480, 0xa9c570, 0xa9e260, 0xa9e350, 0xa9c750, 0xa9c840, 0xa9ccf0, 0xa9e530, 0xa9e620, 0xa9ead0, 0xa9cde0, 0xa9ebc0}
-glXGetVisualFromFBConfig(dpy = 0xa7d2a0, config = 0xa9c480) = &{visual = 0xa88178, visualid = 154, screen = 0, depth = 24, c_class = 4, red_mask = 16711680, green_mask = 65280, blue_mask = 255, colormap_size = 256, bits_per_rgb = 8}
-glXCreateNewContext(dpy = 0xa7d2a0, config = 0xa9c480, renderType = GLX_RGBA_TYPE, shareList = NULL, direct = True) = 0xa95660
-glXMakeContextCurrent(dpy = 0xa7d2a0, draw = 67108866, read = 67108866, ctx = 0xa95660) = True
-glXMakeContextCurrent(dpy = 0xa7d2a0, draw = 67108866, read = 67108866, ctx = 0xa95660) = True
-glGetIntegerv(pname = GL_RED_BITS, params = ?) // incomplete
diff --git a/traces/incomplete-call.script b/traces/incomplete-call.script
new file mode 100644 (file)
index 0000000..317a22a
--- /dev/null
@@ -0,0 +1,7 @@
+dump incomplete-call.trace
+1 glXChooseFBConfig(dpy = 0xa7d2a0, screen = 0, attribList = {GLX_RED_SIZE, 1, GLX_GREEN_SIZE, 1, GLX_BLUE_SIZE, 1, GLX_ALPHA_SIZE, 1, GLX_DOUBLEBUFFER, 1, 0}, nitems = &12) = {0xa9c480, 0xa9c570, 0xa9e260, 0xa9e350, 0xa9c750, 0xa9c840, 0xa9ccf0, 0xa9e530, 0xa9e620, 0xa9ead0, 0xa9cde0, 0xa9ebc0}
+2 glXGetVisualFromFBConfig(dpy = 0xa7d2a0, config = 0xa9c480) = &{visual = 0xa88178, visualid = 154, screen = 0, depth = 24, c_class = 4, red_mask = 16711680, green_mask = 65280, blue_mask = 255, colormap_size = 256, bits_per_rgb = 8}
+3 glXCreateNewContext(dpy = 0xa7d2a0, config = 0xa9c480, renderType = GLX_RGBA_TYPE, shareList = NULL, direct = True) = 0xa95660
+5 glXMakeContextCurrent(dpy = 0xa7d2a0, draw = 67108866, read = 67108866, ctx = 0xa95660) = True
+6 glXMakeContextCurrent(dpy = 0xa7d2a0, draw = 67108866, read = 67108866, ctx = 0xa95660) = True
+7 glGetIntegerv(pname = GL_RED_BITS, params = ?) // incomplete
diff --git a/traces/zlib-no-eof.ref.txt b/traces/zlib-no-eof.ref.txt
deleted file mode 100644 (file)
index acd3858..0000000
+++ /dev/null
@@ -1,28 +0,0 @@
-glXChooseFBConfig(dpy = 0x1da4360, screen = 0, attribList = {GLX_RED_SIZE, GLX_USE_GL, GLX_GREEN_SIZE, GLX_USE_GL, GLX_BLUE_SIZE, GLX_USE_GL, GLX_ALPHA_SIZE, GLX_USE_GL, GLX_DOUBLEBUFFER, GLX_USE_GL, 0}, nitems = &42) = {0x1e36000, 0x1e36700, 0x1e36e00, 0x1e37500, 0x1e37c00, 0x1e38300, 0x1e38a00, 0x1e39100, 0x1e39800, 0x1e39f00, 0x1e35c80, 0x1e36380, 0x1e36a80, 0x1e37180, 0x1e37880, 0x1e37f80, 0x1e38680, 0x1e38d80, 0x1e39480, 0x1e39b80, 0x1e35e40, 0x1e36540, 0x1e36c40, 0x1e37340, 0x1e37a40, 0x1e38140, 0x1e38840, 0x1e38f40, 0x1e39640, 0x1e39d40, 0x1e35ac0, 0x1e361c0, 0x1e368c0, 0x1e36fc0, 0x1e376c0, 0x1e37dc0, 0x1e384c0, 0x1e38bc0, 0x1e392c0, 0x1e399c0, 0x1e3a1a0, 0x1e3a280}
-glXGetVisualFromFBConfig(dpy = 0x1da4360, config = 0x1e36000) = &{visual = 0x1daf630, visualid = 41, screen = 0, depth = 24, c_class = 4, red_mask = 16711680, green_mask = 65280, blue_mask = 255, colormap_size = 256, bits_per_rgb = 8}
-glXCreateNewContext(dpy = 0x1da4360, config = 0x1e36000, renderType = GLX_RGBA_TYPE, shareList = NULL, direct = True) = 0x1e1cad0
-glXMakeContextCurrent(dpy = 0x1da4360, draw = 69206018, read = 69206018, ctx = 0x1e1cad0) = True
-glXMakeContextCurrent(dpy = 0x1da4360, draw = 69206018, read = 69206018, ctx = 0x1e1cad0) = True
-glClearColor(red = 0.3, green = 0.1, blue = 0.3, alpha = 0)
-glXMakeContextCurrent(dpy = 0x1da4360, draw = 69206018, read = 69206018, ctx = 0x1e1cad0) = True
-glViewport(x = 0, y = 0, width = 250, height = 250)
-glMatrixMode(mode = GL_PROJECTION)
-glLoadIdentity()
-glOrtho(left = -1, right = 1, bottom = -1, top = 1, zNear = -0.5, zFar = 1000)
-glMatrixMode(mode = GL_MODELVIEW)
-glXMakeContextCurrent(dpy = 0x1da4360, draw = 69206018, read = 69206018, ctx = 0x1e1cad0) = True
-glXMakeContextCurrent(dpy = 0x1da4360, draw = 69206018, read = 69206018, ctx = 0x1e1cad0) = True
-glClear(mask = GL_COLOR_BUFFER_BIT)
-glBegin(mode = GL_TRIANGLES)
-glColor3f(red = 0.8, green = 0, blue = 0)
-glVertex3f(x = -0.9, y = -0.9, z = -30)
-glColor3f(red = 0, green = 0.9, blue = 0)
-glVertex3f(x = 0.9, y = -0.9, z = -30)
-glColor3f(red = 0, green = 0, blue = 0.7)
-glVertex3f(x = 0, y = 0.9, z = -30)
-glEnd()
-glFlush()
-glFlush()
-glXSwapBuffers(dpy = 0x1da4360, drawable = 69206018)
-
-glXMakeContextCurrent(dpy = 0x1da4360, draw = 69206018, read = 69206018, ctx = 0x1e1cad0) = True
diff --git a/traces/zlib-no-eof.script b/traces/zlib-no-eof.script
new file mode 100644 (file)
index 0000000..0e811de
--- /dev/null
@@ -0,0 +1,29 @@
+dump zlib-no-eof.trace
+1 glXChooseFBConfig(dpy = 0x1da4360, screen = 0, attribList = {GLX_RED_SIZE, GLX_USE_GL, GLX_GREEN_SIZE, GLX_USE_GL, GLX_BLUE_SIZE, GLX_USE_GL, GLX_ALPHA_SIZE, GLX_USE_GL, GLX_DOUBLEBUFFER, GLX_USE_GL, 0}, nitems = &42) = {0x1e36000, 0x1e36700, 0x1e36e00, 0x1e37500, 0x1e37c00, 0x1e38300, 0x1e38a00, 0x1e39100, 0x1e39800, 0x1e39f00, 0x1e35c80, 0x1e36380, 0x1e36a80, 0x1e37180, 0x1e37880, 0x1e37f80, 0x1e38680, 0x1e38d80, 0x1e39480, 0x1e39b80, 0x1e35e40, 0x1e36540, 0x1e36c40, 0x1e37340, 0x1e37a40, 0x1e38140, 0x1e38840, 0x1e38f40, 0x1e39640, 0x1e39d40, 0x1e35ac0, 0x1e361c0, 0x1e368c0, 0x1e36fc0, 0x1e376c0, 0x1e37dc0, 0x1e384c0, 0x1e38bc0, 0x1e392c0, 0x1e399c0, 0x1e3a1a0, 0x1e3a280}
+2 glXGetVisualFromFBConfig(dpy = 0x1da4360, config = 0x1e36000) = &{visual = 0x1daf630, visualid = 41, screen = 0, depth = 24, c_class = 4, red_mask = 16711680, green_mask = 65280, blue_mask = 255, colormap_size = 256, bits_per_rgb = 8}
+3 glXCreateNewContext(dpy = 0x1da4360, config = 0x1e36000, renderType = GLX_RGBA_TYPE, shareList = NULL, direct = True) = 0x1e1cad0
+5 glXMakeContextCurrent(dpy = 0x1da4360, draw = 69206018, read = 69206018, ctx = 0x1e1cad0) = True
+6 glXMakeContextCurrent(dpy = 0x1da4360, draw = 69206018, read = 69206018, ctx = 0x1e1cad0) = True
+10 glClearColor(red = 0.3, green = 0.1, blue = 0.3, alpha = 0)
+11 glXMakeContextCurrent(dpy = 0x1da4360, draw = 69206018, read = 69206018, ctx = 0x1e1cad0) = True
+12 glViewport(x = 0, y = 0, width = 250, height = 250)
+13 glMatrixMode(mode = GL_PROJECTION)
+14 glLoadIdentity()
+15 glOrtho(left = -1, right = 1, bottom = -1, top = 1, zNear = -0.5, zFar = 1000)
+16 glMatrixMode(mode = GL_MODELVIEW)
+17 glXMakeContextCurrent(dpy = 0x1da4360, draw = 69206018, read = 69206018, ctx = 0x1e1cad0) = True
+18 glXMakeContextCurrent(dpy = 0x1da4360, draw = 69206018, read = 69206018, ctx = 0x1e1cad0) = True
+19 glClear(mask = GL_COLOR_BUFFER_BIT)
+20 glBegin(mode = GL_TRIANGLES)
+21 glColor3f(red = 0.8, green = 0, blue = 0)
+22 glVertex3f(x = -0.9, y = -0.9, z = -30)
+23 glColor3f(red = 0, green = 0.9, blue = 0)
+24 glVertex3f(x = 0.9, y = -0.9, z = -30)
+25 glColor3f(red = 0, green = 0, blue = 0.7)
+26 glVertex3f(x = 0, y = 0.9, z = -30)
+27 glEnd()
+28 glFlush()
+29 glFlush()
+30 glXSwapBuffers(dpy = 0x1da4360, drawable = 69206018)
+
+31 glXMakeContextCurrent(dpy = 0x1da4360, draw = 69206018, read = 69206018, ctx = 0x1e1cad0) = True