diff options
author | Ehsan Akhgari <ehsan.akhgari@gmail.com> | 2012-04-10 15:42:01 -0400 |
---|---|---|
committer | Ehsan Akhgari <ehsan.akhgari@gmail.com> | 2012-04-16 12:08:39 -0400 |
commit | d0f27efe13ced7ba5d715761b4527b63920e5992 (patch) | |
tree | c913f1ed2ea27b71f56bd3d40f984277806ba2d0 /tests | |
parent | e2697bda82dd63df0e9dca1e657b3e57810edc2e (diff) |
Build the lzma-native binary if needed
Diffstat (limited to 'tests')
-rwxr-xr-x | tests/runner.py | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/tests/runner.py b/tests/runner.py index 58118127..871230c6 100755 --- a/tests/runner.py +++ b/tests/runner.py @@ -6812,6 +6812,17 @@ elif 'browser' in str(sys.argv): output = Popen(['python', EMCC, path_from_root('tests', 'hello_world_sdl.cpp'), '-o', 'something.html', '--pre-js', 'reftest.js']).communicate() self.run_browser('something.html', 'You should see "hello, world!" and a colored cube.', '/report_result?0') + def build_native_lzma(self): + lzma_native = path_from_root('third_party', 'lzma.js', 'lzma-native') + if os.path.isfile(lzma_native) and os.access(lzma_native, os.X_OK): return + + cwd = os.getcwd() + try: + os.chdir(path_from_root('third_party', 'lzma.js')) + Popen(['sh', './doit.sh']).communicate() + finally: + os.chdir(cwd) + def test_compression(self): open(os.path.join(self.get_dir(), 'main.cpp'), 'w').write(self.with_report_result(r''' #include <stdio.h> @@ -6824,6 +6835,7 @@ elif 'browser' in str(sys.argv): } ''')) + self.build_native_lzma() Popen(['python', EMCC, os.path.join(self.get_dir(), 'main.cpp'), '-o', 'page.html', '--compression', '%s,%s,%s' % (path_from_root('third_party', 'lzma.js', 'lzma-native'), path_from_root('third_party', 'lzma.js', 'lzma-decoder.js'), @@ -6926,6 +6938,7 @@ elif 'browser' in str(sys.argv): } ''')) + self.build_native_lzma() Popen(['python', EMCC, os.path.join(self.get_dir(), 'main.cpp'), '-o', 'page.html', '--preload-file', 'datafile.txt', '--preload-file', 'datafile2.txt', '--compression', '%s,%s,%s' % (path_from_root('third_party', 'lzma.js', 'lzma-native'), path_from_root('third_party', 'lzma.js', 'lzma-decoder.js'), @@ -6954,6 +6967,7 @@ elif 'browser' in str(sys.argv): shutil.copyfile(image, os.path.join(self.get_dir(), basename)) open(os.path.join(self.get_dir(), 'sdl_image.c'), 'w').write(self.with_report_result(open(path_from_root('tests', 'sdl_image.c')).read()).replace('screenshot.jpg', basename)) + self.build_native_lzma() Popen(['python', EMCC, os.path.join(self.get_dir(), 'sdl_image.c'), '--preload-file', basename, '-o', 'page.html', '--compression', '%s,%s,%s' % (path_from_root('third_party', 'lzma.js', 'lzma-native'), path_from_root('third_party', 'lzma.js', 'lzma-decoder.js'), |