diff options
Diffstat (limited to 'tests/test_core.py')
-rw-r--r-- | tests/test_core.py | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/tests/test_core.py b/tests/test_core.py index 600e2da8..6a920a7b 100644 --- a/tests/test_core.py +++ b/tests/test_core.py @@ -4934,6 +4934,8 @@ def process(filename): print "disabling inlining" # without registerize (which -g disables), we generate huge amounts of code Settings.INLINING_LIMIT = 50 + #Settings.OUTLINING_LIMIT = 60000 + self.do_run(r''' #define SQLITE_DISABLE_LFS #define LONGDOUBLE_TYPE double @@ -5285,7 +5287,7 @@ def process(filename): #if os.path.basename(name) != '4.c': continue if 'newfail' in name: continue if os.environ.get('EMCC_FAST_COMPILER') == '0' and os.path.basename(name) in [ - '18.cpp', '15.c' + '18.cpp', '15.c', '21.c' ]: continue # works only in fastcomp if x == 'lto' and self.run_name == 'default' and os.path.basename(name) in [ '19.c' @@ -6528,6 +6530,28 @@ def process(filename): if self.emcc_args is None: return self.skip('needs emcc') self.do_run_from_file(path_from_root('tests', 'test_locale.c'), path_from_root('tests', 'test_locale.out')) + def test_64bit_return_value(self): + # This test checks that the most significant 32 bits of a 64 bit long are correctly made available + # to native JavaScript applications that wish to interact with compiled code returning 64 bit longs. + # The MS 32 bits should be available in Runtime.getTempRet0() even when compiled with -O2 --closure 1 + # Run with ./runner.py test_64bit_return_value + + # Compile test.c and wrap it in a native JavaScript binding so we can call our compiled function from JS. + Popen([PYTHON, EMCC, path_from_root('tests', 'return64bit', 'test.c'), '--pre-js', path_from_root('tests', 'return64bit', 'testbindstart.js'), '--pre-js', path_from_root('tests', 'return64bit', 'testbind.js'), '--post-js', path_from_root('tests', 'return64bit', 'testbindend.js'), '-s', 'EXPORTED_FUNCTIONS=["_test"]', '-o', 'test.js', '-O2', '--closure', '1'], stdout=PIPE, stderr=PIPE).communicate() + + # Simple test program to load the test.js binding library and call the binding to the + # C function returning the 64 bit long. + open(os.path.join(self.get_dir(), 'testrun.js'), 'w').write(''' + var test = require("./test.js"); + test.runtest(); + ''') + + # Run the test and confirm the output is as expected. + if NODE_JS in JS_ENGINES: + out = run_js('testrun.js', engine=NODE_JS, full_output=True) + assert "low = 5678" in out + assert "high = 1234" in out + # Generate tests for everything def make_run(fullname, name=-1, compiler=-1, embetter=0, quantum_size=0, typed_arrays=0, emcc_args=None, env=None): |