From 6bd03f06bc7875962e85cc643b54b7ed093b9900 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Jos=C3=A9=20Fonseca?= Date: Mon, 31 Oct 2011 14:00:28 +0000 Subject: [PATCH] Test on Windows. --- .gitignore | 1 + apps/gl/CMakeLists.txt | 2 +- driver.py | 21 ++++++++++++++++----- 3 files changed, 18 insertions(+), 6 deletions(-) diff --git a/.gitignore b/.gitignore index 0f342ec..d48682b 100644 --- a/.gitignore +++ b/.gitignore @@ -5,5 +5,6 @@ CMakeFiles CTestTestfile.cmake Makefile Testing +build cmake_install.cmake results diff --git a/apps/gl/CMakeLists.txt b/apps/gl/CMakeLists.txt index ac7ec55..e14ad3a 100644 --- a/apps/gl/CMakeLists.txt +++ b/apps/gl/CMakeLists.txt @@ -28,6 +28,6 @@ foreach (target ${targets}) COMMAND python ${CMAKE_SOURCE_DIR}/driver.py --build ${APITRACE_BINARY_DIR} --ref-dump ${CMAKE_CURRENT_SOURCE_DIR}/${target}.ref.txt - ${CMAKE_CURRENT_BINARY_DIR}/${target} + "$" ) endforeach (target) diff --git a/driver.py b/driver.py index 7f04f24..48b04ec 100755 --- a/driver.py +++ b/driver.py @@ -31,6 +31,7 @@ import optparse import os.path import platform import re +import shutil import subprocess import sys import time @@ -56,6 +57,11 @@ def _get_build_path(path): sys.exit(1) return path +def _get_build_program(program): + if platform.system() == 'Windows': + program += '.exe' + return _get_build_path(program) + class TestCase: @@ -94,10 +100,11 @@ class TestCase: env = os.environ.copy() system = platform.system() + local_wrapper = None if system == 'Windows': - # TODO - self.skip('tracing not supported on Windows') wrapper = _get_build_path('wrappers/opengl32.dll') + local_wrapper = os.path.join(os.path.dirname(self.args[0]), os.path.basename(wrapper)) + shutil.copy(wrapper, local_wrapper) elif system == 'Darwin': wrapper = _get_build_path('wrappers/OpenGL') env['DYLD_LIBRARY_PATH'] = os.path.dirname(wrapper) @@ -109,8 +116,12 @@ class TestCase: if self.max_frames is not None: env['TRACE_FRAMES'] = str(self.max_frames) - p = popen(self.args, env=env, cwd=self.cwd) - p.wait() + try: + p = popen(self.args, env=env, cwd=self.cwd) + p.wait() + finally: + if local_wrapper is not None: + os.remove(local_wrapper) if not os.path.exists(self.trace_file): self.fail('no trace file generated\n') @@ -119,7 +130,7 @@ class TestCase: def dump(self): - cmd = [_get_build_path('tracedump'), '--color=never', self.trace_file] + cmd = [_get_build_program('tracedump'), '--color=never', self.trace_file] p = popen(cmd, stdout=subprocess.PIPE) swapbuffers = 0 -- 2.43.0