[Git][ghc/ghc][wip/T16819] 3 commits: testsuite: Introduce concurrent_ways set

Ben Gamari gitlab at gitlab.haskell.org
Fri Jun 14 03:07:18 UTC 2019



Ben Gamari pushed to branch wip/T16819 at Glasgow Haskell Compiler / GHC


Commits:
4bf79ef7 by Ben Gamari at 2019-06-14T03:07:06Z
testsuite: Introduce concurrent_ways set

Previously we just tested for the threaded2 when determining whether to
skip tests which are fragile under concurrent execution. However, this
isn't the only way which is concurrent.

- - - - -
b4ff741e by Ben Gamari at 2019-06-14T03:07:06Z
testsuite: Skip hDuplicateTo001 in concurrent ways

As noted in #16819, this operation is racy under concurrent execution.

- - - - -
420f2f75 by Ben Gamari at 2019-06-14T03:07:07Z
testsuite: Add assertions that way lists are in fact lists

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.

- - - - -


5 changed files:

- libraries/base/tests/IO/all.T
- testsuite/config/ghc
- testsuite/driver/testlib.py
- testsuite/tests/concurrent/should_run/all.T
- testsuite/tests/rts/all.T


Changes:

=====================================
libraries/base/tests/IO/all.T
=====================================
@@ -84,7 +84,8 @@ test('hGetBuf001',
       expect_fail_if_windows],
      compile_and_run, ['-package unix'])
 
-test('hDuplicateTo001', [], compile_and_run, [''])
+# As discussed in #16819, this test is racy in a threaded environment.
+test('hDuplicateTo001', [omit_ways(concurrent_ways)], compile_and_run, [''])
 
 test('countReaders001', [], compile_and_run, [''])
 


=====================================
testsuite/config/ghc
=====================================
@@ -115,10 +115,10 @@ config.way_rts_flags = {
     'sanity'       : ['-DS'],
     'threaded1'    : [],
     'threaded1_ls' : ['-ls'],
-    'threaded2'    : ['-N2 -ls'],
+    'threaded2'    : ['-N2', '-ls'],
     'threaded2_hT' : ['-N2', '-hT'],
     'hpc'          : [],
-    'prof_hc_hb'   : ['-hc -hbvoid'],
+    'prof_hc_hb'   : ['-hc', '-hbvoid'],
     'prof_hb'      : ['-hb'],
     'prof_hd'      : ['-hd'],
     'prof_hy'      : ['-hy'],
@@ -144,6 +144,11 @@ prof_ways     = [x[0] for x in config.way_flags.items()
 threaded_ways = [x[0] for x in config.way_flags.items()
                       if '-threaded' in x[1] or 'ghci' == x[0]]
 
+# Ways which run with multiple capabilities
+concurrent_ways = [name for name, flags in config.way_flags.items()
+                        if '-threaded' in flags or 'ghci' == name
+                        if '-N2' in config.way_rts_flags.get(name, [])]
+
 opt_ways      = [x[0] for x in config.way_flags.items()
                       if '-O' in x[1]]
 


=====================================
testsuite/driver/testlib.py
=====================================
@@ -204,6 +204,7 @@ def use_specs( specs ):
          ['A B', '-O -prof -fno-prof-count-entries -v0'])
 
     """
+    assert isinstance(ways, 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 ):


=====================================
testsuite/tests/concurrent/should_run/all.T
=====================================
@@ -17,8 +17,8 @@ test('conc069a', only_threaded_ways, compile_and_run, [''])
 # those for now.
 test('conc070', only_threaded_ways, compile_and_run, [''])
 
-test('conc071', omit_ways(['threaded2']), compile_and_run, [''])
-test('conc072', only_ways(['threaded2']), compile_and_run, [''])
+test('conc071', omit_ways(concurrent_ways), compile_and_run, [''])
+test('conc072', only_ways(concurrent_ways), compile_and_run, [''])
 test('conc073', normal, compile_and_run, [''])
 
 # vector code must get inlined to become non-allocating
@@ -67,7 +67,7 @@ test('allowinterrupt001', normal, compile_and_run, [''])
 
 # try hard to provoke the error by running the test 100 times
 test('T5558',
-     [ only_ways(['threaded2']),
+     [ only_ways(concurrent_ways),
        cmd_wrapper(
          lambda c: "for i in %s; do %s || break; done"  %
            (" ".join(str(i) for i in range(1,101)), c)) ],
@@ -88,7 +88,7 @@ test('T7970', normal, compile_and_run, [''])
 test('AtomicPrimops', normal, compile_and_run, [''])
 
 # test uses 2 threads and yield, scheduling can vary with threaded2
-test('threadstatus-9333', [fragile_for(16555, ['ghci']), omit_ways(['threaded2'])], compile_and_run, [''])
+test('threadstatus-9333', [fragile_for(16555, ['ghci']), omit_ways(concurrent_ways)], compile_and_run, [''])
 
 test('T9379', normal, compile_and_run, [''])
 
@@ -132,7 +132,7 @@ test('conc013', normal, compile_and_run, [''])
 test('conc014', normal, compile_and_run, [''])
 test('conc015', normal, compile_and_run, [''])
 test('conc015a', normal, compile_and_run, [''])
-test('conc016', omit_ways(['threaded2']), # see comment in conc016.hs
+test('conc016', omit_ways(concurrent_ways), # see comment in conc016.hs
                 compile_and_run, [''])
 test('conc017', normal, compile_and_run, [''])
 test('conc017a', normal, compile_and_run, [''])
@@ -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']),


=====================================
testsuite/tests/rts/all.T
=====================================
@@ -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, [''])



View it on GitLab: https://gitlab.haskell.org/ghc/ghc/compare/d9217c3112608211d3490301526c7dccb7c573d5...420f2f756cef072cc1450b9b2db121ab12ba120b

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/compare/d9217c3112608211d3490301526c7dccb7c573d5...420f2f756cef072cc1450b9b2db121ab12ba120b
You're receiving this email because of your account on gitlab.haskell.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-commits/attachments/20190613/5be4ddc9/attachment-0001.html>


More information about the ghc-commits mailing list