testsuite: Normalise away spurious differences in out-of-scope instances
authorBen Gamari <ben@smart-cactus.org>
Wed, 12 Dec 2018 21:45:55 +0000 (16:45 -0500)
committerBen Gamari <ben@smart-cactus.org>
Thu, 13 Dec 2018 04:26:34 +0000 (23:26 -0500)
This fixes a variety of testsuite failures with integer-simple of the form

```
--- typecheck/should_fail/tcfail072.run/tcfail072.stderr.normalised
+++ typecheck/should_fail/tcfail072.run/tcfail072.comp.stderr.normalised
@@ -12,7 +12,7 @@
           -- Defined in ‘integer-<IMPL>-<VERSION>:GHC.Integer.Type’
         instance Ord () -- Defined in ‘GHC.Classes’
         ...plus 21 others
-        ...plus three instances involving out-of-scope types
+        ...plus two instances involving out-of-scope types
         (use -fprint-potential-instances to see them all)
      In the expression: g A
       In an equation for ‘g’: g (B _ _) = g A
```

In service of fixing #16043.

testsuite/driver/testlib.py
testsuite/tests/arrows/should_compile/all.T
testsuite/tests/determinism/determ021/all.T
testsuite/tests/partial-sigs/should_fail/all.T
testsuite/tests/typecheck/should_fail/all.T

index dca6ed1..e5de8e5 100644 (file)
@@ -1739,9 +1739,15 @@ def normalise_errmsg( str ):
     # collisions, so we need to normalise that to just "ghc"
     str = re.sub('ghc-stage[123]', 'ghc', str)
 
-    # Error messages simetimes contain integer implementation package
+    # Error messages sometimes contain integer implementation package
     str = re.sub('integer-(gmp|simple)-[0-9.]+', 'integer-<IMPL>-<VERSION>', str)
 
+    # Error messages sometimes contain this blurb which can vary
+    # spuriously depending upon build configuration (e.g. based on integer
+    # backend)
+    str = re.sub('...plus [a-z]+ instances involving out-of-scope types',
+                 '...plus N instances involving out-of-scope types', str)
+
     # Also filter out bullet characters.  This is because bullets are used to
     # separate error sections, and tests shouldn't be sensitive to how the
     # the division happens.
index ace8af5..279dd10 100644 (file)
@@ -14,5 +14,5 @@ test('arrowpat', normal, compile, [''])
 test('T3964', normal, compile, [''])
 test('T5283', normal, compile, [''])
 test('T5267', expect_broken(5267), compile, [''])
-test('T5022', normal, compile, [''])
+test('T5022', normalise_fun(normalise_errmsg), compile, [''])
 test('T5333', normal, compile, [''])
index 9fde644..331d1f1 100644 (file)
@@ -1 +1,4 @@
-test('determ021', [extra_files(['A.hs'])], run_command, ['$MAKE -s --no-print-directory determ021'])
+test('determ021',
+     [normalise_fun(normalise_errmsg), extra_files(['A.hs'])],
+     run_command,
+     ['$MAKE -s --no-print-directory determ021'])
index 9866029..949f449 100644 (file)
@@ -57,7 +57,7 @@ test('WildcardInTypeSynonymLHS', normal, compile_fail, [''])
 test('WildcardInTypeSynonymRHS', normal, compile_fail, [''])
 test('T10615', normal, compile_fail, [''])
 test('T10045', normal, compile_fail, [''])
-test('T10999', normal, compile_fail, [''])
+test('T10999', normalise_fun(normalise_errmsg), compile_fail, [''])
 test('T11122', normal, compile, [''])
 test('T11515', normal, compile_fail, [''])
 test('T11976', normal, compile_fail, [''])
index 777d1b9..e8efeb5 100644 (file)
@@ -60,7 +60,7 @@ test('tcfail068', normal, compile_fail, [''])
 test('tcfail069', normal, compile_fail, [''])
 test('tcfail070', normal, compile_fail, [''])
 test('tcfail071', normal, compile, [''])
-test('tcfail072', normal, compile_fail, [''])
+test('tcfail072', normalise_fun(normalise_errmsg), compile_fail, [''])
 test('tcfail073', normal, compile_fail, [''])
 test('tcfail075', normal, compile_fail, [''])
 test('tcfail076', normal, compile_fail, [''])
@@ -250,7 +250,7 @@ test('T5051', normal, compile, [''])
 test('T5236',normal,compile,[''])
 test('T5246',normal,compile_fail,[''])
 test('T5300',normal,compile_fail,[''])
-test('T5095',normal,compile_fail,[''])
+test('T5095',normalise_fun(normalise_errmsg),compile_fail,[''])
 test('T1897a',normal,compile_fail,[''])
 
 test('AssocTyDef01', normal, compile_fail, [''])