]> git.cworth.org Git - apitrace-tests/commitdiff
Test on Windows.
authorJosé Fonseca <jose.r.fonseca@gmail.com>
Mon, 31 Oct 2011 14:00:28 +0000 (14:00 +0000)
committerJosé Fonseca <jose.r.fonseca@gmail.com>
Mon, 31 Oct 2011 14:00:28 +0000 (14:00 +0000)
.gitignore
apps/gl/CMakeLists.txt
driver.py

index 0f342ec3f394cd471e2872f7ac71fd59c703c72c..d48682bfdfb0e794eb64bd22780850017ae5e4f6 100644 (file)
@@ -5,5 +5,6 @@ CMakeFiles
 CTestTestfile.cmake
 Makefile
 Testing
+build
 cmake_install.cmake
 results
index ac7ec55b6bb172f2fbcbd5cdb7dd4b384e8be702..e14ad3a680aa2cf6cfcee4ebdef534410c9e33f4 100644 (file)
@@ -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}
+            "$<TARGET_FILE:${subdir}_${target}>"
     )
 endforeach (target)
index 7f04f2495a8cf3de5a450121692fd9a02793d29c..48b04ece6a355f021ee27592b660aecd687b44d6 100755 (executable)
--- 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