summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Gamari <ben@smart-cactus.org>2020-04-20 13:49:55 -0400
committerMoritz Angermann <moritz.angermann@gmail.com>2021-03-07 22:19:23 +0800
commitbe15c8cc6c0c9af4fa03c2c6751a5303016b1522 (patch)
treef38ef5c0f0263fc764d3bcde528b30d6e3241791
parentf7062e1b0c91e8aa78e245a3dab9571206fce16d (diff)
downloadhaskell-be15c8cc6c0c9af4fa03c2c6751a5303016b1522.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 3412ad7994..c4d122ee3b 100644
--- a/testsuite/driver/testlib.py
+++ b/testsuite/driver/testlib.py
@@ -1771,7 +1771,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:
str = read_stdout(name).strip()
@@ -1789,7 +1793,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:
str = read_stderr(name).strip()