testsuite: Add assertions that way lists are in fact lists
authorBen Gamari <ben@smart-cactus.org>
Fri, 14 Jun 2019 00:21:03 +0000 (20:21 -0400)
committerMarge Bot <ben+marge-bot@smart-cactus.org>
Sun, 16 Jun 2019 03:34:25 +0000 (23:34 -0400)
Previously there were a few cases where operations like `omit_ways`
were incorrectly passed a single way (e.g. `omit_ways('threaded2')`).
This won't work as the author expected.

12 files changed:
libraries/base/tests/Numeric/all.T
libraries/base/tests/all.T
testsuite/driver/testlib.py
testsuite/tests/codeGen/should_compile/all.T
testsuite/tests/concurrent/should_run/all.T
testsuite/tests/dependent/should_compile/all.T
testsuite/tests/numeric/should_run/all.T
testsuite/tests/primops/should_run/all.T
testsuite/tests/quasiquotation/all.T
testsuite/tests/roles/should_compile/all.T
testsuite/tests/rts/all.T
testsuite/tests/simplCore/should_run/all.T

index 9969a55..74d4c06 100644 (file)
@@ -13,7 +13,7 @@ test('num009', [ when(fast(), skip)
                , when(platform('powerpc64le-unknown-linux'), expect_broken(13634))],
              compile_and_run, [opts])
 test('num010',
-     when(platform('i386-apple-darwin'), expect_broken_for(7043, 'ghci')),
+     when(platform('i386-apple-darwin'), expect_broken_for(7043, ['ghci'])),
      compile_and_run,
      [''])
 test('sqrt', normal, compile_and_run, [''])
index 0fd9761..3345f76 100644 (file)
@@ -249,5 +249,5 @@ test('T14425', normal, compile_and_run, [''])
 test('T10412', normal, compile_and_run, [''])
 test('T13896', normal, compile_and_run, [''])
 test('T13167', fragile_for(16536, ['threaded2']), compile_and_run, [''])
-test('T15349', [exit_code(1), expect_broken_for(15349, 'ghci')], compile_and_run, [''])
+test('T15349', [exit_code(1), expect_broken_for(15349, ['ghci'])], compile_and_run, [''])
 test('T16111', exit_code(1), compile_and_run, [''])
