diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/cases/gepoverflow.txt | 2 | ||||
-rw-r--r-- | tests/hello_world_gles_shell.html | 6 | ||||
-rwxr-xr-x | tests/runner.py | 73 | ||||
-rw-r--r-- | tests/stat/output.txt | 16 |
4 files changed, 45 insertions, 52 deletions
diff --git a/tests/cases/gepoverflow.txt b/tests/cases/gepoverflow.txt index 50eaf405..164e5c0c 100644 --- a/tests/cases/gepoverflow.txt +++ b/tests/cases/gepoverflow.txt @@ -1,2 +1,2 @@ -*5246526,5247096* +*5246494,5247064* *-514,56* diff --git a/tests/hello_world_gles_shell.html b/tests/hello_world_gles_shell.html index 7f0b2013..d3429e3a 100644 --- a/tests/hello_world_gles_shell.html +++ b/tests/hello_world_gles_shell.html @@ -25,9 +25,6 @@ canvas: document.getElementById('canvas') }; - // The compiled code - {{{ SCRIPT_CODE }}} - // Test code function simulateKeyEvent(keyCode) { var event = document.createEvent("KeyboardEvent"); @@ -50,6 +47,9 @@ }, 0); } addEventListener("load", doTest, false); + + // The compiled code + {{{ SCRIPT_CODE }}} </script> </body> </html> diff --git a/tests/runner.py b/tests/runner.py index aaa9cf69..23937974 100755 --- a/tests/runner.py +++ b/tests/runner.py @@ -3289,13 +3289,16 @@ at function.:blag printf("%f, %f\n", atof("1.234567"), atof("cheez")); + float a = -1; + sscanf("-3.03", "%f", &a); + printf("%.4f\n", a); + return 0; } ''' - self.do_run(src, 'en-us : 2*en-r : 99*en : 3*1.234567, 0.000000', - output_nicerizer = lambda x: x.replace('\n', '*')) + self.do_run(src, 'en-us : 2\nen-r : 99\nen : 3\n1.234567, 0.000000\n-3.0300') - # Part 2: doubles (issue 148) + # Part 2: doubles if Settings.USE_TYPED_ARRAYS == 2: for ftype in ['float', 'double']: src = r''' @@ -3362,18 +3365,19 @@ Pass: 0.000012 0.000012''') Settings.CORRECT_SIGNS = 1 # Just so our output is what we expect. Can flip them both. post = ''' def process(filename): - src = open(filename, 'r').read().replace('FS.init();', '').replace( # Disable normal initialization, replace with ours - '// {{PRE_RUN_ADDITIONS}}', - \'\'\' - FS.createDataFile('/', 'somefile.binary', [100, 200, 50, 25, 10, 77, 123], true, false); // 200 becomes -56, since signed chars are used in memory - FS.createLazyFile('/', 'test.file', 'test.file', true, false); - var test_files_input = 'hi there!'; - var test_files_input_index = 0; - FS.init(function() { - return test_files_input.charCodeAt(test_files_input_index++) || null; - }); - \'\'\' - ) + src = \'\'\' + var Module = { + 'preRun': function() { + FS.createDataFile('/', 'somefile.binary', [100, 200, 50, 25, 10, 77, 123], true, false); // 200 becomes -56, since signed chars are used in memory + FS.createLazyFile('/', 'test.file', 'test.file', true, false); + var test_files_input = 'hi there!'; + var test_files_input_index = 0; + FS.init(function() { + return test_files_input.charCodeAt(test_files_input_index++) || null; + }); + } + }; + \'\'\' + open(filename, 'r').read() open(filename, 'w').write(src) ''' other = open(os.path.join(self.get_dir(), 'test.file'), 'w') @@ -3612,7 +3616,7 @@ def process(filename): f_blocks: 1000000 f_bfree: 500000 f_bavail: 500000 - f_files: 8 + f_files: 10 f_ffree: 1000000 f_favail: 1000000 f_fsid: 42 @@ -4315,19 +4319,6 @@ def process(filename): Settings.FAST_MEMORY = 4*1024*1024 Settings.EXPORTED_FUNCTIONS = ['_main', '_sqlite3_open', '_sqlite3_close', '_sqlite3_exec', '_sqlite3_free', '_callback']; - Settings.INVOKE_RUN = 0 # We append code that does run() ourselves - - post = ''' -def process(filename): - src = open(filename, 'a') - src.write(\'\'\' - FS.createPath('/', 'dev/shm/tmp', true, true); - FS.currentPath = '/dev/shm/tmp'; - run(); - \'\'\') - src.close() -''' - self.do_run(r''' #define SQLITE_DISABLE_LFS #define LONGDOUBLE_TYPE double @@ -4338,8 +4329,7 @@ def process(filename): open(path_from_root('tests', 'sqlite', 'benchmark.txt'), 'r').read(), includes=[path_from_root('tests', 'sqlite')], force_c=True, - js_engines=[SPIDERMONKEY_ENGINE], # V8 is slow - post_build=post)#,build_ll_hook=self.do_autodebug) + js_engines=[SPIDERMONKEY_ENGINE]) # V8 is slow def test_zlib(self): if self.emcc_args is not None and '-O2' in self.emcc_args: @@ -5658,16 +5648,8 @@ f.close() class TestServerHandler(BaseHTTPServer.BaseHTTPRequestHandler): def do_GET(s): assert s.path == expectedResult, 'Expected %s, got %s' % (expectedResult, s.path) - httpd.shutdown() - def handle_timeout(): - assert False, 'Timed out while waiting for the browser test to finish' - httpd.shutdown() httpd = BaseHTTPServer.HTTPServer(('localhost', 8888), TestServerHandler) - httpd.timeout = 5; - server_thread = threading.Thread(target=httpd.serve_forever) - server_thread.daemon = True - server_thread.start() - server_thread.join(5.5) + httpd.handle_request() # Finally, do some web browser tests def run_browser(html_file, message, expectedResult = None): @@ -5720,6 +5702,17 @@ f.close() assert os.path.exists('something.html'), output run_browser('something.html', 'You should see animating gears.', '/report_gl_result?true') + # Make sure that OpenGL ES is not available if typed arrays are not used + clear() + output = Popen([EMCC, path_from_root('tests', 'hello_world_gles.c'), '-o', 'something.html', + '-DHAVE_BUILTIN_SINCOS', + '-s', 'USE_TYPED_ARRAYS=0', + '--shell-file', path_from_root('tests', 'hello_world_gles_shell.html')], + stdout=PIPE, stderr=PIPE).communicate() + assert len(output[0]) == 0, output[0] + assert os.path.exists('something.html'), output + run_browser('something.html', 'You should not see animating gears.', '/report_gl_result?false') + 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() diff --git a/tests/stat/output.txt b/tests/stat/output.txt index b5d66fa5..1e6ae74e 100644 --- a/tests/stat/output.txt +++ b/tests/stat/output.txt @@ -2,7 +2,7 @@ ret: 0 errno: 0 st_dev: 1 -st_ino: 8 +st_ino: 2 st_mode: 040777 st_nlink: 1 st_rdev: 0 @@ -24,7 +24,7 @@ S_ISSOCK: 0 ret: 0 errno: 0 st_dev: 1 -st_ino: 9 +st_ino: 3 st_mode: 0100777 st_nlink: 1 st_rdev: 0 @@ -45,11 +45,11 @@ S_ISSOCK: 0 --stat DEVICE-- ret: 0 errno: 0 -st_dev: 11 -st_ino: 11 +st_dev: 5 +st_ino: 5 st_mode: 020777 st_nlink: 1 -st_rdev: 11 +st_rdev: 5 st_size: 0 st_atime: 1200000000 st_mtime: 1200000000 @@ -68,7 +68,7 @@ S_ISSOCK: 0 ret: 0 errno: 0 st_dev: 1 -st_ino: 9 +st_ino: 3 st_mode: 0100777 st_nlink: 1 st_rdev: 0 @@ -90,7 +90,7 @@ S_ISSOCK: 0 ret: 0 errno: 0 st_dev: 1 -st_ino: 10 +st_ino: 4 st_mode: 0120777 st_nlink: 1 st_rdev: 0 @@ -112,7 +112,7 @@ S_ISSOCK: 0 ret: 0 errno: 0 st_dev: 1 -st_ino: 9 +st_ino: 3 st_mode: 0100777 st_nlink: 1 st_rdev: 0 |