X-Git-Url: https://git.cworth.org/git?a=blobdiff_plain;f=driver.py;h=c26ea8ad4f2a318493dd1ae9a0081037134c88ca;hb=59e9ab545ce076d9624d8bc0cb3a95b637e40476;hp=31f49fc68a2dfbc3a541379186d63c0342c63b49;hpb=7acb60aa5e6b9c2d905c64a1416d222c83bd9e79;p=apitrace-tests diff --git a/driver.py b/driver.py index 31f49fc..c26ea8a 100755 --- a/driver.py +++ b/driver.py @@ -65,8 +65,8 @@ def _get_build_program(program): class TestCase: + api = 'gl' max_frames = None - trace_file = None def __init__(self, name, args, cwd=None, build=None, results = '.'): @@ -87,6 +87,13 @@ class TestCase: if p.returncode: self.skip('application returned code %i' % p.returncode) + api_map = { + 'gl': 'gl', + 'egl': 'egl', + 'gles1': 'egl', + 'gles2': 'egl', + } + def trace(self): if self.trace_file is None: self.trace_file = os.path.abspath(os.path.join(self.results, self.name + '.trace')) @@ -111,7 +118,8 @@ class TestCase: apitrace = _get_build_program('apitrace') cmd = [ apitrace, 'trace', - '-o', self.trace_file, + '--api', self.api_map[self.api], + '--output', self.trace_file, '--' ] + cmd if self.max_frames is not None: @@ -144,8 +152,8 @@ class TestCase: ref_line = ref.readline().rstrip() for line in p.stdout: line = line.rstrip() + print line mo = self.call_re.match(line) - assert mo if mo: call_no = int(mo.group(1)) function_name = mo.group(2) @@ -154,13 +162,15 @@ class TestCase: if function_name in ('glFlush', 'glFinish'): flushes += 1 src_line = line[mo.start(2):] - if ref_line: - if src_line == ref_line: - sys.stdout.write(src_line + '\n') - ref_line = ref.readline().rstrip() - src_lines = [] - else: - src_lines.append(src_line) + else: + src_line = line + if ref_line: + if src_line == ref_line: + sys.stdout.write(src_line + '\n') + ref_line = ref.readline().rstrip() + src_lines = [] + else: + src_lines.append(src_line) p.wait() if p.returncode != 0: @@ -256,6 +266,10 @@ def main(): optparser = optparse.OptionParser( usage='\n\t%prog [options] -- program [args] ...', version='%%prog') + optparser.add_option( + '-a', '--api', metavar='API', + type='string', dest='api', default='gl', + help='api to trace') optparser.add_option( '-B', '--build', metavar='PATH', type='string', dest='build', default='..', @@ -284,6 +298,7 @@ def main(): build = options.build, results = options.results, ) + test.api = options.api test.ref_dump = options.ref_dump test.run()