diff options
author | JF Bastien <jfb@chromium.org> | 2016-01-10 10:49:59 -0800 |
---|---|---|
committer | JF Bastien <jfb@chromium.org> | 2016-01-10 17:40:15 -0800 |
commit | e3c38c14e7dd9c115da960daafd109d2687f1a08 (patch) | |
tree | c8e892eed8ad9dc0a5e071b9e8af775733dedc03 /check.py | |
parent | 75a562190a9f4588c8ffb19b8304f76c15a850c6 (diff) | |
download | binaryen-e3c38c14e7dd9c115da960daafd109d2687f1a08.tar.gz binaryen-e3c38c14e7dd9c115da960daafd109d2687f1a08.tar.bz2 binaryen-e3c38c14e7dd9c115da960daafd109d2687f1a08.zip |
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.
Diffstat (limited to 'check.py')
-rwxr-xr-x | check.py | 11 |
1 files changed, 9 insertions, 2 deletions
@@ -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: |