add test harness support for proxying, test_sdl_canvas_proxy passes
This commit is contained in:
Родитель
82a80c6724
Коммит
2d0bd0061a
|
@ -646,7 +646,7 @@ class BrowserCore(RunnerCore):
|
|||
});
|
||||
''' % basename)
|
||||
|
||||
def btest(self, filename, expected=None, reference=None, force_c=False, reference_slack=0,
|
||||
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
|
||||
# if we are provided the source and not a path, use that
|
||||
filename_is_src = '\n' in filename
|
||||
|
@ -663,9 +663,11 @@ class BrowserCore(RunnerCore):
|
|||
expected = [str(i) for i in range(0, reference_slack+1)]
|
||||
shutil.copyfile(filepath, temp_filepath)
|
||||
self.reftest(path_from_root('tests', reference))
|
||||
args = args + ['--pre-js', 'reftest.js', '-s', 'GL_TESTING=1']
|
||||
if not manual_reference:
|
||||
args = args + ['--pre-js', 'reftest.js', '-s', 'GL_TESTING=1']
|
||||
Popen([PYTHON, EMCC, temp_filepath, '-o', outfile] + 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])
|
||||
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <SDL/SDL.h>
|
||||
#include <emscripten.h>
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
SDL_Init(SDL_INIT_VIDEO);
|
||||
|
@ -17,8 +18,7 @@ int main(int argc, char **argv) {
|
|||
|
||||
SDL_Quit();
|
||||
|
||||
printf("done.\n");
|
||||
|
||||
EM_ASM(window.close());
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
Двоичный файл не отображается.
После Ширина: | Высота: | Размер: 4.4 KiB |
|
@ -628,7 +628,24 @@ If manually bisecting:
|
|||
self.run_browser('page.html', '', '/report_result?1')
|
||||
|
||||
def test_sdl_canvas_proxy(self):
|
||||
self.btest('sdl_canvas_proxy.c', '1', args=['--proxy-to-worker'])
|
||||
def post():
|
||||
html = open('test.html').read()
|
||||
html = html.replace('</body>', '''
|
||||
<script>
|
||||
function assert(x, y) { if (!x) throw 'assertion failed ' + y }
|
||||
|
||||
%s
|
||||
|
||||
var windowClose = window.close;
|
||||
window.close = function() {
|
||||
doReftest();
|
||||
setTimeout(windowClose, 1000);
|
||||
};
|
||||
</script>
|
||||
</body>''' % open('reftest.js').read())
|
||||
open('test.html', 'w').write(html)
|
||||
|
||||
self.btest('sdl_canvas_proxy.c', reference='sdl_canvas_proxy.png', args=['--proxy-to-worker'], manual_reference=True, post_build=post)
|
||||
|
||||
def test_sdl_key(self):
|
||||
open(os.path.join(self.get_dir(), 'pre.js'), 'w').write('''
|
||||
|
|
Загрузка…
Ссылка в новой задаче