diff options
author | Alon Zakai <alonzakai@gmail.com> | 2013-07-30 14:21:15 -0700 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2013-07-30 14:21:15 -0700 |
commit | e6820abcba785a2b54240920c7c9bf649eb5270c (patch) | |
tree | c0dbeae471e738e7c67a6215868b7153bf3f7186 | |
parent | 49f6c7e7c295c0ec0bbd99683de7330f1cffd8dd (diff) |
fix and test for multiple static linking
-rw-r--r-- | emlink.py | 2 | ||||
-rwxr-xr-x | tests/runner.py | 17 |
2 files changed, 18 insertions, 1 deletions
@@ -56,7 +56,7 @@ class AsmModule(): self.imports = {} for imp in js_optimizer.import_sig.finditer(self.imports_js): key, value = imp.group(0).split('var ')[1][:-1].split('=', 1) - self.imports[key] = value + self.imports[key.strip()] = value.strip() #print >> sys.stderr, 'imports', self.imports # funcs diff --git a/tests/runner.py b/tests/runner.py index c813a921..a4b396f2 100755 --- a/tests/runner.py +++ b/tests/runner.py @@ -11034,6 +11034,23 @@ f.close() std::string side() { return "and hello from side"; } ''', ['hello from main and hello from side\n']) + # followup to iostream test: a second linking + print 'second linking of a linking output' + open('moar.cpp', 'w').write(r''' + #include <iostream> + struct Moar { + Moar() { std::cout << "moar!" << std::endl; } + }; + Moar m; + ''') + Popen([PYTHON, EMCC, 'moar.cpp', '-o', 'moar.js', '-s', 'SIDE_MODULE=1', '-O2']).communicate() + Popen([PYTHON, EMLINK, 'together.js', 'moar.js', 'triple.js'], stdout=PIPE).communicate() + assert os.path.exists('triple.js') + for engine in JS_ENGINES: + out = run_js('triple.js', engine=engine, stderr=PIPE, full_output=True) + self.assertContained('moar!\nhello from main and hello from side\n', out) + if engine == SPIDERMONKEY_ENGINE: self.validate_asmjs(out) + # zlib compression library. tests function pointers in initializers and many other things test('zlib', '', open(path_from_root('tests', 'zlib', 'example.c'), 'r').read(), self.get_library('zlib', os.path.join('libz.a'), make_args=['libz.a']), |