index 9ec3926..e37bf5d 100644 (file)
@@ -204,6 +204,7 @@ def use_specs( specs ):
          ['A B', '-O -prof -fno-prof-count-entries -v0'])
 
     """
+    assert isinstance(specs, dict)
     return lambda name, opts, s=specs: _use_specs( name, opts, s )
 
 def _use_specs( name, opts, specs ):
@@ -213,6 +214,7 @@ def _use_specs( name, opts, specs ):
 # -----
 
 def expect_fail_for( ways ):
+    assert isinstance(ways, list)
     return lambda name, opts, w=ways: _expect_fail_for( name, opts, w )
 
 def _expect_fail_for( name, opts, ways ):
@@ -228,6 +230,7 @@ def _expect_broken( name, opts, bug ):
     opts.expect = 'fail';
 
 def expect_broken_for( bug, ways ):
+    assert isinstance(ways, list)
     return lambda name, opts, b=bug, w=ways: _expect_broken_for( name, opts, b, w )
 
 def _expect_broken_for( name, opts, bug, ways ):
@@ -271,6 +274,7 @@ def fragile_for( bug, ways ):
 # -----
 
 def omit_ways( ways ):
+    assert isinstance(ways, list)
     return lambda name, opts, w=ways: _omit_ways( name, opts, w )
 
 def _omit_ways( name, opts, ways ):
@@ -280,6 +284,7 @@ def _omit_ways( name, opts, ways ):
 # -----
 
 def only_ways( ways ):
+    assert isinstance(ways, list)
     return lambda name, opts, w=ways: _only_ways( name, opts, w )
 
 def _only_ways( name, opts, ways ):
@@ -288,6 +293,7 @@ def _only_ways( name, opts, ways ):
 # -----
 
 def extra_ways( ways ):
+    assert isinstance(ways, list)
     return lambda name, opts, w=ways: _extra_ways( name, opts, w )
 
 def _extra_ways( name, opts, ways ):
index ed7f5f3..5f5b8a2 100644 (file)
@@ -45,7 +45,7 @@ test('T14999',
 # Verify that we optimize away redundant jumps for unordered comparisons.
 test('T15196',
   [ unless(arch('x86_64'), skip),
-    only_ways('normal'),
+    only_ways(['normal']),
   ], makefile_test, [])
 
 test('T15723',
index d770b4d..b548f57 100644 (file)
@@ -239,7 +239,7 @@ test('conc067', ignore_stdout, compile_and_run, [''])
 
 # omit threaded2, the behaviour of this test is non-deterministic with more
 # than one CPU.
-test('conc068', [ omit_ways(['threaded2']), exit_code(1) ], compile_and_run, [''])
+test('conc068', [ omit_ways(concurrent_ways), exit_code(1) ], compile_and_run, [''])
 
 test('setnumcapabilities001',
      [ only_ways(['threaded1','threaded2']),
index 6a848cf..a3fc4ac 100644 (file)
@@ -1,10 +1,10 @@
-test('Dep1', only_ways('normal'), compile, [''])
-test('Dep2', only_ways('normal'), compile, [''])
-test('Dep3', only_ways('normal'), compile, [''])
-test('KindEqualities', only_ways('normal'), compile, [''])
-test('KindEqualities2', only_ways('normal'), compile, [''])
-test('Rae31', only_ways('normal'), compile, [''])
-test('RAE_T32b', only_ways('normal'), compile, [''])
+test('Dep1', only_ways(['normal']), compile, [''])
+test('Dep2', only_ways(['normal']), compile, [''])
+test('Dep3', only_ways(['normal']), compile, [''])
+test('KindEqualities', only_ways(['normal']), compile, [''])
+test('KindEqualities2', only_ways(['normal']), compile, [''])
+test('Rae31', only_ways(['normal']), compile, [''])
+test('RAE_T32b', only_ways(['normal']), compile, [''])
 test('KindLevels', normal, compile, [''])
 test('RaeBlogPost', normal, compile, [''])
 test('mkGADTVars', normal, compile, [''])
index cf2e2ea..de1f5be 100644 (file)
@@ -7,7 +7,7 @@ test('arith001', normal, compile_and_run, [''])
 test('arith002', normal, compile_and_run, [''])
 test('arith003', normal, compile_and_run, [''])
 test('arith004', normal, compile_and_run, [''])
-test('arith005', when(platform('i386-apple-darwin'), expect_broken_for(7043, 'ghci')), compile_and_run, [''])
+test('arith005', when(platform('i386-apple-darwin'), expect_broken_for(7043, ['ghci'])), compile_and_run, [''])
 test('arith006', normal, compile_and_run, [''])
 test('arith007', normal, compile_and_run, [''])
 
index e03cfd8..6f5a04c 100644 (file)
@@ -8,7 +8,7 @@ test('T4442',
 test('T10481', exit_code(1), compile_and_run, [''])
 test('T10678',
      [ collect_stats('bytes allocated',5),
-      only_ways('normal')
+       only_ways(['normal'])
      ],
      compile_and_run, ['-O'])
 test('T11296', normal, compile_and_run, [''])
index 96471f5..a48b0f1 100644 (file)
@@ -3,8 +3,8 @@ test('T4150', [expect_broken(4150)], makefile_test, ['T4150'])
 test('T5204', req_interp, compile_fail, [''])
 test('T7918',
      [req_interp, extra_run_opts('"' + config.libdir + '"'),
-      only_ways(config.ghc_th_way), unless(have_dynamic(), skip)],
+      only_ways([config.ghc_th_way]), unless(have_dynamic(), skip)],
      compile_and_run, ['-package ghc ' + config.ghc_th_way_flags])
 test('T14028',
-     [req_interp, only_ways(config.ghc_th_way)],
+     [req_interp, only_ways([config.ghc_th_way])],
      makefile_test, ['T14028'])
index 064202e..1e8599e 100644 (file)
@@ -1,12 +1,12 @@
 setTestOpts(normalise_version('base','ghc-prim'))
 
-test('Roles1', only_ways('normal'), compile, ['-ddump-tc -fprint-explicit-foralls -dsuppress-uniques'])
-test('Roles2', only_ways('normal'), compile, ['-ddump-tc -fprint-explicit-foralls -dsuppress-uniques'])
-test('Roles3', only_ways('normal'), compile, ['-ddump-tc -dsuppress-uniques'])
-test('Roles4', only_ways('normal'), compile, ['-ddump-tc -dsuppress-uniques'])
-test('Roles13', only_ways('normal'), compile, ['-ddump-simpl -dsuppress-uniques'])
-test('Roles14', only_ways('normal'), compile, ['-ddump-tc -dsuppress-uniques'])
-test('T8958', [normalise_fun(normalise_errmsg), only_ways('normal')], compile, ['-ddump-tc -dsuppress-uniques -fprint-typechecker-elaboration'])
+test('Roles1', only_ways(['normal']), compile, ['-ddump-tc -fprint-explicit-foralls -dsuppress-uniques'])
+test('Roles2', only_ways(['normal']), compile, ['-ddump-tc -fprint-explicit-foralls -dsuppress-uniques'])
+test('Roles3', only_ways(['normal']), compile, ['-ddump-tc -dsuppress-uniques'])
+test('Roles4', only_ways(['normal']), compile, ['-ddump-tc -dsuppress-uniques'])
+test('Roles13', only_ways(['normal']), compile, ['-ddump-simpl -dsuppress-uniques'])
+test('Roles14', only_ways(['normal']), compile, ['-ddump-tc -dsuppress-uniques'])
+test('T8958', [normalise_fun(normalise_errmsg), only_ways(['normal'])], compile, ['-ddump-tc -dsuppress-uniques -fprint-typechecker-elaboration'])
 test('T10263', normal, compile, [''])
 test('T9204b', [], multimod_compile, ['T9204b', '-v0'])
 test('T14101', normal, compile, [''])
index 173ed7c..9f2c064 100644 (file)
@@ -316,7 +316,7 @@ test('T11788', when(ghc_dynamic(), skip),
 
 test('T10296a', [req_smp], makefile_test, ['T10296a'])
 
-test('T10296b', [only_ways('threaded2')], compile_and_run, [''])
+test('T10296b', [only_ways(['threaded2'])], compile_and_run, [''])
 
 test('numa001', [ extra_run_opts('8'), unless(unregisterised(), extra_ways(['debug_numa'])) ]
                 , compile_and_run, [''])
index 9ec45e0..0d27d11 100644 (file)
@@ -86,7 +86,7 @@ test('T14868',
      compile_and_run, [''])
 test('T14894', [when((arch('powerpc64') or arch('powerpc64le')), expect_broken(11261))], compile_and_run, [''])
 test('T14965', normal, compile_and_run, [''])
-test('T15114', only_ways('optasm'), compile_and_run, [''])
+test('T15114', only_ways(['optasm']), compile_and_run, [''])
 test('T15436', normal, compile_and_run, [''])
 test('T15840', normal, compile_and_run, [''])
 test('T15840a', normal, compile_and_run, [''])