aboutsummaryrefslogtreecommitdiff
path: root/tests/fuzz
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2013-03-02 19:56:47 -0800
committerAlon Zakai <alonzakai@gmail.com>2013-03-02 19:56:47 -0800
commitdc5fcfb4de85cb73062008e1ad76c9e7dd0b0efe (patch)
tree65473a760e3504d239747fb4b03c8ad61f67fd52 /tests/fuzz
parent92499c33f51a020663f48b02ffdcb5c0721f3020 (diff)
check in fuzzer if clang differs from clang -O2
Diffstat (limited to 'tests/fuzz')
-rwxr-xr-xtests/fuzz/csmith_driver.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/tests/fuzz/csmith_driver.py b/tests/fuzz/csmith_driver.py
index a00a5344..75ad6e00 100755
--- a/tests/fuzz/csmith_driver.py
+++ b/tests/fuzz/csmith_driver.py
@@ -41,12 +41,16 @@ while 1:
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 + '2')
+ shared.execute([shared.CLANG_CC, filename + '.c', '-o', filename + '3'] + CSMITH_CFLAGS, stderr=PIPE)
print '3) Run natively'
try:
correct1 = shared.timeout_run(Popen([filename + '1'], stdout=PIPE, stderr=PIPE), 5)
if 'Segmentation fault' in correct1 or len(correct1) < 10: raise Exception('segfault')
correct2 = shared.timeout_run(Popen([filename + '2'], stdout=PIPE, stderr=PIPE), 5)
if 'Segmentation fault' in correct2 or len(correct2) < 10: raise Exception('segfault')
+ correct3 = shared.timeout_run(Popen([filename + '3'], stdout=PIPE, stderr=PIPE), 5)
+ if 'Segmentation fault' in correct3 or len(correct3) < 10: raise Exception('segfault')
+ if correct1 != correct3: raise Exception('clang opts change result')
except Exception, e:
print 'Failed or infinite looping in native, skipping', e
notes['invalid'] += 1