aboutsummaryrefslogtreecommitdiff
path: root/tests/runner.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/runner.py')
-rwxr-xr-xtests/runner.py32
1 files changed, 30 insertions, 2 deletions
diff --git a/tests/runner.py b/tests/runner.py
index 87f8a036..8d9de0a3 100755
--- a/tests/runner.py
+++ b/tests/runner.py
@@ -662,15 +662,26 @@ class BrowserCore(RunnerCore):
Module['preRun'].push(function() {
setTimeout(doReftest, 1000); // if run() throws an exception and postRun is not called, this will kick in
});
+
+ if (typeof WebGLClient !== 'undefined') {
+ // trigger reftest from RAF as well, needed for workers where there is no pre|postRun on the main thread
+ var realRAF = window.requestAnimationFrame;
+ window.requestAnimationFrame = function(func) {
+ realRAF(func);
+ setTimeout(doReftest, 1000);
+ };
+ }
+
''' % 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:
@@ -678,16 +689,33 @@ class BrowserCore(RunnerCore):
with open(filepath) as f: src = f.read()
with open(temp_filepath, 'w') as f: f.write(self.with_report_result(src))
else:
+ self.reference = reference
expected = [str(i) for i in range(0, reference_slack+1)]
shutil.copyfile(filepath, temp_filepath)
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...'
+ # save non-proxied
+ if not os.path.exists('normal'):
+ os.mkdir('normal')
+ shutil.copyfile('test.html', os.path.join('normal', 'test.html'))
+ shutil.copyfile('test.js', os.path.join('normal', 'test.js'))
+ if reference:
+ assert not manual_reference
+ manual_reference = True
+ assert not post_build
+ post_build = self.post_manual_reftest
+ # run proxied
+ self.btest(filename, expected, reference, force_c, reference_slack, manual_reference, post_build, original_args + ['--proxy-to-worker', '-s', 'GL_TESTING=1'], outfile, message)
###################################################################################################