diff options
author | Jukka Jylänki <jujjyl@gmail.com> | 2013-12-13 14:38:22 +0200 |
---|---|---|
committer | Jukka Jylänki <jujjyl@gmail.com> | 2013-12-13 14:38:22 +0200 |
commit | d18b148ed4ad68b6dcff960ede701d5373678520 (patch) | |
tree | 13c75a8c83a51445e8b0dc0d41c20f39c5e71dae /tests | |
parent | 93f2e138610d735cbae7004d43f1370abeae101e (diff) |
Add sanity test for --em-config emcc command line option.
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) + |