testsuite: Ensure that threaded tests are run in nonmoving_thr
[ghc.git] / testsuite / tests / concurrent / should_run / all.T
1 # -----------------------------------------------------------------------------
2 # These tests we do even for 'make fast'
3
4 test('conc003', normal, compile_and_run, [''])
5 test('conc006', normal, compile_and_run, [''])
6 test('conc027', normal, compile_and_run, [''])
7 test('conc051', normal, compile_and_run, [''])
8
9 if ('threaded1' in config.run_ways):
10    only_threaded_ways = only_ways(['ghci','threaded1','threaded2', 'nonmoving_thr'])
11 else:
12    only_threaded_ways = skip
13
14 test('conc069', only_threaded_ways, compile_and_run, [''])
15 test('conc069a', only_threaded_ways, compile_and_run, [''])
16 # this test gives slightly different results for non-threaded ways, so omit
17 # those for now.
18 test('conc070', only_threaded_ways, compile_and_run, [''])
19
20 test('conc071', omit_ways(['threaded2']), compile_and_run, [''])
21 test('conc072', only_ways(['threaded2']), compile_and_run, [''])
22 test('conc073', normal, compile_and_run, [''])
23
24 # vector code must get inlined to become non-allocating
25 test('T367',
26      [reqlib('vector'), omit_ways(['ghci']), run_timeout_multiplier(0.001)],
27      compile_and_run, ['-O2 -fno-omit-yields'])
28 test('T367_letnoescape',
29      [run_timeout_multiplier(0.02), expect_broken_for(7297,['optllvm'])],
30      compile_and_run, ['-fno-omit-yields'])
31
32 test('T1980', normal, compile_and_run, [''])
33 test('T2910', normal, compile_and_run, [''])
34 test('T2910a', normal, compile_and_run, [''])
35 test('T3279', normal, compile_and_run, [''])
36
37 # This test takes a long time with the default context switch interval
38 test('T3429', [ extra_run_opts('+RTS -C0.001 -RTS'),
39                 unless(unregisterised(), extra_ways(['debug_numa'])) ],
40      compile_and_run, [''])
41
42 # without -O, goes into an infinite loop
43 test('T4030', normal, compile_and_run, ['-O'])
44
45 # each of these runs for about a second
46 test('throwto001', [reqlib('random'), extra_run_opts('1000 2000')],
47                    compile_and_run, [''])
48 test('throwto002', [reqlib('random')], compile_and_run, [''])
49 test('throwto003', normal, compile_and_run, [''])
50
51 test('mask001', normal, compile_and_run, [''])
52 test('mask002', normal, compile_and_run, [''])
53
54 test('async001', normal, compile_and_run, [''])
55
56 test('numsparks001', only_ways(['threaded1']), compile_and_run, [''])
57
58 test('T4262', [ skip, # skip for now, it doesn't give reliable results
59                 only_ways(['threaded1']),
60                 unless(opsys('linux'),skip) ],
61               compile_and_run, [''])
62
63 test('T4813', normal, compile_and_run, [''])
64 test('T4811', normal, compile_and_run, [''])
65
66 test('allowinterrupt001', normal, compile_and_run, [''])
67
68 # try hard to provoke the error by running the test 100 times
69 test('T5558',
70      [ only_ways(['threaded2']),
71        cmd_wrapper(
72          lambda c: "for i in %s; do %s || break; done"  %
73            (" ".join(str(i) for i in range(1,101)), c)) ],
74      compile_and_run, [''])
75
76 test('T5421', normal, compile_and_run, [''])
77 # See #12751, the test fails non-deterministically so we skip it.
78 test('T5611', when ( opsys('darwin'), skip) , compile_and_run, [''])
79 test('T5238', normal, compile_and_run, [''])
80 test('T5866', exit_code(1), compile_and_run, [''])
81
82 test('readMVar1', normal, compile_and_run, [''])
83 test('readMVar2', normal, compile_and_run, [''])
84 test('readMVar3', normal, compile_and_run, [''])
85 test('tryReadMVar1', normal, compile_and_run, [''])
86 test('tryReadMVar2', normal, compile_and_run, [''])
87
88 test('T7970', normal, compile_and_run, [''])
89 test('AtomicPrimops', normal, compile_and_run, [''])
90
91 # test uses 2 threads and yield, scheduling can vary with threaded2
92 test('threadstatus-9333', [omit_ways(['threaded2'])], compile_and_run, [''])
93
94 test('T9379', normal, compile_and_run, [''])
95
96 test('allocLimit1', exit_code(1), compile_and_run, [''])
97 test('allocLimit2', normal, compile_and_run, [''])
98
99 # The non-threaded RTS on Windows doesn't handle throwing exceptions at I/O
100 # operations very well, and ends up duplicating the I/O, giving wrong results.
101 test('allocLimit3', [ when(opsys('mingw32'), only_ways(threaded_ways)),
102                       exit_code(1) ], compile_and_run, [''])
103
104 test('allocLimit4', [ extra_run_opts('+RTS -xq300k -RTS'),
105                       # ghci consumes part of set limit at startup
106                       omit_ways(['ghci']) ],
107                     compile_and_run, [''])
108
109 test('performGC', [ only_ways(['threaded1','threaded2']), req_smp,
110                     reqlib('random'),
111                     extra_run_opts('400 +RTS -qg -RTS') ],
112                     compile_and_run, [''])
113
114 # -----------------------------------------------------------------------------
115 # These tests we only do for a full run
116
117 setTestOpts(when(fast(), skip))
118
119 test('conc001', normal, compile_and_run, [''])
120 test('conc002', normal, compile_and_run, [''])
121 test('conc004', normal, compile_and_run, [''])
122 test('conc007', extra_run_opts('+RTS -H128M -RTS'), compile_and_run, [''])
123 test('conc008', normal, compile_and_run, [''])
124 test('conc009', exit_code(1), compile_and_run, [''])
125 test('conc010', normal, compile_and_run, [''])
126
127 # conc012(ghci) needs a smaller stack, or it takes forever
128 test('conc012',
129      extra_run_opts('+RTS -K8m -RTS'),
130      compile_and_run, [''])
131
132 test('conc013', normal, compile_and_run, [''])
133 test('conc014', normal, compile_and_run, [''])
134 test('conc015', normal, compile_and_run, [''])
135 test('conc015a', normal, compile_and_run, [''])
136 test('conc016', omit_ways(['threaded2']), # see comment in conc016.hs
137                 compile_and_run, [''])
138 test('conc017', normal, compile_and_run, [''])
139 test('conc017a', normal, compile_and_run, [''])
140 test('conc018', normal, compile_and_run, [''])
141 test('conc019', extra_run_opts('+RTS -K16m -RTS'), compile_and_run, [''])
142 test('conc020', normal, compile_and_run, [''])
143 test('conc021', [ omit_ways(['ghci']), exit_code(1) ], compile_and_run, [''])
144 test('conc022', normal, compile_and_run, [''])
145
146 # On Windows, the non-threaded RTS creates a real OS thread for each
147 # threadDelay.  conc023 creates 5000 concurrent threadDelays, and the
148 # resulting creation of OS threads seems to cause the system to run
149 # out of memory sometimes (I'm not sure exactly how/why this happens,
150 # but the threaded RTS fixes it).  See #1197.
151 if config.platform == 'i386-unknown-mingw32':
152    conc023_ways = only_ways(['threaded1','threaded2'])
153 else:
154    conc023_ways = normal
155
156 test('conc023', [when(fast(), skip),
157                  reqlib('random'), multi_cpu_race,
158                  conc023_ways], compile_and_run, [''])
159
160 test('conc024', normal, compile_and_run, [''])
161 test('conc025', normal, compile_and_run, [''])
162 test('conc026', normal, compile_and_run, [''])
163 test('conc028', normal, compile_and_run, [''])
164 test('conc029', normal, compile_and_run, [''])
165 test('conc030', extra_run_opts('+RTS -K4M -RTS'), compile_and_run, [''])
166
167 test('conc031', exit_code(1), compile_and_run, [''])
168
169 test('conc032', normal, compile_and_run, [''])
170 test('conc033', normal, compile_and_run, [''])
171
172 # Omit for GHCi, because it just sits there waiting for you to press ^C
173 test('conc034', [
174                  normal,
175                  omit_ways(['ghci']),
176                  extra_run_opts('+RTS -C0 -RTS')],
177                 compile_and_run, [''])
178
179 test('conc035', normal, compile_and_run, [''])
180
181 # conc036: now skipped entirely.  This test attempts to check that
182 # unsafe foreign calls block other threads, but doing that reliably is
183 # probably impossible.  The last straw was when it started failing on
184 # Windows around 7.4.x.
185 #
186 # OLD comments about hacks we tried to make it work:
187 #   Omit for GHCi: firstly GHCi doesn't have unsafe FFI calls, and secondly
188 #   the main thread cannot receive the deadlock exception because it can be
189 #   woken up by ^C.
190 #   Omit for threaded2: this test is really bogus and fails to do anything
191 #   sensible for more than one CPU.
192 #
193 test('conc036', skip, compile_and_run, [''])
194
195
196 # Interrupting foreign calls only makes sense if we are threaded
197 test('foreignInterruptible', [when(fast(), skip),
198                               when(opsys('mingw32'),expect_fail),
199                               # I don't think we support interrupting Sleep()
200                               # on Windows.  --SDM
201                               only_threaded_ways,
202                               ],
203       compile_and_run, [''])
204
205 test('conc037', only_ways(['threaded1', 'threaded2', 'nonmoving_thr']), compile_and_run, [''])
206 test('conc038', only_ways(['threaded1', 'threaded2', 'nonmoving_thr']), compile_and_run, [''])
207
208 # Omit for GHCi, uses foreign export
209 # Omit for the threaded ways, because in this case the main thread is allowed to
210 # complete, which causes the child thread to be interrupted.
211 test('conc039', omit_ways(['ghci'] + threaded_ways), compile_and_run, [''])
212
213 # Omit for GHCi, uses foreign export
214 test('conc040', [exit_code(1), omit_ways(['ghci'])], compile_and_run, [''])
215
216 # STM-related tests.
217 test('conc041', normal, compile_and_run, [''])
218 test('conc042', normal, compile_and_run, [''])
219 test('conc043', normal, compile_and_run, [''])
220 test('conc044', normal, compile_and_run, [''])
221 test('conc045', normal, compile_and_run, [''])
222
223 test('conc058', normal, compile_and_run, [''])
224
225 test('conc059',
226      [only_ways(['threaded1', 'threaded2', 'nonmoving_thr']),
227       pre_cmd('$MAKE -s --no-print-directory conc059_setup')],
228      compile_and_run, ['conc059_c.c -no-hs-main'])
229
230 # This test sometimes just exits successfully
231 # when run the threaded2 way. The problem hasn't been diagnosed yet
232 test('conc064',
233      exit_code(1),
234      compile_and_run, [''])
235
236 test('conc065', ignore_stdout, compile_and_run, [''])
237 test('conc066', ignore_stdout, compile_and_run, [''])
238 test('conc067', ignore_stdout, compile_and_run, [''])
239
240 # omit threaded2, the behaviour of this test is non-deterministic with more
241 # than one CPU.
242 test('conc068', [ omit_ways('threaded2'), exit_code(1) ], compile_and_run, [''])
243
244 test('setnumcapabilities001',
245      [ only_ways(['threaded1','threaded2', 'nonmoving_thr']),
246        extra_run_opts('8 12 2000'),
247        req_smp ],
248      compile_and_run, [''])
249
250 # omit ghci, which can't handle unboxed tuples:
251 test('compareAndSwap', [omit_ways(['ghci','hpc']), reqlib('primitive')], compile_and_run, [''])
252
253 test('hs_try_putmvar001',
254      [
255      when(opsys('mingw32'),skip), # uses pthread APIs in the C code
256      only_ways(['threaded1', 'threaded2', 'nonmoving_thr']),
257       extra_clean(['hs_try_putmvar001_c.o'])],
258      compile_and_run,
259      ['hs_try_putmvar001_c.c'])
260
261 # A benchmark for hs_try_putmvar() vs. foreign export
262 # This one should work for both threaded and non-threaded RTS
263 test('hs_try_putmvar002',
264      [pre_cmd('$MAKE -s --no-print-directory hs_try_putmvar002_setup'),
265       omit_ways(['ghci']),
266       extra_run_opts('1 8 10000')],
267      compile_and_run, ['hs_try_putmvar002_c.c'])
268
269 # Another benchmark for hs_try_putmvar() vs. foreign export
270 test('hs_try_putmvar003',
271      [
272      when(opsys('mingw32'),skip), # uses pthread APIs in the C code
273      pre_cmd('$MAKE -s --no-print-directory hs_try_putmvar003_setup'),
274      only_ways(['threaded1', 'threaded2', 'nonmoving_thr']),
275      extra_clean(['hs_try_putmvar003_c.o']),
276      extra_run_opts('1 16 32 100')
277      ],
278      compile_and_run,
279      ['hs_try_putmvar003_c.c'])
280
281 # Check forkIO exception determinism under optimization
282 test('T13330', normal, compile_and_run, ['-O'])
283 test('T13916', [reqlib('vector'), reqlib('stm'), reqlib('async')],
284      compile_and_run, ['-O2'])