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