summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Gamari <ben@smart-cactus.org>2020-04-20 13:49:55 -0400
committerMarge Bot <ben+marge-bot@smart-cactus.org>2020-04-23 11:40:38 -0400
commit5946c85abcf66555cdbcd3eed02cb8f512b6110c (patch)
tree30bae1e6d7b1bcb37b9a40abb0e9373166f99a72
parent339e8ece1c844af5c9165efbc3a928890c2f75c7 (diff)
downloadhaskell-5946c85abcf66555cdbcd3eed02cb8f512b6110c.tar.gz
testsuite: Don't attempt to read .std{err,out} files if they don't exist
Simon reports that he was previously seeing framework failures due to an attempt to read the non-existing T13456.stderr. While I don't know exactly what this is due to, it does seem like a non-existing .std{out,err} file should be equivalent to an empty file. Teach the testsuite driver to treat it as such.
-rw-r--r--testsuite/driver/testlib.py12
1 files changed, 10 insertions, 2 deletions
diff --git a/testsuite/driver/testlib.py b/testsuite/driver/testlib.py
index 535e31e110..abc01fdf95 100644
--- a/testsuite/driver/testlib.py
+++ b/testsuite/driver/testlib.py
@@ -1787,7 +1787,11 @@ def stdout_ok(name: TestName, way: WayName) -> bool:
expected_stdout_file, actual_stdout_file)
def read_stdout( name: TestName ) -> str:
- return in_testdir(name, 'run.stdout').read_text(encoding='UTF-8')
+ path = in_testdir(name, 'run.stdout')
+ if path.exists():
+ return path.read_text(encoding='UTF-8')
+ else:
+ return ''
def dump_stdout( name: TestName ) -> None:
s = read_stdout(name).strip()
@@ -1805,7 +1809,11 @@ def stderr_ok(name: TestName, way: WayName) -> bool:
whitespace_normaliser=normalise_whitespace)
def read_stderr( name: TestName ) -> str:
- return in_testdir(name, 'run.stderr').read_text(encoding='UTF-8')
+ path = in_testdir(name, 'run.stderr')
+ if path.exists():
+ return path.read_text(encoding='UTF-8')
+ else:
+ return ''
def dump_stderr( name: TestName ) -> None:
s = read_stderr(name).strip()