diff options
author | Alon Zakai <alonzakai@gmail.com> | 2013-12-16 17:50:47 -0800 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2013-12-16 17:50:47 -0800 |
commit | 49e00037f0d7adefe33fd8f0b967b1920a89e5cc (patch) | |
tree | edf8a9dc0ab30c0af45cdee5c3fcecaee9c99c1c /tests | |
parent | b01d1845c4a4155db54da713691d86e2d2f42040 (diff) | |
parent | c4ce1f71e699c32f3a50edd06c619a8dc4e768ac (diff) |
Merge branch 'em_config' of github.com:juj/emscripten into incoming
Conflicts:
emcc
Diffstat (limited to 'tests')
-rw-r--r-- | tests/test_sanity.py | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/tests/test_sanity.py b/tests/test_sanity.py index c7dd86e4..dc3d53db 100644 --- a/tests/test_sanity.py +++ b/tests/test_sanity.py @@ -548,3 +548,31 @@ fi if old: os.environ['EMCC_LLVM_TARGET'] = old + def test_emconfig(self): + restore() + + (fd, custom_config_filename) = tempfile.mkstemp(prefix='.emscripten_config_') + + orig_config = open(CONFIG_FILE, 'r').read() + + # Move the ~/.emscripten to a custom location. + tfile = os.fdopen(fd, "w") + tfile.write(orig_config) + tfile.close() + + # Make a syntax error in the original config file so that attempting to access it would fail. + open(CONFIG_FILE, 'w').write('asdfasdfasdfasdf\n\'\'\'' + orig_config) + + temp_dir = tempfile.mkdtemp(prefix='emscripten_temp_') + + os.chdir(temp_dir) + self.do([EMCC, '-O2', '--em-config', custom_config_filename, path_from_root('tests', 'hello_world.c')]) + result = run_js('a.out.js') + + # Clean up created temp files. + os.remove(custom_config_filename) + os.chdir(path_from_root()) + shutil.rmtree(temp_dir) + + self.assertContained('hello, world!', result) + |