Skip to content

Commit c16b1bd

Browse files
committed
run-tests.py: fixed bogus cleanup
1 parent 5783afa commit c16b1bd

File tree

1 file changed

+17
-4
lines changed

1 file changed

+17
-4
lines changed

run-tests.py

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ def cleanup(out):
1010
if len(s) > 1 and s[0] == '#':
1111
continue
1212
s = "".join(s.split())
13-
ret = ret + s
14-
return ret
13+
ret = ret + '\n' + s
14+
return ret.strip()
1515

1616
commands = []
1717

@@ -93,12 +93,14 @@ def cleanup(out):
9393
clang_cmd.extend(cmd.split(' '))
9494
p = subprocess.Popen(clang_cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
9595
comm = p.communicate()
96+
clang_ec = p.returncode
9697
clang_output = cleanup(comm[0])
9798

9899
gcc_cmd = ['gcc']
99100
gcc_cmd.extend(cmd.split(' '))
100101
p = subprocess.Popen(gcc_cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
101102
comm = p.communicate()
103+
gcc_ec = p.returncode
102104
gcc_output = cleanup(comm[0])
103105

104106
simplecpp_cmd = ['./simplecpp']
@@ -110,13 +112,24 @@ def cleanup(out):
110112
simplecpp_output = cleanup(comm[0])
111113
simplecpp_err = comm[0].decode('utf-8').strip()
112114

113-
if simplecpp_output != clang_output and simplecpp_output != gcc_output:
115+
clang_fail = simplecpp_output != clang_output
116+
gcc_fail = simplecpp_output != gcc_output
117+
if clang_fail and gcc_fail:
114118
filename = cmd[cmd.rfind('/')+1:]
115119
if filename in todo:
116120
print('TODO ' + cmd)
117121
usedTodos.append(filename)
118122
else:
119-
print('FAILED ' + cmd)
123+
if clang_fail:
124+
print('FAILED (clang: {}) {}'.format(clang_ec, cmd))
125+
print('expected:')
126+
print(clang_output)
127+
if gcc_fail:
128+
print('FAILED (gcc: {}) {}'.format(gcc_ec, cmd))
129+
print('expected:')
130+
print(gcc_output)
131+
print('actual:')
132+
print(simplecpp_output)
120133
if simplecpp_ec:
121134
print('simplecpp failed - ' + simplecpp_err)
122135
numberOfFailed = numberOfFailed + 1

0 commit comments

Comments
 (0)