testsuite/plugins: Add multi_cpu_race modifier on Windows
authorBen Gamari <ben@smart-cactus.org>
Tue, 5 Mar 2019 00:01:43 +0000 (19:01 -0500)
committerMarge Bot <ben+marge-bot@smart-cactus.org>
Wed, 20 Mar 2019 22:41:32 +0000 (18:41 -0400)
A few tests previously failed with various failure modes. For instance,
  `plugin-recomp-change` fails with:

```
Wrong exit code for plugin-recomp-change()(expected 0 , actual 2 )
Stderr ( plugin-recomp-change ):
Simple Plugin Passes Queried
Got options:
Simple Plugin Pass Run
C://GitLabRunner//builds//8fc0e283//0//ghc//ghc//inplace//mingw//bin/ld.exe: cannot find -lHSplugin-recompilation-0.1-CPeObcGoBuvHdwBnpK9jQq
collect2.exe: error: ld returned 1 exit status
`gcc.exe' failed in phase `Linker'. (Exit code: 1)
make[2]: *** [Makefile:112: plugin-recomp-change] Error 1
*** unexpected failure for plugin-recomp-change(normal)
```

It's unclear whether the ghc-pkg concurrency issue mentioned in all.T is
the culprit but the set of tests that fail overlaps strongly with the
set of tests that lack the `multi_cpu_race` modifier. Let's see if
adding it fixes them.

testsuite/tests/plugins/all.T

index f53d9aa..1834e3b 100644 (file)
@@ -1,4 +1,4 @@
-setTestOpts(req_interp)
+setTestOpts([req_interp, when(opsys('mingw32'), multi_cpu_race)])
 
 # The implementation of ghc-pkg doesn't seem to be multi-concurrent process safe
 # on windows. These tests which mutate the package db need to be run
@@ -7,130 +7,111 @@ setTestOpts(req_interp)
 
 test('plugins01',
      [extra_files(['simple-plugin/']), only_ways([config.ghc_plugin_way]),
-      when(opsys('mingw32'), multi_cpu_race),
       pre_cmd('$MAKE -s --no-print-directory -C simple-plugin package.plugins01 TOP={top}')],
      makefile_test, [])
 
 test('plugins02',
      [extra_files(['simple-plugin/']), only_ways([config.ghc_plugin_way]),
-      when(opsys('mingw32'), multi_cpu_race),
       pre_cmd('$MAKE -s --no-print-directory -C simple-plugin package.plugins02 TOP={top}')],
      compile_fail,
      ['-package-db simple-plugin/pkg.plugins02/local.package.conf -fplugin Simple.BadlyTypedPlugin -package simple-plugin ' + config.plugin_way_flags])
 
 test('plugins03',
      [extra_files(['simple-plugin/']), only_ways([config.ghc_plugin_way]),
-      when(opsys('mingw32'), multi_cpu_race),
       pre_cmd('$MAKE -s --no-print-directory -C simple-plugin package.plugins03 TOP={top}')],
      compile_fail,
      ['-package-db simple-plugin/pkg.plugins03/local.package.conf -fplugin Simple.NonExistentPlugin -package simple-plugin'])
 
 test('plugins04',
      [extra_files(['HomePackagePlugin.hs']),
-      only_ways([config.ghc_plugin_way]),
-      when(opsys('mingw32'), multi_cpu_race)],
+      only_ways([config.ghc_plugin_way])],
      multimod_compile_fail,
      ['plugins04', '-package ghc -fplugin HomePackagePlugin'])
 
 test('plugins05', [extra_files(['HomePackagePlugin.hs']),
-                   when(opsys('mingw32'), multi_cpu_race),
                    only_ways([config.ghc_plugin_way])],
      multimod_compile_and_run, ['plugins05', '-package ghc'])
 
 test('plugins06',
      [extra_files(['LinkerTicklingPlugin.hs']),
-      when(opsys('mingw32'), multi_cpu_race),
       unless(have_dynamic(), skip),
       only_ways([config.ghc_plugin_way])],
      multimod_compile_and_run, ['plugins06', '-package ghc'])
 
 test('plugins07',
      [extra_files(['rule-defining-plugin/']),
-      when(opsys('mingw32'), multi_cpu_race),
       only_ways([config.ghc_plugin_way]),
       pre_cmd('$MAKE -s --no-print-directory -C rule-defining-plugin package.plugins07 TOP={top}')],
      makefile_test, [])
 
 test('plugins08',
      [extra_files(['simple-plugin/']),
-      when(opsys('mingw32'), multi_cpu_race),
       only_ways([config.ghc_plugin_way]),
       pre_cmd('$MAKE -s --no-print-directory -C simple-plugin package.plugins08 TOP={top}')],
      makefile_test, [])
 
 test('plugins09',
      [extra_files(['simple-plugin/']),
-      when(opsys('mingw32'), multi_cpu_race),
       only_ways([config.ghc_plugin_way]),
       pre_cmd('$MAKE -s --no-print-directory -C simple-plugin package.plugins09 TOP={top}')],
      makefile_test, [])
 
 test('plugins10',
      [extra_files(['simple-plugin/', 'QuasiQuotation.hs']),
-      when(opsys('mingw32'), multi_cpu_race),
       only_ways([config.ghc_plugin_way]),
       pre_cmd('$MAKE -s --no-print-directory -C simple-plugin package.plugins10 TOP={top}')],
      makefile_test, [])
 
 test('plugins11',
      [extra_files(['simple-plugin/']),
-      when(opsys('mingw32'), multi_cpu_race),
       only_ways([config.ghc_plugin_way]),
       pre_cmd('$MAKE -s --no-print-directory -C simple-plugin package.plugins11 TOP={top}')],
      makefile_test, [])
 
 test('plugins12',
      [extra_files(['simple-plugin/']),
-      when(opsys('mingw32'), multi_cpu_race),
       only_ways([config.ghc_plugin_way]),
       pre_cmd('$MAKE -s --no-print-directory -C simple-plugin package.plugins12 TOP={top}')],
      makefile_test, [])
 
 test('plugins13',
      [extra_files(['simple-plugin/', 'PluginFilteredExport.hs']),
-      when(opsys('mingw32'), multi_cpu_race),
       only_ways([config.ghc_plugin_way]),
       pre_cmd('$MAKE -s --no-print-directory -C simple-plugin package.plugins13 TOP={top}')],
      makefile_test, [])
 
 test('plugins14',
      [extra_files(['simple-plugin/']),
-      when(opsys('mingw32'), multi_cpu_race),
       only_ways([config.ghc_plugin_way]),
       pre_cmd('$MAKE -s --no-print-directory -C simple-plugin package.plugins14 TOP={top}')],
      makefile_test, [])
 
 test('plugins15',
      [extra_files(['simple-plugin/', 'MetaRemoveHelper.hs']),
-      when(opsys('mingw32'), multi_cpu_race),
       only_ways([config.ghc_plugin_way]),
       pre_cmd('$MAKE -s --no-print-directory -C simple-plugin package.plugins15 TOP={top}')],
      makefile_test, [])
 
 test('T10420',
      [extra_files(['rule-defining-plugin/']),
-      when(opsys('mingw32'), multi_cpu_race),
       only_ways([config.ghc_plugin_way]),
       pre_cmd('$MAKE -s --no-print-directory -C rule-defining-plugin package.T10420 TOP={top}')],
      makefile_test, [])
 
 test('T10294',
      [extra_files(['annotation-plugin/']),
-      when(opsys('mingw32'), multi_cpu_race),
       only_ways([config.ghc_plugin_way]),
       pre_cmd('$MAKE -s --no-print-directory -C annotation-plugin package.T10294 TOP={top}')],
      makefile_test, [])
 
 test('T10294a',
      [extra_files(['annotation-plugin/']),
-      when(opsys('mingw32'), multi_cpu_race),
       only_ways([config.ghc_plugin_way]),
       pre_cmd('$MAKE -s --no-print-directory -C annotation-plugin package.T10294a TOP={top}')],
      makefile_test, [])
 
 test('frontend01', [extra_files(['FrontendPlugin.hs']),
                     only_ways([config.ghc_plugin_way]),
-                    when(opsys('mingw32'), multi_cpu_race),
                     unless(have_dynamic(), expect_broken(10301))],
      makefile_test, [])
 
@@ -142,14 +123,12 @@ test('T11244',
 
 test('T12567a',
      [extra_files(['T12567b.hs', 'simple-plugin/']),
-      when(opsys('mingw32'), multi_cpu_race),
       only_ways([config.ghc_plugin_way]),
       pre_cmd('$MAKE -s --no-print-directory -C simple-plugin package.T12567a TOP={top}')],
      makefile_test, [])
 
 test('T14335',
      [extra_files(['simple-plugin/', 'plugins01.hs']),
-      when(opsys('mingw32'), multi_cpu_race),
       only_ways([config.ghc_plugin_way]),
       pre_cmd('$MAKE -s --no-print-directory -C simple-plugin package.plugins01 TOP={top}')],
      compile_fail,
@@ -158,7 +137,6 @@ test('T14335',
 
 test('plugin-recomp-pure',
      [extra_files(['plugin-recomp/', 'plugin-recomp-test.hs']),
-      when(opsys('mingw32'), multi_cpu_race),
       only_ways([config.ghc_plugin_way]),
       pre_cmd('$MAKE -s --no-print-directory -C plugin-recomp package.plugins01 TOP={top}')
       ],
@@ -166,7 +144,6 @@ test('plugin-recomp-pure',
 
 test('plugin-recomp-impure',
      [extra_files(['plugin-recomp/', 'plugin-recomp-test.hs']),
-      when(opsys('mingw32'), multi_cpu_race),
       only_ways([config.ghc_plugin_way]),
       pre_cmd('$MAKE -s --no-print-directory -C plugin-recomp package.plugins01 TOP={top}')
       ],
@@ -174,7 +151,6 @@ test('plugin-recomp-impure',
 
 test('plugin-recomp-flags',
      [extra_files(['plugin-recomp/', 'plugin-recomp-test.hs']),
-      when(opsys('mingw32'), multi_cpu_race),
       only_ways([config.ghc_plugin_way]),
       pre_cmd('$MAKE -s --no-print-directory -C plugin-recomp package.plugins01 TOP={top}')
       ],
@@ -213,7 +189,7 @@ test('T15858',
 test('T16104',
      [extra_files(['T16104-plugin/']),
       pre_cmd('$MAKE -s --no-print-directory -C T16104-plugin package.T16104-plugin TOP={top}')
-     ],
+      ],
      makefile_test, [])
 
 test('T16260',