aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2013-07-18 19:14:07 -0700
committerAlon Zakai <alonzakai@gmail.com>2013-07-18 19:14:07 -0700
commit528ff4b80496068650f9308e18a59d5165335783 (patch)
tree01b05ffba7c56d68e1cefaa2ae54286e7db9a891
parentb8e7b66fe40e6117f9b7eaee264d407ef91d29eb (diff)
preparations for outline test on zlib
-rwxr-xr-xtests/runner.py35
1 files changed, 35 insertions, 0 deletions
diff --git a/tests/runner.py b/tests/runner.py
index 020f2bdb..9865dab8 100755
--- a/tests/runner.py
+++ b/tests/runner.py
@@ -10817,6 +10817,41 @@ f.close()
args=['-I' + path_from_root('tests', 'bullet', 'src')])
+ def zzztest_outline(self):
+ def test(name, src, libs, expected, args=[], suffix='cpp'):
+ print name
+
+ def measure_funcs(filename):
+ i = 0
+ start = -1
+ curr = '?'
+ ret = {}
+ for line in open(filename):
+ i += 1
+ if line.startswith('function '):
+ start = i
+ curr = line
+ elif line.startswith('}'):
+ size = i - start
+ if size > 100: ret[curr] = size
+ return ret
+
+ sizes = {}
+ for outlining_limit in [0, 500, 1000, 2500, 5000, 10000]:
+ Popen([PYTHON, EMCC, src] + libs + ['-o', 'test.js', '-O2', '-g3', '-s', 'OUTLINING_LIMIT=%d' % outlining_limit] + args).communicate()
+ assert os.path.exists('test.js')
+ for engine in JS_ENGINES:
+ out = run_js('test.js', engine=engine, stderr=PIPE, full_output=True)
+ self.assertContained(expected, out)
+ #if engine == SPIDERMONKEY_ENGINE: self.validate_asmjs(out)
+ sizes[outlining_limit] = max(measure_funcs('test.js').values())
+ print sizes
+
+ test('zlib', path_from_root('tests', 'zlib', 'example.c'),
+ self.get_library('zlib', os.path.join('libz.a'), make_args=['libz.a']),
+ open(path_from_root('tests', 'zlib', 'ref.txt'), 'r').read(),
+ args=['-I' + path_from_root('tests', 'zlib')], suffix='c')
+
def test_symlink(self):
if os.name == 'nt':
return self.skip('Windows FS does not need to be tested for symlinks support, since it does not have them.')