Skip to content

Commit

Permalink
update embuilder and tests for new libcxx building approach
Browse files Browse the repository at this point in the history
  • Loading branch information
kripken committed Apr 8, 2015
1 parent cb59242 commit 7939f34
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 6 deletions.
11 changes: 10 additions & 1 deletion embuilder.py
Expand Up @@ -26,6 +26,7 @@
build libc
libcxx
libcxx_noexcept
libcxxabi
gl
struct_info
Expand Down Expand Up @@ -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 <iostream>
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() {} };
Expand Down
12 changes: 7 additions & 5 deletions tests/test_sanity.py
Expand Up @@ -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':
Expand All @@ -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:
Expand Down Expand Up @@ -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']),
Expand Down

0 comments on commit 7939f34

Please sign in to comment.