2d3ac2e37674c98bf56e775d77438dacffa502af
[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'])
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'), compile_and_run, [''])
39
40 # without -O, goes into an infinite loop
41 # GHCi does not detect the infinite loop.  We should really fix this.
42 test('T4030', omit_ways('ghci'), compile_and_run, ['-O'])
43
44 # each of these runs for about a second
45 test('throwto001', [reqlib('random'), extra_run_opts('1000 2000')],
46                    compile_and_run, [''])
47 test('throwto002', [reqlib('random')], compile_and_run, [''])
48 test('throwto003', normal, compile_and_run, [''])
49
50 test('mask001', normal, compile_and_run, [''])
51 test('mask002', normal, compile_and_run, [''])
52
53 test('async001', normal, compile_and_run, [''])
54
55 test('numsparks001', only_ways(['threaded1']), compile_and_run, [''])
56
57 test('T4262', [ skip, # skip for now, it doesn't give reliable results
58                 only_ways(['threaded1']),
59                 unless(opsys('linux'),skip) ],
60               compile_and_run, [''])
61
62 test('T4813', normal, compile_and_run, [''])
63 test('T4811', normal, compile_and_run, [''])
64
65 test('allowinterrupt001', normal, compile_and_run, [''])
66
67 # try hard to provoke the error by running the test 100 times
68 test('T5558',
69      [ only_ways(['threaded2']),
70        cmd_wrapper(
71          lambda c: "for i in %s; do %s || break; done"  %
72            (" ".join(str(i) for i in range(1,101)), c)) ],
73      compile_and_run, [''])
74
75 test('T5421', normal, compile_and_run, [''])
76 test('T5611', normal, compile_and_run, [''])
77 test('T5238', normal, compile_and_run, [''])
78 test('T5866', exit_code(1), compile_and_run, [''])
79
80 test('readMVar1', normal, compile_and_run, [''])
81 test('readMVar2', normal, compile_and_run, [''])
82 test('readMVar3', normal, compile_and_run, [''])
83 test('tryReadMVar1', normal, compile_and_run, [''])
84 test('tryReadMVar2', normal, compile_and_run, [''])
85
86 test('T7970', normal, compile_and_run, [''])
87 test('AtomicPrimops', normal, compile_and_run, [''])
88
89 # test uses 2 threads and yield, scheduling can vary with threaded2
90 test('threadstatus-9333', [omit_ways(['threaded2'])], compile_and_run, [''])
91
92 test('T9379', normal, compile_and_run, [''])
93
94 test('allocLimit1', exit_code(1), compile_and_run, [''])
95 test('allocLimit2', normal, compile_and_run, [''])
96
97 # The non-threaded RTS on Windows doesn't handle throwing exceptions at I/O
98 # operations very well, and ends up duplicating the I/O, giving wrong results.
99 test('allocLimit3', [ when(opsys('mingw32'), only_ways(threaded_ways)),
100                       exit_code(1) ], compile_and_run, [''])
101
102 test('allocLimit4', [ extra_run_opts('+RTS -xq300k -RTS') ],
103                     compile_and_run, [''])
104
105 # -----------------------------------------------------------------------------
106 # These tests we only do for a full run
107
108 def f( name, opts ):
109   if config.fast:
110      opts.skip = 1
111
112 setTestOpts(f)
113
114 test('conc001', normal, compile_and_run, [''])
115 test('conc002', normal, compile_and_run, [''])
116
117 # Omit GHCi way - it blows up to 0.5G.  Something to do with the threaded RTS?
118 test('conc004', omit_ways(['ghci']), compile_and_run, [''])
119
120 test('conc007', [only_compiler_types(['ghc']),
121                  extra_run_opts('+RTS -H128M -RTS')],
122                 compile_and_run, [''])
123 test('conc008', only_compiler_types(['ghc']), compile_and_run, [''])
124 test('conc009', [only_compiler_types(['ghc']), exit_code(1)],
125                 compile_and_run, [''])
126 test('conc010', only_compiler_types(['ghc']), compile_and_run, [''])
127
128 # conc012(ghci) needs a smaller stack, or it takes forever
129 test('conc012', [only_compiler_types(['ghc']),
130                  extra_run_opts('+RTS -K8m -RTS')],
131                 compile_and_run, [''])
132
133 test('conc013', only_compiler_types(['ghc']), compile_and_run, [''])
134
135 test('conc014', only_compiler_types(['ghc']), compile_and_run, [''])
136 test('conc015', only_compiler_types(['ghc']), compile_and_run, [''])
137 test('conc015a', only_compiler_types(['ghc']), compile_and_run, [''])
138 test('conc016', [ omit_ways(['threaded2']), # see comment in conc016.hs
139                   only_compiler_types(['ghc']) ], compile_and_run, [''])
140 test('conc017', only_compiler_types(['ghc']), compile_and_run, [''])
141 test('conc017a', only_compiler_types(['ghc']), compile_and_run, [''])
142 test('conc018', only_compiler_types(['ghc']), compile_and_run, [''])
143 test('conc019', [only_compiler_types(['ghc']),
144                  extra_run_opts('+RTS -K16m -RTS')],
145                 compile_and_run, [''])
146 test('conc020', only_compiler_types(['ghc']), compile_and_run, [''])
147 test('conc021', [ omit_ways(['ghci']), exit_code(1) ], compile_and_run, [''])
148 test('conc022', only_compiler_types(['ghc']), compile_and_run, [''])
149
150 # On Windows, the non-threaded RTS creates a real OS thread for each 
151 # threadDelay.  conc023 creates 5000 concurrent threadDelays, and the
152 # resulting creation of OS threads seems to cause the system to run
153 # out of memory sometimes (I'm not sure exactly how/why this happens,
154 # but the threaded RTS fixes it).  See #1197.
155 if config.platform == 'i386-unknown-mingw32':
156    conc023_ways = only_ways(['threaded1','threaded2'])
157 else:
158    conc023_ways = normal
159
160 test('conc023', [when(fast(), skip),
161                  only_compiler_types(['ghc']),
162                  reqlib('random'),
163                  conc023_ways], compile_and_run, [''])
164
165 test('conc024', only_compiler_types(['ghc']), compile_and_run, [''])
166 test('conc025', normal, compile_and_run, [''])
167 test('conc026', only_compiler_types(['ghc']), compile_and_run, [''])
168 test('conc028', normal, compile_and_run, [''])
169 test('conc029', normal, compile_and_run, [''])
170 test('conc030',
171      [only_compiler_types(['ghc']), extra_run_opts('+RTS -K4M -RTS')],
172                 compile_and_run, [''])
173
174 test('conc031', exit_code(1), compile_and_run, [''])
175
176 test('conc032', only_compiler_types(['ghc']), compile_and_run, [''])
177 test('conc033', normal, compile_and_run, [''])
178
179 # Omit for GHCi, because it just sits there waiting for you to press ^C
180 test('conc034', [only_compiler_types(['ghc']),
181                  omit_ways(['ghci']), 
182                  extra_run_opts('+RTS -C0 -RTS')],
183                 compile_and_run, [''])
184
185 test('conc035', only_compiler_types(['ghc']), compile_and_run, [''])
186
187 # conc036: now skipped entirely.  This test attempts to check that
188 # unsafe foreign calls block other threads, but doing that reliably is
189 # probably impossible.  The last straw was when it started failing on
190 # Windows around 7.4.x.
191 #
192 # OLD comments about hacks we tried to make it work:
193 #   Omit for GHCi: firstly GHCi doesn't have unsafe FFI calls, and secondly
194 #   the main thread cannot receive the deadlock exception because it can be
195 #   woken up by ^C.
196 #   Omit for threaded2: this test is really bogus and fails to do anything
197 #   sensible for more than one CPU.
198 #
199 test('conc036', skip, compile_and_run, [''])
200
201
202 # Interrupting foreign calls only makes sense if we are threaded
203 test('foreignInterruptible', [when(fast(), skip),
204                               when(opsys('mingw32'),expect_fail),
205                               # I don't think we support interrupting Sleep()
206                               # on Windows.  --SDM
207                               only_threaded_ways,
208                               only_compiler_types(['ghc'])],
209       compile_and_run, [''])
210
211 test('conc037', only_ways(['threaded1','threaded2']), compile_and_run, [''])
212 test('conc038', only_ways(['threaded1','threaded2']), compile_and_run, [''])
213
214 # Omit for GHCi, uses foreign export
215 # Omit for the threaded ways, because in this case the main thread is allowed to 
216 # complete, which causes the child thread to be interrupted.
217 test('conc039', omit_ways(['ghci','threaded1','threaded2','profthreaded']), compile_and_run, [''])
218
219 # Omit for GHCi, uses foreign export
220 test('conc040',
221      [only_compiler_types(['ghc']), exit_code(1), omit_ways(['ghci'])],
222                 compile_and_run, [''])
223
224 # STM-related tests.
225 test('conc041', only_compiler_types(['ghc']), compile_and_run, [''])
226 test('conc042', only_compiler_types(['ghc']), compile_and_run, [''])
227 test('conc043', only_compiler_types(['ghc']), compile_and_run, [''])
228 test('conc044', only_compiler_types(['ghc']), compile_and_run, [''])
229 test('conc045', only_compiler_types(['ghc']), compile_and_run, [''])
230
231 test('conc058', only_compiler_types(['ghc']), compile_and_run, [''])
232
233 test('conc059',
234      [only_compiler_types(['ghc']),
235       only_ways(['threaded1','threaded2']),
236       pre_cmd('$MAKE -s --no-print-directory conc059_setup'),
237       extra_clean(['conc059_c.o'])],
238      compile_and_run,
239      ['conc059_c.c -no-hs-main'])
240
241 # This test sometimes just exits successfully
242 # when run the threaded2 way. The problem hasn't been diagnosed yet
243 test('conc064',
244      exit_code(1),
245      compile_and_run, [''])
246
247 test('conc065', ignore_output, compile_and_run, [''])
248 test('conc066', ignore_output, compile_and_run, [''])
249 test('conc067', ignore_output, compile_and_run, [''])
250
251 # omit threaded2, the behaviour of this test is non-deterministic with more
252 # than one CPU.
253 test('conc068', [ omit_ways('threaded2'), exit_code(1) ], compile_and_run, [''])
254
255 if (ghc_with_smp == 0):
256    skip_if_not_smp = skip
257 else:
258    skip_if_not_smp = normal
259
260 test('setnumcapabilities001',
261      [ only_ways(['threaded1','threaded2']),
262        extra_run_opts('4 12 2000'),
263        reqlib('parallel'),
264        skip_if_not_smp ],
265      compile_and_run, [''])
266
267 # omit ghci, which can't handle unboxed tuples:
268 test('compareAndSwap', [omit_ways(['ghci','hpc']), reqlib('primitive')], compile_and_run, [''])
269