diff options
Diffstat (limited to 'tests/runner.py')
-rwxr-xr-x | tests/runner.py | 50 |
1 files changed, 39 insertions, 11 deletions
diff --git a/tests/runner.py b/tests/runner.py index 563f6bc1..54ae5a49 100755 --- a/tests/runner.py +++ b/tests/runner.py @@ -953,6 +953,22 @@ m_divisor is 1091269979 ''' self.do_run(src, 'zero 2, 104', ['hallo']) + def test_i64_i16(self): + if Settings.USE_TYPED_ARRAYS != 2: return self.skip('full i64 stuff only in ta2') + + src = r''' + #include <stdio.h> + int main(int argc, char ** argv){ + int y=-133; + __int64_t x= ((__int64_t)((short)(y)))*(100 + argc); + if(x>0) + printf(">0\n"); + else + printf("<=0\n"); + } + ''' + self.do_run(src, '<=0') + def test_i32_mul_precise(self): if self.emcc_args == None: return self.skip('needs ta2') @@ -4023,7 +4039,7 @@ at function.:blag self.do_run(src, re.sub('(^|\n)\s+', '\\1', expected)) def test_atoX(self): - if Settings.QUANTUM_SIZE != 4: return self.skip('need q4 for atoll') + if self.emcc_args is None: return self.skip('requires ta2') src = r''' #include <stdio.h> @@ -7633,15 +7649,17 @@ elif 'browser' in str(sys.argv): print '(moving on..)' def with_report_result(self, code): - return code.replace('REPORT_RESULT();', ''' - char output[1000]; - sprintf(output, - "xhr = new XMLHttpRequest();" - "xhr.open('GET', 'http://localhost:8888/report_result?%d');" - "xhr.send();", result); - emscripten_run_script(output); + return ''' + #define REPORT_RESULT_INTERNAL(sync) \ + char output[1000]; \ + sprintf(output, \ + "xhr = new XMLHttpRequest();" \ + "xhr.open('GET', 'http://localhost:8888/report_result?%d'%s);" \ + "xhr.send();", result, sync ? ", false" : ""); \ + emscripten_run_script(output); \ emscripten_run_script("setTimeout(function() { window.close() }, 1000)"); -''') + #define REPORT_RESULT() REPORT_RESULT_INTERNAL(0) +''' + code def reftest(self, expected): basename = os.path.basename(expected) @@ -7917,12 +7935,12 @@ elif 'browser' in str(sys.argv): event.initKeyEvent("keydown", true, true, window, 0, 0, 0, 0, c, c); - dispatchEvent(event); + document.dispatchEvent(event); var event2 = document.createEvent("KeyboardEvent"); event2.initKeyEvent("keyup", true, true, window, 0, 0, 0, 0, c, c); - dispatchEvent(event2); + document.dispatchEvent(event2); } ''') open(os.path.join(self.get_dir(), 'sdl_key.c'), 'w').write(self.with_report_result(open(path_from_root('tests', 'sdl_key.c')).read())) @@ -8141,6 +8159,9 @@ elif 'browser' in str(sys.argv): shutil.copyfile(path_from_root('tests', 'screenshot.png'), os.path.join(self.get_dir(), 'screenshot.png')) # preloaded *after* run self.btest('emscripten_fs_api_browser.cpp', '1') + def test_sdl_quit(self): + self.btest('sdl_quit.c', '1') + def test_gc(self): self.btest('browser_gc.cpp', '1') @@ -8782,6 +8803,7 @@ elif 'sanity' in str(sys.argv): def test_emcc_caching(self): INCLUDING_MESSAGE = 'emcc: including X' BUILDING_MESSAGE = 'emcc: building X for cache' + ERASING_MESSAGE = 'emcc: clearing cache' EMCC_CACHE = Cache.dirname @@ -8829,6 +8851,12 @@ elif 'sanity' in str(sys.argv): if emcc_debug: os.environ['EMCC_DEBUG'] = emcc_debug + # Manual cache clearing + assert os.path.exists(EMCC_CACHE) + output = self.do([EMCC, '--clear-cache']) + assert ERASING_MESSAGE in output + assert not os.path.exists(EMCC_CACHE) + else: raise Exception('Test runner is confused: ' + str(sys.argv)) |