aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2013-03-04 12:45:02 -0800
committerAlon Zakai <alonzakai@gmail.com>2013-03-04 12:45:02 -0800
commitcc67e1985f0f13a3fc1b16d079247be2c3d7a88b (patch)
treea87ce3a0c1fa56d96fae7c7d4fa8ce2043d95cba
parent6792da20da77ad24bbce3d1c05b883d25ac0ef4b (diff)
options to save files in csmith driver
-rwxr-xr-xtests/fuzz/csmith_driver.py13
1 files changed, 9 insertions, 4 deletions
diff --git a/tests/fuzz/csmith_driver.py b/tests/fuzz/csmith_driver.py
index 3fa58db6..f79b9180 100755
--- a/tests/fuzz/csmith_driver.py
+++ b/tests/fuzz/csmith_driver.py
@@ -30,13 +30,15 @@ fails = 0
while 1:
print 'Tried %d, notes: %s' % (tried, notes)
- tried += 1
print '1) Generate C'
shared.execute([CSMITH, '--no-volatiles', '--no-math64', '--no-packed-struct'],# +
#['--max-block-depth', '2', '--max-block-size', '2', '--max-expr-complexity', '2', '--max-funcs', '2'],
stdout=open(filename + '.c', 'w'))
+ #shutil.copyfile(filename + '.c', 'testcase%d.c' % tried)
print '1) Generate C... %.2f K of C source' % (len(open(filename + '.c').read())/1024.)
+ tried += 1
+
print '2) Compile natively'
shared.try_delete(filename)
shared.execute([shared.CLANG_CC, '-O2', filename + '.c', '-o', filename + '1'] + CSMITH_CFLAGS, stderr=PIPE) # + shared.EMSDK_OPTS
@@ -46,11 +48,11 @@ while 1:
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)
+ 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), 5)
+ correct2 = shared.timeout_run(Popen([filename + '2'], stdout=PIPE, stderr=PIPE), 3)
if 'Segmentation fault' in correct2 or len(correct2) < 10: raise Exception('segfault')
- correct3 = shared.timeout_run(Popen([filename + '3'], stdout=PIPE, stderr=PIPE), 5)
+ correct3 = shared.timeout_run(Popen([filename + '3'], stdout=PIPE, stderr=PIPE), 3)
if 'Segmentation fault' in correct3 or len(correct3) < 10: raise Exception('segfault')
if correct1 != correct3: raise Exception('clang opts change result')
except Exception, e:
@@ -82,6 +84,9 @@ while 1:
except Exception, e:
print e
normal = False
+ open('testcase%d.js' % tried, 'w').write(
+ open(filename + '.js').read().replace(' var ret = run();', ' var ret = run(["1"]);')
+ )
if not ok:
print "EMSCRIPTEN BUG"
notes['embug'] += 1