summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Gamari <ben@smart-cactus.org>2020-01-28 10:17:46 -0500
committerBen Gamari <ben@smart-cactus.org>2020-02-14 10:16:59 -0500
commitfe02f78172f06fd3e83ba00246d9ed741474e653 (patch)
tree1d90362400550550956f4d2e81e4f74898aa3bfd
parent3fe8444f7e3904be14956f3fe68583da8b730ab4 (diff)
downloadhaskell-fe02f78172f06fd3e83ba00246d9ed741474e653.tar.gz
testsuite: Assert the opsys names are known
Previously opsys would take any string. This meant it was very easy for a typo to silently render the predicate ineffective. Fix this by checking the given operating system name against a list of known values.
-rw-r--r--testsuite/driver/testlib.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/testsuite/driver/testlib.py b/testsuite/driver/testlib.py
index 965350f56b..6267219d14 100644
--- a/testsuite/driver/testlib.py
+++ b/testsuite/driver/testlib.py
@@ -501,7 +501,18 @@ def fast() -> bool:
def platform( plat: str ) -> bool:
return config.platform == plat
+KNOWN_OPERATING_SYSTEMS = set([
+ 'mingw32',
+ 'freebsd',
+ 'openbsd',
+ 'aix',
+ 'linux',
+ 'darwin',
+ 'solaris2',
+])
+
def opsys( os: str ) -> bool:
+ assert os in KNOWN_OPERATING_SYSTEMS
return config.os == os
def arch( arch: str ) -> bool: