tests: remove extra_files.py (#12223)
[ghc.git] / testsuite / tests / rts / all.T
1 test('testblockalloc',
2      [c_src, only_ways(['normal','threaded1']), extra_run_opts('+RTS -I0')],
3      compile_and_run, [''])
4
5 test('testmblockalloc',
6      [c_src, only_ways(['normal','threaded1']), extra_run_opts('+RTS -I0')],
7      compile_and_run, [''])
8 # -I0 is important: the idle GC will run the memory leak detector,
9 # which will crash because the mblocks we allocate are not in a state
10 # the leak detector is expecting.
11
12
13 # See bug #101, test requires +RTS -c (or equivalently +RTS -M<something>)
14 # only GHCi triggers the bug, but we run the test all ways for completeness.
15 test('bug1010', normal, compile_and_run, ['+RTS -c -RTS'])
16
17 def normalise_address(str):
18     return re.sub('Access violation in generated code when reading [0]+',
19                   'Access violation in generated code when reading ADDRESS',
20                   str)
21
22 test('derefnull',
23      [# LLVM Optimiser considers dereference of a null pointer
24       # undefined and marks the code as unreachable which means
25       # that later optimisations remove it altogether.
26       omit_ways(['optllvm']),
27       # SIGSEGV on Linux (which we make the default)
28       exit_code(139),
29       # Apparently the output can be different on different
30       # Linux setups, so just ignore it. As long as we get
31       # the right exit code we're OK.
32       when(opsys('linux'), ignore_stderr),
33       # SIGBUS on OX X (PPC and x86 only; amd64 gives SEGV)
34       # The output under OS X is too unstable to readily compare
35       when(platform('i386-apple-darwin'), [ignore_stderr, exit_code(139)]),
36       when(platform('x86_64-apple-darwin'), [ignore_stderr, exit_code(139)]),
37       when(platform('powerpc-apple-darwin'), [ignore_stderr, exit_code(139)]),
38       when(opsys('mingw32'), [exit_code(1), normalise_fun(normalise_address)]),
39       # since these test are supposed to crash the
40       # profile report will be empty always.
41       # so disable the check for profiling
42       when(opsys('mingw32'), omit_ways(prof_ways))],
43      compile_and_run, [''])
44 test('divbyzero',
45      [# SIGFPE on Linux
46       exit_code(136),
47       # Apparently the output can be different on different
48       # Linux setups, so just ignore it. As long as we get
49       # the right exit code we're OK.
50       when(opsys('linux'), ignore_stderr),
51       # PowerPC 64 bit and most likely PowerPC 32 bit processors
52       # do not generate an exception (interrupt) for integer
53       # division by zero but the result is undefined.
54       # C programs compiled with gcc exit normally, so do we.
55       when(platform('powerpc64-unknown-linux'), [ignore_stdout, exit_code(0)]),
56       when(platform('powerpc64le-unknown-linux'), [ignore_stdout, exit_code(0)]),
57       when(opsys('mingw32'), exit_code(1)),
58       # The output under OS X is too unstable to readily compare
59       when(platform('i386-apple-darwin'), [ignore_stderr, exit_code(136)]),
60       when(platform('x86_64-apple-darwin'), [ignore_stderr, exit_code(136)]),
61       when(platform('powerpc-apple-darwin'), [ignore_stderr, exit_code(136)]),
62       # since these test are supposed to crash the
63       # profile report will be empty always.
64       # so disable the check for profiling
65       when(opsys('mingw32'), omit_ways(prof_ways))],
66      compile_and_run, [''])
67
68 test('outofmem', when(opsys('darwin'), skip),
69                  run_command, ['$MAKE -s --no-print-directory outofmem'])
70 test('outofmem2', normal, run_command, ['$MAKE -s --no-print-directory outofmem2'])
71
72 test('T2047', [ignore_stdout, extra_run_opts('+RTS -c -RTS')],
73               compile_and_run, ['-package containers'])
74
75 # Blackhole-detection test.
76 # Skip GHCi due to #2786
77 test('T2783', [ omit_ways(['ghci']), exit_code(1) ], compile_and_run, [''])
78
79 # Test the work-stealing deque implementation.  We run this test in
80 # both threaded1 (-threaded -debug) and threaded2 (-threaded) ways.
81 test('testwsdeque', [extra_files(['../../../rts/WSDeque.h']),
82                      unless(in_tree_compiler(), skip),
83                     req_smp, # needs atomic 'cas'
84                     c_src, only_ways(['threaded1', 'threaded2'])],
85                     compile_and_run, [''])
86
87 test('T3236', [c_src, only_ways(['normal','threaded1']), exit_code(1)], compile_and_run, [''])
88
89 test('stack001', extra_run_opts('+RTS -K32m -RTS'), compile_and_run, [''])
90 test('stack002', [extra_files(['stack001.hs']),
91                   extra_run_opts('+RTS -K32m -k4m -RTS')],
92      compile_and_run, [''])
93
94 # run this test with very small stack chunks to exercise the stack
95 # overflow/underflow machinery.
96 test('stack003', [ omit_ways('ghci'), # uses unboxed tuples
97                    extra_run_opts('500000 +RTS -kc1k -kb100 -K96m -RTS') ],
98                  compile_and_run, [''])
99
100 test('atomicinc', [ c_src, only_ways(['normal','threaded1', 'threaded2']) ], compile_and_run, [''])
101 test('atomicxchg', [ c_src, only_ways(['threaded1', 'threaded2']) ],
102 compile_and_run, [''])
103
104 test('T3424', # it's slow:
105               [ when(fast(), skip), only_ways(['normal','threaded1','ghci']) ],
106               compile_and_run, [''])
107
108 # Test for out-of-range heap size
109 test('rtsflags001', [ only_ways(['normal']), exit_code(1), extra_run_opts('+RTS -H0m -RTS') ], compile_and_run, [''])
110
111 # Crashed with 7.2 and earlier
112 test('rtsflags002', [ only_ways(['normal']) ], compile_and_run, ['-with-rtsopts="-B -B -B"'])
113
114 # Test to see if linker scripts link properly to real ELF files
115 test('T2615',
116      [extra_files(['libfoo_T2615.c', 'libfoo_script_T2615.so']),
117        when(opsys('mingw32'), skip),
118        # OS X doesn't seem to support linker scripts
119        when(opsys('darwin'), skip),
120        # Solaris' linker does not support GNUish linker scripts
121        when(opsys('solaris2'), skip),
122        pre_cmd('$MAKE -s --no-print-directory T2615-prep'),
123        # Add current directory to dlopen search path
124        cmd_prefix('LD_LIBRARY_PATH=$LD_LIBRARY_PATH:. '),
125        extra_clean(['libfoo_T2615.so', 'libfoo_T2615.o'])],
126      compile_and_run,
127      ['-package ghc'])
128
129 # omit dyn and profiling ways, because we don't build dyn_l or p_l
130 # variants of the RTS by default
131 test('traceEvent', [ omit_ways(['dyn'] + prof_ways),
132                      extra_run_opts('+RTS -ls -RTS') ],
133                    compile_and_run, ['-eventlog'])
134
135 test('T4059', [], run_command, ['$MAKE -s --no-print-directory T4059'])
136
137 # Test for #4274
138 test('exec_signals',
139      [when(opsys('mingw32'), skip),
140       pre_cmd('$MAKE -s --no-print-directory exec_signals-prep'),
141       cmd_prefix('./exec_signals_prepare')],
142      compile_and_run, [''])
143
144 test('return_mem_to_os', normal, compile_and_run, [''])
145
146 test('T4850', when(opsys('mingw32'), expect_broken(4850)), run_command, ['$MAKE -s --no-print-directory T4850'])
147
148 def config_T5250(name, opts):
149     if not (config.arch in ['i386','x86_64']):
150         opts.skip = 1;
151
152 test('T5250', [extra_files(['spalign.c']),
153                 config_T5250,
154                 # stack ptr is not 16-byte aligned on 32-bit Windows
155                 when(platform('i386-unknown-mingw32'), expect_fail),
156                 when(platform('i386-unknown-linux'),
157                             expect_broken_for(4211,['llvm'])),
158                 extra_clean(['spalign.o']),
159                 omit_ways(['ghci']) ],
160               compile_and_run, ['spalign.c'])
161
162 test('T5423', [], run_command, ['$MAKE -s --no-print-directory T5423'])
163
164 # Workaround bug #8458: old dlopen opens sections in the wrong order,
165 # so we just accept both orders.
166 def checkDynAsm(actual_file, normaliser):
167     actual_raw = read_no_crs(actual_file)
168     actual_str = normaliser(actual_raw)
169     actual = actual_str.split()
170     if actual == ['initArray1', 'initArray2', 'ctors1', 'ctors2', 'success']:
171         return 1
172     elif actual == ['ctors1', 'ctors2', 'initArray1', 'initArray2', 'success']:
173         if_verbose(1, 'T5435_dyn_asm detected old-style dlopen, see #8458')
174         return 1
175     elif opsys('darwin') and actual == ['modInitFunc1', 'modInitFunc2', 'success']:
176         return 1
177     elif opsys('mingw32') and actual == ['ctors1', 'ctors2', 'success']:
178         return 1
179     else:
180         if_verbose(1, 'T5435_dyn_asm failed with %s, see all.T for details' % actual)
181         return 0
182
183 # These should have extra_clean() arguments, but I need
184 # to somehow extract out the name of DLLs to do that
185
186 test('T5435_v_asm', [extra_files(['T5435.hs', 'T5435_asm.c']),
187                      when(arch('powerpc64') or arch('powerpc64le'),
188                           expect_broken(11259))],
189      run_command, ['$MAKE -s --no-print-directory T5435_v_asm'])
190 test('T5435_v_gcc', [extra_files(['T5435.hs', 'T5435_gcc.c']),
191                      when(arch('powerpc64') or arch('powerpc64le'),
192                           expect_broken(11259))],
193      run_command, ['$MAKE -s --no-print-directory T5435_v_gcc'])
194 test('T5435_dyn_asm', [extra_files(['T5435.hs', 'T5435_asm.c']),
195                        check_stdout(checkDynAsm)],
196      run_command, ['$MAKE -s --no-print-directory T5435_dyn_asm'])
197 test('T5435_dyn_gcc', extra_files(['T5435.hs', 'T5435_gcc.c']) , run_command, ['$MAKE -s --no-print-directory T5435_dyn_gcc'])
198
199 test('T5993', extra_run_opts('+RTS -k8 -RTS'), compile_and_run, [''])
200
201 test('T6006', [ omit_ways(prof_ways + ['ghci']),
202                  extra_clean(['T6006_c.o']),
203                  pre_cmd('$MAKE -s --no-print-directory T6006_setup') ],
204                  # The T6006_setup hack is to ensure that we generate
205                  # T6006_stub.h before compiling T6006_c.c, which
206                  # needs it.
207                compile_and_run, ['T6006_c.c -no-hs-main'])
208
209 test('T7037', [], run_command, ['$MAKE -s --no-print-directory T7037'])
210
211 test('T7087', exit_code(1), compile_and_run, [''])
212 test('T7160', normal, compile_and_run, [''])
213
214 test('T7040', [omit_ways(['ghci'])], compile_and_run, ['T7040_c.c'])
215
216 test('T7040_ghci',
217      [extra_files(['T7040_c.h']),
218       only_ways(['ghci']),
219       pre_cmd('$MAKE -s --no-print-directory T7040_ghci_setup')],
220      compile_and_run, ['T7040_ghci_c.o'])
221
222 test('T7227', [extra_run_opts('+RTS -tT7227.stat --machine-readable -RTS')],
223      compile_and_run, [''])
224
225 test('T7636', [ exit_code(1), extra_run_opts('100000') ], compile_and_run, [''] )
226
227 test('stablename001', expect_fail_for(['hpc']), compile_and_run, [''])
228 # hpc should fail this, because it tags every variable occurrence with
229 # a different tick.  It's probably a bug if it works, hence expect_fail.
230
231 test('T7815', [ multi_cpu_race,
232                 extra_run_opts('50000 +RTS -N2 -RTS'),
233                 req_smp,
234                 only_ways(['threaded1', 'threaded2']) ], compile_and_run, [''] )
235
236 # ignore_stderr because it contains a unique:
237 #   ffishutdown: Main_dul: interrupted
238 test('ffishutdown', [ignore_stderr, only_ways(['threaded1','threaded2'])],
239      compile_and_run, [''])
240
241 test('T7919', [when(fast(), skip), omit_ways(prof_ways)], compile_and_run,
242      [config.ghc_th_way_flags])
243
244 test('T8035', normal, compile_and_run, [''])
245
246 test('linker_unload',
247      [extra_files(['LinkerUnload.hs', 'Test.hs']),
248       when(arch('powerpc64') or arch('powerpc64le'), expect_broken(11259))],
249      run_command, ['$MAKE -s --no-print-directory linker_unload'])
250
251 test('T8209', [ req_smp, only_ways(threaded_ways), ignore_stdout ],
252               compile_and_run, [''])
253
254 test('T8242', [ req_smp, only_ways(threaded_ways), ignore_stdout ],
255               compile_and_run, [''])
256
257 test('T8124', [ only_ways(threaded_ways), omit_ways(['ghci']),
258                  when(opsys('mingw32'), skip), # uses pthreads
259                  extra_clean(['T8124_c.o']),
260                  pre_cmd('$MAKE -s --no-print-directory T8124_setup') ],
261                  # The T8124_setup hack is to ensure that we generate
262                  # T8124_stub.h before compiling T8124_c.c, which
263                  # needs it.
264                compile_and_run, ['T8124_c.c -no-hs-main'])
265
266 # +RTS -A8k makes it fail faster
267 # The ghci way gets confused by the RTS options
268 test('T9045', [ omit_ways(['ghci']), extra_run_opts('10000 +RTS -A8k -RTS') ], compile_and_run, [''])
269
270 # T9078 needs to be compiled with -debug, which threaded1 does for us.
271 # Assert failure is reproducible with ghc-7.8.2.
272 test('T9078', only_ways(['threaded1']), compile_and_run, [''])
273
274 test('T10017', [ when(opsys('mingw32'), skip)
275                , only_ways(threaded_ways), extra_run_opts('+RTS -N2 -RTS') ], compile_and_run, [''])
276
277 test('T11108', normal, compile_and_run, [''])
278
279 test('rdynamic', [ unless(opsys('linux') or opsys('mingw32'), skip)
280                  # this needs runtime infrastructure to do in ghci:
281                  #  '-rdynamic' ghc, load modules only via dlopen(RTLD_BLOBAL) and more.
282                  , omit_ways(['ghci'])
283                  ],
284      compile_and_run, ['-rdynamic -package ghc'])
285
286 test('GcStaticPointers', [when(doing_ghci(), extra_hc_opts('-fobject-code'))],
287      compile_and_run, [''])
288 test('ListStaticPointers', [when(doing_ghci(), extra_hc_opts('-fobject-code'))],
289      compile_and_run, [''])
290
291 # 251 = RTS exit code for "out of memory"
292 test('overflow1', [ exit_code(251) ], compile_and_run, [''])
293 test('overflow2', [ exit_code(251) ], compile_and_run, [''])
294 test('overflow3', [ exit_code(251) ], compile_and_run, [''])
295
296 test('linker_error1', [extra_files(['linker_error.c']),
297                        ignore_stderr], run_command,
298      ['$MAKE -s --no-print-directory linker_error1'])
299
300 test('linker_error2', [extra_files(['linker_error.c']),
301                        ignore_stderr], run_command,
302      ['$MAKE -s --no-print-directory linker_error2'])
303
304 test('linker_error3', [extra_files(['linker_error.c']),
305                        ignore_stderr], run_command,
306      ['$MAKE -s --no-print-directory linker_error3'])
307
308 def grep_stderr(pattern):
309     def wrapper(cmd, pattern=pattern):
310         swap12 = '3>&1 1>&2 2>&3 3>&-' # Swap file descriptors 1 and 2.
311         return('{cmd} {swap12} | grep "{pattern}" {swap12}'.format(**locals()))
312     return cmd_wrapper(wrapper)
313
314 # The ghci way gets confused by the RTS options
315 test('T9839_01',
316      [omit_ways(['ghci']), extra_run_opts('+RTS -T-s'), no_check_hp,
317       grep_stderr('given an argument when none was expected')],
318      compile_and_run, [''])
319
320 test('T9839_02',
321      [only_ways(prof_ways), extra_run_opts('+RTS -Pax'), no_check_hp,
322       grep_stderr('given an argument when none was expected')],
323      compile_and_run, [''])
324
325 test('T9839_03',
326      [only_ways(prof_ways), extra_run_opts('+RTS -Px'), no_check_hp,
327       grep_stderr('given an argument when none was expected')],
328      compile_and_run, [''])
329
330 test('T9839_04',
331      [only_ways(prof_ways), extra_run_opts('+RTS -xc')],
332      compile_and_run, [''])
333
334 test('T9839_05',
335      [only_ways(prof_ways), extra_run_opts('+RTS -xcx'), no_check_hp,
336       grep_stderr('given an argument when none was expected')],
337      compile_and_run, [''])
338
339 test('T9839_06',
340      [only_ways(prof_ways), extra_run_opts('+RTS -xtx'), no_check_hp,
341       grep_stderr('given an argument when none was expected')],
342      compile_and_run, [''])
343
344 # ignore_stderr as RTS reports slightly different error messages
345 # in 'epoll' and 'select' backends on reading from EBADF
346 # mingw32 skip as UNIX pipe and close(fd) is used to exercise the problem
347 test('T10590', [ignore_stderr, when(opsys('mingw32'), skip)], compile_and_run, [''])
348
349 # 20000 was easily enough to trigger the bug with 7.10
350 test('T10904', [ omit_ways(['ghci']), extra_run_opts('20000') ],
351                compile_and_run, ['T10904lib.c'])
352
353 test('T10728', [extra_run_opts('+RTS -maxN3 -RTS'), only_ways(['threaded2'])],
354                compile_and_run, [''])
355
356 test('T9405', [when(msys(), expect_broken(12714))], run_command,
357      ['$MAKE -s --no-print-directory T9405'])
358
359 test('T11788', when(ghc_dynamic(), skip),
360               run_command, ['$MAKE -s --no-print-directory T11788'])
361
362 test('T10296a', [req_smp], run_command,
363      ['$MAKE -s --no-print-directory T10296a'])
364
365 test('T10296b', [only_ways('threaded2')], compile_and_run, [''])
366
367 test('numa001', [ extra_run_opts('8'), extra_ways(['debug_numa']) ]
368                 , compile_and_run, [''])
369
370 test('T12497', [ unless(opsys('mingw32'), skip)
371                ],
372                run_command, ['$MAKE -s --no-print-directory T12497'])
373
374 test('T12903', [when(opsys('mingw32'), skip)], compile_and_run, [''])
375