|
6 | 6 |
|
7 | 7 | def cleanup(out): |
8 | 8 | ret = '' |
9 | | - for s in out.decode('utf-8').split('\n'): |
| 9 | + for s in out.decode('utf-8').splitlines(): |
10 | 10 | if len(s) > 1 and s[0] == '#': |
11 | 11 | continue |
12 | 12 | s = "".join(s.split()) |
@@ -93,30 +93,45 @@ def cleanup(out): |
93 | 93 | clang_cmd.extend(cmd.split(' ')) |
94 | 94 | p = subprocess.Popen(clang_cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE) |
95 | 95 | comm = p.communicate() |
96 | | - clang_output = cleanup(comm[0]) |
| 96 | + clang_output = comm[0] |
| 97 | + clang_output_c = cleanup(comm[0]) |
97 | 98 |
|
98 | 99 | gcc_cmd = ['gcc'] |
99 | 100 | gcc_cmd.extend(cmd.split(' ')) |
100 | 101 | p = subprocess.Popen(gcc_cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE) |
101 | 102 | comm = p.communicate() |
102 | | - gcc_output = cleanup(comm[0]) |
| 103 | + gcc_output = comm[0] |
| 104 | + gcc_output_c = cleanup(comm[0]) |
103 | 105 |
|
104 | 106 | simplecpp_cmd = ['./simplecpp'] |
105 | 107 | # -E is not supported and we bail out on unknown options |
106 | 108 | simplecpp_cmd.extend(cmd.replace('-E ', '', 1).split(' ')) |
107 | 109 | p = subprocess.Popen(simplecpp_cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE) |
108 | 110 | comm = p.communicate() |
109 | 111 | simplecpp_ec = p.returncode |
110 | | - simplecpp_output = cleanup(comm[0]) |
| 112 | + simplecpp_output = comm[0] |
| 113 | + simplecpp_output_c = cleanup(comm[0]) |
111 | 114 | simplecpp_err = comm[0].decode('utf-8').strip() |
112 | 115 |
|
113 | | - if simplecpp_output != clang_output and simplecpp_output != gcc_output: |
| 116 | + if simplecpp_output_c != clang_output_c and simplecpp_output_c != gcc_output_c: |
114 | 117 | filename = cmd[cmd.rfind('/')+1:] |
115 | 118 | if filename in todo: |
116 | 119 | print('TODO ' + cmd) |
117 | 120 | usedTodos.append(filename) |
118 | 121 | else: |
119 | 122 | print('FAILED ' + cmd) |
| 123 | + print('---expected (clang):') |
| 124 | + print(clang_output_c) |
| 125 | + print('---expected (gcc):') |
| 126 | + print(gcc_output_c) |
| 127 | + print('---actual:') |
| 128 | + print(simplecpp_output_c) |
| 129 | + print('---actual:') |
| 130 | + print(simplecpp_output) |
| 131 | + print('---original (clang):') |
| 132 | + print(clang_output) |
| 133 | + print('---original (gcc):') |
| 134 | + print(gcc_output) |
120 | 135 | if simplecpp_ec: |
121 | 136 | print('simplecpp failed - ' + simplecpp_err) |
122 | 137 | numberOfFailed = numberOfFailed + 1 |
|
0 commit comments