aboutsummaryrefslogtreecommitdiff
path: root/tests/test_sanity.py
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2014-02-24 12:36:55 -0800
committerAlon Zakai <alonzakai@gmail.com>2014-02-24 12:36:55 -0800
commitae764ac73f78fe23813cc1f07bc7b3d7fed65e8b (patch)
tree29858c553799e4893c9e59374f3b58468c6c4f83 /tests/test_sanity.py
parentfb9deefc5ac7caaa1b5d2c680a86d9b35238e004 (diff)
deprecate jcache
Diffstat (limited to 'tests/test_sanity.py')
-rw-r--r--tests/test_sanity.py84
1 files changed, 0 insertions, 84 deletions
diff --git a/tests/test_sanity.py b/tests/test_sanity.py
index 54a0e99d..5713c99c 100644
--- a/tests/test_sanity.py
+++ b/tests/test_sanity.py
@@ -482,90 +482,6 @@ fi
finally:
del os.environ['EMCC_FAST_COMPILER']
- def test_jcache(self):
- PRE_LOAD_MSG = 'loading pre from jcache'
- PRE_SAVE_MSG = 'saving pre to jcache'
- FUNC_CHUNKS_LOAD_MSG = ' funcchunks from jcache'
- FUNC_CHUNKS_SAVE_MSG = ' funcchunks to jcache'
- JSFUNC_CHUNKS_LOAD_MSG = 'jsfuncchunks from jcache'
- JSFUNC_CHUNKS_SAVE_MSG = 'jsfuncchunks to jcache'
-
- restore()
- Cache.erase()
-
- try:
- os.environ['EMCC_DEBUG'] = '1'
- os.environ['EMCC_JSOPT_MIN_CHUNK_SIZE'] = str(1024*512)
-
- self.working_dir = os.path.join(TEMP_DIR, 'emscripten_temp')
- if not os.path.exists(self.working_dir): os.makedirs(self.working_dir)
-
- assert not os.path.exists(JCache.get_cachename('emscript_files'))
-
- srcs = {}
- used_jcache = False
-
- for args, input_file, expect_pre_save, expect_pre_load, expect_funcs_save, expect_funcs_load, expect_jsfuncs_save, expect_jsfuncs_load, expected in [
- ([], 'hello_world_loop.cpp', False, False, False, False, False, False, []),
- (['--jcache'], 'hello_world_loop.cpp', True, False, True, False, True, False, []),
- (['--jcache'], 'hello_world_loop.cpp', False, True, False, True, False, True, []),
- ([], 'hello_world_loop.cpp', False, False, False, False, False, False, []),
- # new
- ([], 'hello_world.cpp', False, False, False, False, False, False, []),
- (['--jcache'], 'hello_world.cpp', True, False, True, False, True, False, []),
- (['--jcache'], 'hello_world.cpp', False, True, False, True, False, True, []),
- ([], 'hello_world.cpp', False, False, False, False, False, False, []),
- # go back to old file, experience caching
- (['--jcache'], 'hello_world_loop.cpp', False, True, False, True, False, True, []),
- # new, large file
- ([], 'hello_malloc.cpp', False, False, False, False, False, False, []),
- (['--jcache'], 'hello_malloc.cpp', True, False, True, False, True, False, []),
- (['--jcache'], 'hello_malloc.cpp', False, True, False, True, False, True, []),
- ([], 'hello_malloc.cpp', False, False, False, False, False, False, []),
- # new, huge file
- ([], 'hello_libcxx.cpp', False, False, False, False, False, False, ('4 chunks',)),
- (['--jcache'], 'hello_libcxx.cpp', True, False, True, False, True, False, []),
- (['--jcache'], 'hello_libcxx.cpp', False, True, False, True, False, True, []),
- ([], 'hello_libcxx.cpp', False, False, False, False, False, False, []),
- # finally, build a file close to the previous, to see that some chunks are found in the cache and some not
- (['--jcache'], 'hello_libcxx_mod1.cpp', False, True, True, True, True, True, []), # win on pre, mix on funcs, mix on jsfuncs
- (['--jcache'], 'hello_libcxx_mod1.cpp', False, True, False, True, False, True, []),
- (None, None, None, None, None, None, None, None, None), # clear
- (['--jcache'], 'hello_libcxx_mod2.cpp', True, False, True, False, True, False, []), # load into cache
- (['--jcache'], 'hello_libcxx_mod2a.cpp', False, True, True, True, True, True, []) # add a printf, do not lose everything
- ]:
- self.clear()
- if args is None:
- Cache.erase()
- continue
-
- print >> sys.stderr, args, input_file, expect_pre_save, expect_pre_load, expect_funcs_save, expect_funcs_load, expect_jsfuncs_save, expect_jsfuncs_load, expected
-
- out, err = Popen([PYTHON, EMCC, '-O2', '-g', path_from_root('tests', input_file)] + args, stdout=PIPE, stderr=PIPE).communicate()
- errtail = err.split('emcc invocation')[-1]
- self.assertContained('hello, world!', run_js('a.out.js'), errtail)
- assert (PRE_SAVE_MSG in err) == expect_pre_save, errtail
- assert (PRE_LOAD_MSG in err) == expect_pre_load, errtail
- assert (FUNC_CHUNKS_SAVE_MSG in err) == expect_funcs_save, errtail
- assert (FUNC_CHUNKS_LOAD_MSG in err) == expect_funcs_load, errtail
- assert (JSFUNC_CHUNKS_SAVE_MSG in err) == expect_jsfuncs_save, errtail
- assert (JSFUNC_CHUNKS_LOAD_MSG in err) == expect_jsfuncs_load, errtail
- for expect in expected: assert expect in err, expect + ' ? ' + errtail
- curr = open('a.out.js').read()
- if input_file not in srcs:
- srcs[input_file] = curr
- else:
- #open('/home/alon/Dev/emscripten/a', 'w').write(srcs[input_file])
- #open('/home/alon/Dev/emscripten/b', 'w').write(curr)
- assert abs(len(curr)/float(len(srcs[input_file]))-1)<0.01, 'contents may shift in order, but must remain the same size %d vs %d' % (len(curr), len(srcs[input_file])) + '\n' + errtail
- used_jcache = used_jcache or ('--jcache' in args)
- assert used_jcache == os.path.exists(JCache.get_cachename('emscript_files'))
- #print >> sys.stderr, errtail
-
- finally:
- del os.environ['EMCC_DEBUG']
- del os.environ['EMCC_JSOPT_MIN_CHUNK_SIZE']
-
def test_nostdincxx(self):
restore()
Cache.erase()