Chromium Code Reviews| Index: tools/testing/drt-trampoline.py |
| diff --git a/tools/testing/drt-trampoline.py b/tools/testing/drt-trampoline.py |
| index 2c7b033e009e2aa0cc64013d483043f6fabd0b90..89363a565373d05ad09c06b5f74a3e82b21cf3cc 100644 |
| --- a/tools/testing/drt-trampoline.py |
| +++ b/tools/testing/drt-trampoline.py |
| @@ -49,19 +49,19 @@ def main(argv): |
| p = subprocess.Popen(cmd, env=env, stdout=subprocess.PIPE) |
| - p.wait() |
|
Siggi Cherem (dart-lang)
2012/06/28 21:23:57
I believe the issue is related to pipeing output a
Emily Fortuna
2012/06/28 21:44:39
I think you're right. I seem to remember reading i
|
| + output, error = p.communicate() |
| if p.returncode != 0: |
| raise Exception('Failed to run command. return code=%s' % p.returncode) |
| if out_expected_file: |
| # Compare output to the given expectation file. |
| - output = None |
| expectation = None |
| - with p.stdout as res: |
| - if is_png: |
| - # DRT prints the image to STDOUT, but includes 5 header lines. |
| - for i in range(4): res.readline() |
| - output = res.read() |
| + if is_png: |
| + # DRT prints the image to STDOUT, but includes extra text that we trim: |
| + # - 5 header lines |
| + # - a '#EOF\n' at the end |
| + output = output.replace('\n', '_', 3) |
| + output = output[output.find('\n') + 1: -5] |
|
Emily Fortuna
2012/06/28 21:44:39
Perhaps I'm misunderstanding how this code works,
Siggi Cherem (dart-lang)
2012/06/28 21:55:06
Done. Turns out that it was 4 header lines, not 5.
|
| if os.path.exists(out_expected_file): |
| with open(out_expected_file, 'r') as f: |
| expectation = f.read() |
| @@ -87,7 +87,7 @@ def main(argv): |
| print '#EOF' |
| else: |
| # Pipe through the output for non-layout tests. |
| - sys.stdout.write(p.stdout.read()) |
| + print output |
| if __name__ == '__main__': |
| try: |