aboutsummaryrefslogtreecommitdiff
path: root/tests/test_browser.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/test_browser.py')
-rw-r--r--tests/test_browser.py36
1 files changed, 36 insertions, 0 deletions
diff --git a/tests/test_browser.py b/tests/test_browser.py
index d0618af8..30d3b930 100644
--- a/tests/test_browser.py
+++ b/tests/test_browser.py
@@ -119,6 +119,13 @@ If manually bisecting:
Even better, add a breakpoint, e.g. on the printf, then reload, then step through and see the print (best to run with EM_SAVE_DIR=1 for the reload).
'''
+ def test_emscripten_log(self):
+ src = os.path.join(self.get_dir(), 'src.cpp')
+ open(src, 'w').write(self.with_report_result(open(path_from_root('tests', 'emscripten_log', 'emscripten_log.cpp')).read()))
+
+ Popen([PYTHON, EMCC, src, '--pre-js', path_from_root('src', 'emscripten-source-map.min.js'), '-g', '-o', 'page.html']).communicate()
+ self.run_browser('page.html', None, '/report_result?1')
+
def build_native_lzma(self):
lzma_native = path_from_root('third_party', 'lzma.js', 'lzma-native')
if os.path.isfile(lzma_native) and os.access(lzma_native, os.X_OK): return
@@ -1680,3 +1687,32 @@ keydown(100);keyup(100); // trigger the end
open(self.in_dir('data.dat'), 'w').write('data from the file ' + ('.' * 9000))
for extra_args in [[], ['--no-heap-copy']]:
self.btest(path_from_root('tests', 'mmap_file.c'), expected='1', args=['--preload-file', 'data.dat'] + extra_args)
+
+ def test_emrun_info(self):
+ result = subprocess.check_output([PYTHON, path_from_root('emrun'), '--system_info', '--browser_info'])
+ assert 'CPU' in result
+ assert 'Browser' in result
+ assert 'Traceback' not in result
+
+ result = subprocess.check_output([PYTHON, path_from_root('emrun'), '--list_browsers'])
+ assert 'Traceback' not in result
+
+ def test_emrun(self):
+ Popen([PYTHON, EMCC, path_from_root('tests', 'hello_world_exit.c'), '--emrun', '-o', 'hello_world.html']).communicate()
+ outdir = os.getcwd()
+ # We cannot run emrun from the temp directory the suite will clean up afterwards, since the browser that is launched will have that directory as startup directory,
+ # and the browser will not close as part of the test, pinning down the cwd on Windows and it wouldn't be possible to delete it. Therefore switch away from that directory
+ # before launching.
+ os.chdir(path_from_root())
+ args = [PYTHON, path_from_root('emrun'), '--timeout', '30', '--verbose', os.path.join(outdir, 'hello_world.html'), '1', '2', '3', '--log_stdout', os.path.join(outdir, 'stdout.txt'), '--log_stderr', os.path.join(outdir, 'stderr.txt')]
+ if emscripten_browser is not None:
+ args += ['--browser', emscripten_browser]
+ process = subprocess.Popen(args)
+ process.communicate()
+ stdout = open(os.path.join(outdir, 'stdout.txt'), 'r').read()
+ stderr = open(os.path.join(outdir, 'stderr.txt'), 'r').read()
+ assert process.returncode == 100
+ assert 'argc: 4' in stdout
+ assert 'argv[3]: 3' in stdout
+ assert 'hello, world!' in stdout
+ assert 'hello, error stream!' in stderr