+ args = [os.path.join('.', basename)]
+ window_name = args[0]
+
+ p = popen(args, cwd=dirname)
+ for i in range(6):
+ time.sleep(0.5)
+ if p.poll() is not None:
+ break
+ if subprocess.call(['xwininfo', '-name', window_name], stdout=subprocess.PIPE, stderr=subprocess.PIPE) == 0:
+ break
+ if p.returncode is None:
+ p.terminate()
+ elif p.returncode:
+ sys.stdout.write('SKIP (app)\n')
+ return
+
+ ref_image = os.path.join(options.results, demo.replace('/', '-') + '.ref.png')
+ p = popen(args, env=env, cwd=dirname)
+ try:
+ for i in range(10):
+ time.sleep(0.5)
+ if p.poll() is not None:
+ break
+ if subprocess.call(['xwininfo', '-name', window_name], stdout=subprocess.PIPE, stderr=subprocess.PIPE) == 0:
+ break
+
+ if p.returncode is None:
+ subprocess.call("xwd -name '%s' | xwdtopnm | pnmtopng > '%s'" % (args[0], ref_image), shell=True)
+ finally:
+ if p.returncode is None:
+ p.terminate()
+ p.wait()
+ elif p.returncode:
+ print p.returncode
+ sys.stdout.write('FAIL (trace)\n')
+ return
+
+ p = popen([os.path.join(options.build, 'tracedump'), trace], stdout=subprocess.PIPE)