aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2014-04-08 20:18:19 -0700
committerAlon Zakai <alonzakai@gmail.com>2014-04-08 20:18:19 -0700
commit4d0decb3b774d61f7f1bba7e74547d2c2d36fbfb (patch)
tree6a5e48c2d84638fd6b422783942974b19a474dd8
parentc0fdf61aafb9914f9415f3ce85fa9c1d9b16f115 (diff)
testcase traverse tool
-rwxr-xr-xtests/traverse.py33
1 files changed, 33 insertions, 0 deletions
diff --git a/tests/traverse.py b/tests/traverse.py
new file mode 100755
index 00000000..37809375
--- /dev/null
+++ b/tests/traverse.py
@@ -0,0 +1,33 @@
+#!/usr/bin/env python2
+
+'''
+simple tool to run emcc and clang on testcases each in a separate subdir, as in the case of output from Moh's fuzzer
+'''
+
+import os, sys
+
+__rootpath__ = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
+def path_from_root(*pathelems):
+ return os.path.join(__rootpath__, *pathelems)
+sys.path += [path_from_root('')]
+import tools.shared
+from tools.shared import *
+
+curr = os.getcwd()
+
+for d in os.listdir(curr):
+ #print d
+ os.chdir(curr)
+ if os.path.isdir(d):
+ os.chdir(d)
+ for c in os.listdir('.'):
+ if c.endswith('.c'):
+ execute([CLANG_CC, c])
+ out1 = execute(['./a.out'], stdout=PIPE)[0]
+ execute([EMCC, c, '-O2', '--embed-file', 'input.txt'])
+ out2 = jsrun.run_js('a.out.js', filter(lambda x: x != '-w', SPIDERMONKEY_ENGINE), stdout=PIPE)
+ if out1 != out2:
+ print ' ', out1,
+ print ' ', out2,
+ print 'fail', d
+