[Git][ghc/ghc][wip/T24052] testsuite: Run some tests unconditionally in nonmoving ways

Ben Gamari (@bgamari) gitlab at gitlab.haskell.org
Tue Oct 3 21:35:38 UTC 2023



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


Commits:
0a0c75cd by Ben Gamari at 2023-10-03T17:35:19-04:00
testsuite: Run some tests unconditionally in nonmoving ways

Improve test coverage of the nonmoving collector by running a small
subset of tests unconditionally with the nonmoving collector.

Fixes #24052.

- - - - -


4 changed files:

- rts/sm/NonMoving.c
- testsuite/driver/testlib.py
- testsuite/tests/array/should_run/all.T
- testsuite/tests/concurrent/should_run/all.T


Changes:

=====================================
rts/sm/NonMoving.c
=====================================
@@ -565,6 +565,25 @@ static void nonmovingBumpEpoch(void) {
  *
  * See #23340
  *
+ *
+ * Note [Testing the nonmoving collector]
+ * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ * The testsuite has four "ways" which test the nonmoving collector:
+ *
+ *  - nonmoving: runs tests under the nonmoving collector running in
+ *    non-concurrent mode (i.e. using the non-threaded runtime)
+ *  - nonmoving_thr: runs tests under the collector running in concurrent
+ *    mode (with the threaded runtime)
+ *  - nonmoving_thr_sanity: runs tests with concurrent collection and
+ *    sanity checking (i.e. `+RTS -DS`)
+ *  - nonmoving_thr_ghc: compiles tests with `ghc +RTS --nonmoving-gc -RTS`
+ *    as GHC itself tends to be a good smoke test of the collector.
+ *
+ * To avoid blowing up validation times, we do not run any of these ways in the
+ * default "normal" test speed. To ensure that we catch regressions in during
+ * normal validation we do run a small number of tests in these ways. These
+ * tests are identified by the `nonmoving_test` test modifier.
+ *
  */
 
 memcount nonmoving_segment_live_words = 0;


=====================================
testsuite/driver/testlib.py
=====================================
@@ -149,6 +149,15 @@ def js_broken( bug: IssueNumber ):
     else:
         return normal;
 
+def nonmoving_test( name, opts ):
+    """
+    Always run the given test with the nonmoving collector, in addition to
+    the usual ways.
+
+    See Note [Testing the nonmoving collector] in rts/sm/NonMoving.c.
+    """
+    return extra_ways(['nonmoving', 'nonmoving_thr_sanity', 'nonmoving_thr_ghc'])(name, opts)
+
 def expect_fail( name, opts ):
     # The compiler, testdriver, OS or platform is missing a certain
     # feature, and we don't plan to or can't fix it now or in the


=====================================
testsuite/tests/array/should_run/all.T
=====================================
@@ -21,6 +21,6 @@ test('arr014', when(fast(), skip), compile_and_run, [''])
 test('arr015', when(fast(), skip), compile_and_run, [''])
 test('arr017', when(fast(), skip), compile_and_run, [''])
 test('arr018', when(fast(), skip), compile_and_run, [''])
-test('arr019', normal, compile_and_run, [''])
-test('arr020', normal, compile_and_run, [''])
+test('arr019', nonmoving_test, compile_and_run, [''])
+test('arr020', nonmoving_test, compile_and_run, [''])
 test('T21962', normal, compile_and_run, [''])


=====================================
testsuite/tests/concurrent/should_run/all.T
=====================================
@@ -1,18 +1,18 @@
 # -----------------------------------------------------------------------------
 # These tests we do even for 'make fast'
 
-test('conc003', normal, compile_and_run, [''])
-test('conc006', normal, compile_and_run, [''])
-test('conc027', normal, compile_and_run, [''])
-test('conc051', normal, compile_and_run, [''])
+test('conc003', nonmoving_test, compile_and_run, [''])
+test('conc006', nonmoving_test, compile_and_run, [''])
+test('conc027', nonmoving_test, compile_and_run, [''])
+test('conc051', nonmoving_test, compile_and_run, [''])
 
 if ('threaded1' in config.run_ways):
    only_threaded_ways = only_ways(['ghci','threaded1','threaded2', 'nonmoving_thr'])
 else:
    only_threaded_ways = skip
 
-test('conc069', only_threaded_ways, compile_and_run, [''])
-test('conc069a', only_threaded_ways, compile_and_run, [''])
+test('conc069', [nonmoving_test, only_threaded_ways], compile_and_run, [''])
+test('conc069a', [nonmoving_test, only_threaded_ways], compile_and_run, [''])
 # this test gives slightly different results for non-threaded ways, so omit
 # those for now.
 test('conc070', only_threaded_ways, compile_and_run, [''])
@@ -47,8 +47,8 @@ test('T3429', [ extra_run_opts('+RTS -C0.001 -RTS'),
 # times out with ghci
 test('T4030', omit_ghci, compile_and_run, ['-O'])
 
-test('throwto002', normal, compile_and_run, [''])
-test('throwto003', normal, compile_and_run, [''])
+test('throwto002', nonmoving_test, compile_and_run, [''])
+test('throwto003', nonmoving_test, compile_and_run, [''])
 
 test('mask001', normal, compile_and_run, [''])
 test('mask002', js_broken(22261), compile_and_run, [''])
@@ -81,9 +81,9 @@ test('T5611a', fragile(12751), compile_and_run, [''])
 test('T5238', normal, compile_and_run, [''])
 test('T5866', exit_code(1), compile_and_run, [''])
 
-test('readMVar1', normal, compile_and_run, [''])
-test('readMVar2', normal, compile_and_run, [''])
-test('readMVar3', normal, compile_and_run, [''])
+test('readMVar1', nonmoving_test, compile_and_run, [''])
+test('readMVar2', nonmoving_test, compile_and_run, [''])
+test('readMVar3', nonmoving_test, compile_and_run, [''])
 test('tryReadMVar1', normal, compile_and_run, [''])
 test('tryReadMVar2', normal, compile_and_run, [''])
 
@@ -121,9 +121,9 @@ test('allocLimit4', [ extra_run_opts('+RTS -xq300k -RTS'),
 
 setTestOpts(when(fast(), skip))
 
-test('conc001', normal, compile_and_run, [''])
-test('conc002', normal, compile_and_run, [''])
-test('conc004', normal, compile_and_run, [''])
+test('conc001', nonmoving_test, compile_and_run, [''])
+test('conc002', nonmoving_test, compile_and_run, [''])
+test('conc004', nonmoving_test, compile_and_run, [''])
 test('conc007', extra_run_opts('+RTS -H128M -RTS'), compile_and_run, [''])
 test('conc008', normal, compile_and_run, [''])
 test('conc009', exit_code(1), compile_and_run, [''])
@@ -218,16 +218,17 @@ test('conc039', [omit_ways(ghci_ways + threaded_ways), js_skip], compile_and_run
 test('conc040', [exit_code(1), omit_ghci, js_skip], compile_and_run, [''])
 
 # STM-related tests.
-test('conc041', normal, compile_and_run, [''])
-test('conc042', normal, compile_and_run, [''])
-test('conc043', normal, compile_and_run, [''])
-test('conc044', normal, compile_and_run, [''])
-test('conc045', normal, compile_and_run, [''])
+test('conc041', nonmoving_test, compile_and_run, [''])
+test('conc042', nonmoving_test, compile_and_run, [''])
+test('conc043', nonmoving_test, compile_and_run, [''])
+test('conc044', nonmoving_test, compile_and_run, [''])
+test('conc045', nonmoving_test, compile_and_run, [''])
 
-test('conc058', normal, compile_and_run, [''])
+test('conc058', nonmoving_test, compile_and_run, [''])
 
 test('conc059',
      [only_ways(['threaded1', 'threaded2', 'nonmoving_thr']),
+      nonmoving_test,
       pre_cmd('$MAKE -s --no-print-directory conc059_setup')],
      compile_and_run, ['conc059_c.c -no-hs-main'])
 



View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/0a0c75cd55628aad1964e3e4e53b842bdf3de384

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/0a0c75cd55628aad1964e3e4e53b842bdf3de384
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/20231003/f78dd53b/attachment-0001.html>


More information about the ghc-commits mailing list