Skip to content

Commit aa8cd95

Browse files
committed
improve test traversal tool
1 parent ca8d5a6 commit aa8cd95

File tree

2 files changed

+50
-33
lines changed

2 files changed

+50
-33
lines changed

tests/traverse.py

-33
This file was deleted.

tools/traverse.py

+50
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
#!/usr/bin/env python2
2+
3+
'''
4+
simple tool to run emcc and clang on C testcases each in a separate subdir of the current dir
5+
'''
6+
7+
import os, sys
8+
9+
__rootpath__ = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
10+
def path_from_root(*pathelems):
11+
return os.path.join(__rootpath__, *pathelems)
12+
sys.path += [path_from_root('')]
13+
import tools.shared
14+
from tools.shared import *
15+
16+
curr = os.getcwd()
17+
18+
for d in os.listdir(curr):
19+
print '(' + d + ') ',
20+
os.chdir(curr)
21+
if os.path.isdir(d):
22+
os.chdir(d)
23+
for c in os.listdir('.'):
24+
if c.endswith('.c'):
25+
execute([EMCC, c, '-O2', '--embed-file', 'input.txt'])
26+
js = jsrun.run_js('a.out.js', filter(lambda x: x != '-w', SPIDERMONKEY_ENGINE), stdout=PIPE)
27+
28+
execute([CLANG_CC, '-m32', c])
29+
n1 = execute(['./a.out'], stdout=PIPE)[0]
30+
31+
execute([CLANG_CC, '-m32', c, '-O2'])
32+
n2 = execute(['./a.out'], stdout=PIPE)[0]
33+
34+
execute(['gcc', c, '-m32'])
35+
n3 = execute(['./a.out'], stdout=PIPE)[0]
36+
37+
if js == n1:
38+
print 'ok'
39+
elif js == n2:
40+
print 'emcc and clang -O2 both equally wrong'
41+
elif js == n3:
42+
print 'emcc agrees with gcc, so probably ok'
43+
else:
44+
print
45+
print 'js ', js,
46+
print 'c0 ', n1,
47+
print 'c2 ', n2,
48+
print 'g ', n3,
49+
print 'fail!!!', d
50+

0 commit comments

Comments
 (0)