diff options
author | Alon Zakai <alonzakai@gmail.com> | 2013-03-02 00:43:28 -0500 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2013-03-02 00:43:28 -0500 |
commit | ab74dbd46dad7a726a817f97d9c4a548e657f168 (patch) | |
tree | 7018b2f8fae2211b59427c5de62c3e501acff220 | |
parent | 276325e440f554751afa96f581c180f96474b435 (diff) |
fuzz both a native and a native-through-llvm build, in hopes of avoiding bugs in both
-rwxr-xr-x | tests/fuzz/csmith_driver.py | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/tests/fuzz/csmith_driver.py b/tests/fuzz/csmith_driver.py index a61dcc92..404324a2 100755 --- a/tests/fuzz/csmith_driver.py +++ b/tests/fuzz/csmith_driver.py @@ -36,16 +36,16 @@ while 1: print '2) Compile natively' shared.try_delete(filename) - #shared.execute([shared.CLANG_CC, '-O2', filename + '.c', '-o', filename] + CSMITH_CFLAGS, stderr=PIPE) # + shared.EMSDK_OPTS + shared.execute([shared.CLANG_CC, '-O2', filename + '.c', '-o', filename + '1'] + CSMITH_CFLAGS, stderr=PIPE) # + shared.EMSDK_OPTS shared.execute([shared.CLANG_CC, '-O2', '-emit-llvm', '-c', '-Xclang', '-triple=i386-pc-linux-gnu', filename + '.c', '-o', filename + '.bc'] + CSMITH_CFLAGS + shared.EMSDK_OPTS, stderr=PIPE) shared.execute([shared.path_from_root('tools', 'nativize_llvm.py'), filename + '.bc'], stdout=PIPE, stderr=PIPE) - shutil.move(filename + '.bc.run', filename) - - assert os.path.exists(filename) + shutil.move(filename + '.bc.run', filename + '2') print '3) Run natively' try: - correct = shared.timeout_run(Popen([filename], stdout=PIPE, stderr=PIPE), 3) - if 'Segmentation fault' in correct or len(correct) < 10: raise Exception('segfault') + correct1 = shared.timeout_run(Popen([filename + '1'], stdout=PIPE, stderr=PIPE), 3) + if 'Segmentation fault' in correct1 or len(correct1) < 10: raise Exception('segfault') + correct2 = shared.timeout_run(Popen([filename + '2'], stdout=PIPE, stderr=PIPE), 3) + if 'Segmentation fault' in correct2 or len(correct2) < 10: raise Exception('segfault') except Exception, e: print 'Failed or infinite looping in native, skipping', e notes['invalid'] += 1 @@ -60,7 +60,7 @@ while 1: assert os.path.exists(filename + '.js') print '(run)' js = shared.run_js(filename + '.js', stderr=PIPE, engine=engine1, check_timeout=True) - assert correct == js, ''.join([a.rstrip()+'\n' for a in difflib.unified_diff(correct.split('\n'), js.split('\n'), fromfile='expected', tofile='actual')]) + assert correct1 == js or correct2 == js, ''.join([a.rstrip()+'\n' for a in difflib.unified_diff(correct1.split('\n'), js.split('\n'), fromfile='expected', tofile='actual')]) # Try normally, then try unaligned because csmith does generate nonportable code that requires x86 alignment ok = False @@ -103,6 +103,6 @@ while 1: assert 'warning: Successfully compiled asm.js code' in js2, 'must validate' js2 = js2.replace('\nwarning: Successfully compiled asm.js code\n', '') - assert js2 == correct, ''.join([a.rstrip()+'\n' for a in difflib.unified_diff(correct.split('\n'), js2.split('\n'), fromfile='expected', tofile='actual')]) + 'ODIN FAIL' + assert js2 == correct1 or js2 == correct2, ''.join([a.rstrip()+'\n' for a in difflib.unified_diff(correct1.split('\n'), js2.split('\n'), fromfile='expected', tofile='actual')]) + 'ODIN FAIL' print 'odin ok' |