versioner: merge stdout and stderr in the test runner.

Some of the error messages emitted by versioner (the ones where it was
invoked incorrectly) go to stderr, which meant that the test runner
ignored them. Merge stdout and stderr, and switch from testing for
exact equality to endswith, because of the compilation errors test.

Change-Id: I0e2c25bcc9dea4c12ea82a6a05b29e561a61a902
This commit is contained in:
Josh Gao 2016-06-02 15:59:44 -07:00
parent 80d909bbfb
commit 658dbd920d

6
tools/versioner/run_tests.py Normal file → Executable file
View file

@ -20,13 +20,13 @@ def indent(text, spaces=4):
def run_test(test_name, path):
os.chdir(path)
process = subprocess.Popen(
["/bin/sh", "run.sh"], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
(output, error) = process.communicate()
["/bin/sh", "run.sh"], stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
(output, _) = process.communicate()
if os.path.exists("expected_fail"):
with open("expected_fail") as f:
expected_output = f.read()
if output != expected_output:
if not output.endswith(expected_output):
print("{} {}: expected output mismatch".format(
prefix_fail, test_name))
print("")