From 6df14753bed2cb2410c5e6432564cb66943aa848 Mon Sep 17 00:00:00 2001 From: Alon Zakai Date: Tue, 16 Dec 2014 16:22:08 -0800 Subject: [PATCH] make other.test_emterpretify more tolerant of native optimizer variability --- tests/test_other.py | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/tests/test_other.py b/tests/test_other.py index a13de53a475f8..a570324162cc7 100644 --- a/tests/test_other.py +++ b/tests/test_other.py @@ -4391,10 +4391,19 @@ def do_log_test(source, expected, func): assert func in pre, pre post = post.split('\n')[0] seen = int(post) - assert expected == seen, ['expect', expected, 'but see', seen] + assert expected == seen or seen in expected, ['expect', expected, 'but see', seen] do_log_test(path_from_root('tests', 'primes.cpp'), 86, 'main') - do_log_test(path_from_root('tests', 'fannkuch.cpp'), 234, 'fannkuch_worker') + do_log_test(path_from_root('tests', 'fannkuch.cpp'), range(234, 239), 'fannkuch_worker') + + # test non-native as well, registerizeHarder can be a little more efficient here + old_native = os.environ.get('EMCC_NATIVE_OPTIMIZER') + try: + os.environ['EMCC_NATIVE_OPTIMIZER'] = '0' + do_log_test(path_from_root('tests', 'fannkuch.cpp'), 234, 'fannkuch_worker') + finally: + if old_native: os.environ['EMCC_NATIVE_OPTIMIZER'] = old_native + else: del os.environ['EMCC_NATIVE_OPTIMIZER'] def test_emterpreter_swap_orig(self): Popen([PYTHON, EMCC, path_from_root('tests', 'fasta.cpp'), '-s', 'EMTERPRETIFY=1', '-s', 'SWAPPABLE_ASM_MODULE=1', '-O2']).communicate()