From e3c38c14e7dd9c115da960daafd109d2687f1a08 Mon Sep 17 00:00:00 2001 From: JF Bastien Date: Sun, 10 Jan 2016 10:49:59 -0800 Subject: Add Travis builds with sanitizers This triggers 5 independent build / test runs: - clang, no sanitizer; - clang, UB sanitizer; - clang, address sanitizer (disabled for now); - clang, thread sanitizer (disabled for now); - GCC. Enabling UBSan led to these changes: - Fix a bunch of undefined behavior throughout the code base. - Fix some tests that relied on that undefined behavior. - Make some of the tests easier to debug by printing their command line. - Add ubsan blacklist to work around libstdc++ bug. - Example testcase also needs sanitizer because libsupport.a uses it. --- check.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'check.py') diff --git a/check.py b/check.py index ed43458ef..f3d8b02e0 100755 --- a/check.py +++ b/check.py @@ -144,7 +144,9 @@ for t in tests: if t.endswith('.wast') and not t.startswith('spec'): print '..', t t = os.path.join('test', t) - actual, err = subprocess.Popen([os.path.join('bin', 'binaryen-shell'), t, '-print-before'], stdout=subprocess.PIPE, stderr=subprocess.PIPE).communicate() + cmd = [os.path.join('bin', 'binaryen-shell'), t, '-print-before'] + print ' ', ' '.join(cmd) + actual, err = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE).communicate() assert err.replace('printing before:', '').strip() == '', 'bad err:' + err actual = actual.replace('printing before:\n', '') @@ -271,7 +273,12 @@ if unexpected_result_count: print '\n[ checking example testcases... ]\n' -subprocess.check_call([os.environ.get('CXX') or 'g++', '-std=c++11', os.path.join('test', 'example', 'find_div0s.cpp'), '-Isrc', '-g', '-lsupport', '-Llib/.']) +cmd = [os.environ.get('CXX') or 'g++', '-std=c++11', os.path.join('test', 'example', 'find_div0s.cpp'), '-Isrc', '-g', '-lsupport', '-Llib/.'] +if os.environ.get('COMPILER_FLAGS'): + for f in os.environ.get('COMPILER_FLAGS').split(' '): + cmd.append(f) +print ' '.join(cmd) +subprocess.check_call(cmd) actual = subprocess.Popen(['./a.out'], stdout=subprocess.PIPE).communicate()[0] expected = open(os.path.join('test', 'example', 'find_div0s.txt')).read() if actual != expected: -- cgit v1.2.3