aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2014-06-17 10:35:21 -0700
committerAlon Zakai <alonzakai@gmail.com>2014-06-17 10:35:21 -0700
commit69c5dcbb2ed9e75994e45f592300ce17d7c76a1c (patch)
treeb6e75a7992b6d62f94f7fc94c1d196a1296dec3a
parent8b84c87b2185f2f44f1ce3ff2a096724de464922 (diff)
simplify proxy testing
-rwxr-xr-xtests/runner.py14
-rw-r--r--tests/test_browser.py5
2 files changed, 13 insertions, 6 deletions
diff --git a/tests/runner.py b/tests/runner.py
index a05b8a10..f1c80f28 100755
--- a/tests/runner.py
+++ b/tests/runner.py
@@ -675,12 +675,13 @@ class BrowserCore(RunnerCore):
''' % basename)
def btest(self, filename, expected=None, reference=None, force_c=False, reference_slack=0, manual_reference=False, post_build=None,
- args=[], outfile='test.html', message='.'): # TODO: use in all other tests
+ args=[], outfile='test.html', message='.', also_proxied=False): # TODO: use in all other tests
# if we are provided the source and not a path, use that
filename_is_src = '\n' in filename
src = filename if filename_is_src else ''
filepath = path_from_root('tests', filename) if not filename_is_src else ('main.c' if force_c else 'main.cpp')
temp_filepath = os.path.join(self.get_dir(), os.path.basename(filepath))
+ original_args = args[:]
if filename_is_src:
with open(temp_filepath, 'w') as f: f.write(src)
if not reference:
@@ -693,11 +694,20 @@ class BrowserCore(RunnerCore):
self.reftest(path_from_root('tests', reference))
if not manual_reference:
args = args + ['--pre-js', 'reftest.js', '-s', 'GL_TESTING=1']
- Popen([PYTHON, EMCC, temp_filepath, '-o', outfile] + args).communicate()
+ all_args = [PYTHON, EMCC, temp_filepath, '-o', outfile] + args
+ #print 'all args:', all_args
+ Popen(all_args).communicate()
assert os.path.exists(outfile)
if post_build: post_build()
if type(expected) is str: expected = [expected]
self.run_browser(outfile, message, ['/report_result?' + e for e in expected])
+ if also_proxied:
+ print 'proxied...'
+ assert not manual_reference
+ manual_reference = True
+ assert not post_build
+ post_build = self.post_manual_reftest
+ self.btest(filename, expected, reference, force_c, reference_slack, manual_reference, post_build, original_args + ['--proxy-to-worker', '-s', 'GL_TESTING=1'], outfile, message)
###################################################################################################
diff --git a/tests/test_browser.py b/tests/test_browser.py
index 0fc2fd61..839d55e3 100644
--- a/tests/test_browser.py
+++ b/tests/test_browser.py
@@ -1487,10 +1487,7 @@ keydown(100);keyup(100); // trigger the end
self.btest('cubegeom_pre3.c', reference='cubegeom_pre2.png', args=['-s', 'LEGACY_GL_EMULATION=1'])
def test_cubegeom(self):
- self.btest('cubegeom.c', reference='cubegeom.png', args=['-O2', '-g', '-s', 'LEGACY_GL_EMULATION=1'])
-
- def test_cubegeom_proxy(self):
- self.btest('cubegeom.c', reference='cubegeom.png', args=['-O2', '-g', '-s', 'LEGACY_GL_EMULATION=1', '--proxy-to-worker', '-s', 'GL_TESTING=1'], manual_reference=True, post_build=self.post_manual_reftest)
+ self.btest('cubegeom.c', reference='cubegeom.png', args=['-O2', '-g', '-s', 'LEGACY_GL_EMULATION=1'], also_proxied=True)
def test_cubegeom_proc(self):
open('side.c', 'w').write(r'''