diff options
author | Jukka Jylänki <jujjyl@gmail.com> | 2013-09-05 10:47:53 +0300 |
---|---|---|
committer | Jukka Jylänki <jujjyl@gmail.com> | 2013-09-11 10:36:00 +0300 |
commit | 16c04387f8072ba8db2a444237091f6dbfccd00a (patch) | |
tree | c04c3d28bc8ced280d2c9e74e014e5f33fc2a866 | |
parent | 6c4d3fff3e5da4352e2a111175ea0de6265a8729 (diff) |
Fix test_the_bullet on Windows. Closes #696. Related to #681. On Windows, use cmake to configure bullet build instead of ./configure. On Linux and OSX, run both configure and cmake-based tests.
-rw-r--r-- | tests/test_core.py | 59 |
1 files changed, 37 insertions, 22 deletions
diff --git a/tests/test_core.py b/tests/test_core.py index 54fbdcd1..714e2409 100644 --- a/tests/test_core.py +++ b/tests/test_core.py @@ -8640,29 +8640,44 @@ def process(filename): Settings.SAFE_HEAP_LINES = ['btVoronoiSimplexSolver.h:40', 'btVoronoiSimplexSolver.h:41', 'btVoronoiSimplexSolver.h:42', 'btVoronoiSimplexSolver.h:43'] - 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', [os.path.join('src', '.libs', 'libBulletDynamics.a'), - os.path.join('src', '.libs', 'libBulletCollision.a'), - os.path.join('src', '.libs', 'libLinearMath.a')], - configure_args=['--disable-demos','--disable-dependency-tracking']), - includes=[path_from_root('tests', 'bullet', 'src')]) - test() - - assert 'asm2g' in test_modes - if self.run_name == 'asm2g': - # Test forced alignment - print >> sys.stderr, 'testing FORCE_ALIGNED_MEMORY' - old = open('src.cpp.o.js').read() - Settings.FORCE_ALIGNED_MEMORY = 1 + 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] + # Windows cannot run configure sh scripts. + if WINDOWS and configure[0] == 'sh': + 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]), + includes=[path_from_root('tests', 'bullet', 'src')]) test() - new = open('src.cpp.o.js').read() - print len(old), len(new), old.count('tempBigInt'), new.count('tempBigInt') - assert len(old) > len(new) - assert old.count('tempBigInt') > new.count('tempBigInt') + + assert 'asm2g' in test_modes + if self.run_name == 'asm2g': + # Test forced alignment + print >> sys.stderr, 'testing FORCE_ALIGNED_MEMORY' + old = open('src.cpp.o.js').read() + Settings.FORCE_ALIGNED_MEMORY = 1 + test() + new = open('src.cpp.o.js').read() + print len(old), len(new), old.count('tempBigInt'), new.count('tempBigInt') + assert len(old) > len(new) + assert old.count('tempBigInt') > new.count('tempBigInt') def test_poppler(self): if self.emcc_args is None: return self.skip('very slow, we only do this in emcc runs') |