diff options
author | Alon Zakai <alonzakai@gmail.com> | 2013-12-16 16:24:39 -0800 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2013-12-16 16:24:39 -0800 |
commit | 4fb00853a9998374666c85d89c350782b9e45250 (patch) | |
tree | 5eddfb302a1875343866296dd334f2b6c2e35b24 /tests | |
parent | 3b2466246537461a2d4811e93c659d23513d5408 (diff) | |
parent | 69317b35549ae38cf99c4c896d556803d58174cc (diff) |
Merge pull request #1896 from juj/emrun
Emrun
Diffstat (limited to 'tests')
-rw-r--r-- | tests/hello_world_exit.c | 9 | ||||
-rw-r--r-- | tests/test_browser.py | 22 |
2 files changed, 31 insertions, 0 deletions
diff --git a/tests/hello_world_exit.c b/tests/hello_world_exit.c new file mode 100644 index 00000000..febecc65 --- /dev/null +++ b/tests/hello_world_exit.c @@ -0,0 +1,9 @@ +#include<stdio.h> +#include<stdlib.h> + +int main() { + printf("hello, world!\n"); + fprintf(stderr, "hello, error stream!\n"); + exit(100); +} + diff --git a/tests/test_browser.py b/tests/test_browser.py index d0618af8..55bab05b 100644 --- a/tests/test_browser.py +++ b/tests/test_browser.py @@ -1680,3 +1680,25 @@ 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()) + process = subprocess.Popen([PYTHON, path_from_root('emrun'), '--timeout', '30', '--verbose', os.path.join(outdir, 'hello_world.html')], stdout=subprocess.PIPE, stderr=subprocess.PIPE) + (stdout, stderr) = process.communicate() + assert process.returncode == 100 + assert 'hello, world!' in stdout + assert 'hello, error stream!' in stderr |