aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJukka Jylänki <jujjyl@gmail.com>2013-11-15 13:54:44 +0200
committerJukka Jylänki <jujjyl@gmail.com>2013-11-15 13:54:44 +0200
commitb5bb92c44e86de9a3ee6aa7f4c7f96c1d4a8c314 (patch)
tree09a1e2be815ec96dfb15eabdc062df6210e4a9ec
parenta30bd539fef6ced02bfa83f87b9a8e3f36a7fa97 (diff)
Move bullet library build code to runner.py so that it can be shared between test_the_bullet in test_core.py and test_static_link test_other.py.
-rwxr-xr-xtests/runner.py18
-rw-r--r--tests/test_core.py21
2 files changed, 22 insertions, 17 deletions
diff --git a/tests/runner.py b/tests/runner.py
index 8c4a9abf..7f513635 100755
--- a/tests/runner.py
+++ b/tests/runner.py
@@ -673,6 +673,24 @@ class BrowserCore(RunnerCore):
###################################################################################################
+# Both test_core and test_other access the Bullet library, share the access here to avoid duplication.
+def get_bullet_library(runner_core, use_cmake):
+ if use_cmake:
+ configure_commands = ['cmake', '.']
+ configure_args = ['-DBUILD_DEMOS=OFF', '-DBUILD_EXTRAS=OFF']
+ # Depending on whether 'configure' or 'cmake' is used to build, Bullet places output files in different directory structures.
+ generated_libs = [os.path.join('src', 'BulletDynamics', 'libBulletDynamics.a'),
+ os.path.join('src', 'BulletCollision', 'libBulletCollision.a'),
+ os.path.join('src', 'LinearMath', 'libLinearMath.a')]
+ else:
+ configure_commands = ['sh', './configure']
+ configure_args = ['--disable-demos','--disable-dependency-tracking']
+ generated_libs = [os.path.join('src', '.libs', 'libBulletDynamics.a'),
+ os.path.join('src', '.libs', 'libBulletCollision.a'),
+ os.path.join('src', '.libs', 'libLinearMath.a')]
+
+ return runner_core.get_library('bullet', generated_libs, configure=configure_commands, configure_args=configure_args, cache_name_extra=configure_commands[0])
+
if __name__ == '__main__':
# Sanity checks
total_engines = len(JS_ENGINES)
diff --git a/tests/test_core.py b/tests/test_core.py
index 545bb63f..c305732d 100644
--- a/tests/test_core.py
+++ b/tests/test_core.py
@@ -3,7 +3,7 @@
import glob, hashlib, os, re, shutil, subprocess, sys
import tools.shared
from tools.shared import *
-from runner import RunnerCore, path_from_root, checked_sanity, test_modes
+from runner import RunnerCore, path_from_root, checked_sanity, test_modes, get_bullet_library
class T(RunnerCore): # Short name, to make it more fun to use manually on the commandline
def is_le32(self):
@@ -9001,30 +9001,17 @@ def process(filename):
Settings.SAFE_HEAP_LINES = ['btVoronoiSimplexSolver.h:40', 'btVoronoiSimplexSolver.h:41',
'btVoronoiSimplexSolver.h:42', 'btVoronoiSimplexSolver.h:43']
- configure_commands = [['sh', './configure'], ['cmake', '.']]
- configure_args = [['--disable-demos','--disable-dependency-tracking'], ['-DBUILD_DEMOS=OFF', '-DBUILD_EXTRAS=OFF']]
- for c in range(0,2):
- configure = configure_commands[c]
+ for use_cmake in [False, True]: # If false, use a configure script to configure Bullet build.
# Windows cannot run configure sh scripts.
- if WINDOWS and configure[0] == 'sh':
+ if WINDOWS and not use_cmake:
continue
- # Depending on whether 'configure' or 'cmake' is used to build, Bullet places output files in different directory structures.
- if configure[0] == 'sh':
- generated_libs = [os.path.join('src', '.libs', 'libBulletDynamics.a'),
- os.path.join('src', '.libs', 'libBulletCollision.a'),
- os.path.join('src', '.libs', 'libLinearMath.a')]
- else:
- generated_libs = [os.path.join('src', 'BulletDynamics', 'libBulletDynamics.a'),
- os.path.join('src', 'BulletCollision', 'libBulletCollision.a'),
- os.path.join('src', 'LinearMath', 'libLinearMath.a')]
-
def test():
self.do_run(open(path_from_root('tests', 'bullet', 'Demos', 'HelloWorld', 'HelloWorld.cpp'), 'r').read(),
[open(path_from_root('tests', 'bullet', 'output.txt'), 'r').read(), # different roundings
open(path_from_root('tests', 'bullet', 'output2.txt'), 'r').read(),
open(path_from_root('tests', 'bullet', 'output3.txt'), 'r').read()],
- libraries=self.get_library('bullet', generated_libs, configure=configure, configure_args=configure_args[c], cache_name_extra=configure[0]),
+ libraries=get_bullet_library(self, use_cmake),
includes=[path_from_root('tests', 'bullet', 'src')])
test()