aboutsummaryrefslogtreecommitdiff
path: root/tests/runner.py
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2011-12-12 11:24:16 -0800
committerAlon Zakai <alonzakai@gmail.com>2011-12-12 11:24:16 -0800
commita5bd3ed73db5f3d499eab532034bb9f6960df28f (patch)
treeaab395631955f7359389f344b75432a784886799 /tests/runner.py
parentae02feec361db8a69d51a69d51b02ea742212a94 (diff)
support for generating html in emcc, and a test for that that also tests SDL, and some fixes for SDL
Diffstat (limited to 'tests/runner.py')
-rw-r--r--tests/runner.py14
1 files changed, 13 insertions, 1 deletions
diff --git a/tests/runner.py b/tests/runner.py
index e8564585..ef99a7b1 100644
--- a/tests/runner.py
+++ b/tests/runner.py
@@ -12,7 +12,7 @@ will use 4 processes. To install nose do something like
'''
from subprocess import Popen, PIPE, STDOUT
-import os, unittest, tempfile, shutil, time, inspect, sys, math, glob, tempfile, re, difflib
+import os, unittest, tempfile, shutil, time, inspect, sys, math, glob, tempfile, re, difflib, webbrowser
# Setup
@@ -4963,6 +4963,18 @@ JavaScript in the final linking stage of building.
# TODO: when ready, switch tools/shared building to use emcc over emmaken
# TODO: add shebang to generated .js files, using JS_ENGINES[0]? #!/usr/bin/python etc
+ # Finally, test HTML generation. (Coincidentally we also test that compiling a .cpp works in EMCC here.)
+ clear()
+ output = Popen([EMCC, path_from_root('tests', 'hello_world_sdl.cpp'), '-o', 'something.html'], stdout=PIPE, stderr=PIPE).communicate(input)
+ assert len(output[0]) == 0, output[0]
+ assert os.path.exists('something.html'), output
+ webbrowser.open_new(os.path.join(self.get_dir(), 'something.html'))
+ print 'A web browser window should have opened a page containing the results of a part of this test.'
+ print 'You need to manually look at the page to see that it works ok: You should see "hello, world!" and a colored cube.'
+ print '(sleeping for a bit to keep the directory alive for the web browser..)'
+ time.sleep(5)
+ print '(moving on..)'
+
def test_eliminator(self):
input = open(path_from_root('tools', 'eliminator', 'eliminator-test.js')).read()
expected = open(path_from_root('tools', 'eliminator', 'eliminator-test-output.js')).read()