aboutsummaryrefslogtreecommitdiff
path: root/tests/fuzz
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2013-03-02 00:05:43 -0500
committerAlon Zakai <alonzakai@gmail.com>2013-03-02 00:05:43 -0500
commit591b5480c7cc59e86e485d94365393557af8240b (patch)
tree6d49e430f20941dc610bd0585ace67c179f234f5 /tests/fuzz
parent46f3b8aa348a586a01fca22511d91c6aa5407965 (diff)
fuzz through bytecode, so the native build is 32-bit even on 64-bit systems, like the js build
Diffstat (limited to 'tests/fuzz')
-rwxr-xr-xtests/fuzz/csmith_driver.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/tests/fuzz/csmith_driver.py b/tests/fuzz/csmith_driver.py
index bba3c491..ea50e7dd 100755
--- a/tests/fuzz/csmith_driver.py
+++ b/tests/fuzz/csmith_driver.py
@@ -4,7 +4,7 @@
Runs csmith, a C fuzzer, and looks for bugs
'''
-import os, sys, difflib
+import os, sys, difflib, shutil
from subprocess import Popen, PIPE, STDOUT
sys.path += [os.path.join(os.path.dirname(os.path.dirname(os.path.dirname(__file__))), 'tools')]
@@ -36,7 +36,11 @@ 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] + 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)
print '3) Run natively'
try: