diff --git a/embuilder.py b/embuilder.py index 931c655d413d..e76acb10a17c 100755 --- a/embuilder.py +++ b/embuilder.py @@ -26,6 +26,7 @@ build libc libcxx + libcxx_noexcept libcxxabi gl struct_info @@ -77,7 +78,15 @@ def build(src, result_libs, args=[]): std::cout << "hello"; return 0; } - ''', ['libcxx.bc']) + ''', ['libcxx.a']) + elif what == 'libcxx_noexcept': + build(''' + #include + int main() { + std::cout << "hello"; + return 0; + } + ''', ['libcxx_noexcept.a'], ['-s', 'DISABLE_EXCEPTION_CATCHING=1']) elif what == 'libcxxabi': build(''' struct X { int x; virtual void a() {} }; diff --git a/tests/test_sanity.py b/tests/test_sanity.py index c93a52120a5e..1bacfed35d8c 100644 --- a/tests/test_sanity.py +++ b/tests/test_sanity.py @@ -434,7 +434,7 @@ def test_emcc_caching(self): try_delete(basebc_name) # we might need to check this file later try_delete(dcebc_name) # we might need to check this file later for ll_name in ll_names: try_delete(ll_name) - output = self.do([compiler, '-O' + str(i), '-s', 'RELOOP=0', '--llvm-lto', '0', path_from_root('tests', filename), '--save-bc', 'a.bc']) + output = self.do([compiler, '-O' + str(i), '-s', 'RELOOP=0', '--llvm-lto', '0', path_from_root('tests', filename), '--save-bc', 'a.bc', '-s', 'DISABLE_EXCEPTION_CATCHING=0']) #print output assert INCLUDING_MESSAGE.replace('X', libname) in output if libname == 'libc': @@ -444,10 +444,11 @@ def test_emcc_caching(self): assert (BUILDING_MESSAGE.replace('X', libname) in output) == (i == 0), 'Must only build the first time' self.assertContained('hello, world!', run_js('a.out.js')) assert os.path.exists(EMCC_CACHE) - assert os.path.exists(os.path.join(EMCC_CACHE, libname + '.bc')) + full_libname = libname + '.bc' if libname != 'libcxx' else libname + '.a' + assert os.path.exists(os.path.join(EMCC_CACHE, full_libname)) if libname == 'libcxx': - print os.stat(os.path.join(EMCC_CACHE, libname + '.bc')).st_size, os.stat(basebc_name).st_size, os.stat(dcebc_name).st_size - assert os.stat(os.path.join(EMCC_CACHE, libname + '.bc')).st_size > 1000000, 'libc++ is big' + print os.stat(os.path.join(EMCC_CACHE, full_libname)).st_size, os.stat(basebc_name).st_size, os.stat(dcebc_name).st_size + assert os.stat(os.path.join(EMCC_CACHE, full_libname)).st_size > 1000000, 'libc++ is big' assert os.stat(basebc_name).st_size > 1000000, 'libc++ is indeed big' assert os.stat(dcebc_name).st_size < os.stat(basebc_name).st_size*0.666, 'Dead code elimination must remove most of libc++' finally: @@ -717,7 +718,8 @@ def test_embuilder(self): ([PYTHON, 'embuilder.py'], ['Emscripten System Builder Tool', 'build libc', 'native_optimizer'], True, []), ([PYTHON, 'embuilder.py', 'build', 'waka'], 'ERROR', False, []), ([PYTHON, 'embuilder.py', 'build', 'libc'], ['building and verifying libc', 'success'], True, ['libc.bc']), - ([PYTHON, 'embuilder.py', 'build', 'libcxx'], ['success'], True, ['libcxx.bc']), + ([PYTHON, 'embuilder.py', 'build', 'libcxx'], ['success'], True, ['libcxx.a']), + ([PYTHON, 'embuilder.py', 'build', 'libcxx_noexcept'], ['success'], True, ['libcxx_noexcept.a']), ([PYTHON, 'embuilder.py', 'build', 'libcxxabi'], ['success'], True, ['libcxxabi.bc']), ([PYTHON, 'embuilder.py', 'build', 'gl'], ['success'], True, ['gl.bc']), ([PYTHON, 'embuilder.py', 'build', 'struct_info'], ['success'], True, ['struct_info.compiled.json']),