users_guide: Various spelling fixes
[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
6 # See bug #101, test requires +RTS -c (or equivalently +RTS -M<something>)
7 # only GHCi triggers the bug, but we run the test all ways for completeness.
8 test('bug1010', normal, compile_and_run, ['+RTS -c -RTS'])
9 test('derefnull',
10      [# LLVM Optimiser considers dereference of a null pointer
11       # undefined and marks the code as unreachable which means
12       # that later optimisations remove it altogether.
13       omit_ways(['optllvm']),
14       # SIGSEGV on Linux (which we make the default)
15       exit_code(139),
16       # Apparently the output can be different on different
17       # Linux setups, so just ignore it. As long as we get
18       # the right exit code we're OK.
19       when(opsys('linux'), ignore_output),
20       # SIGBUS on OX X (PPC and x86 only; amd64 gives SEGV)
21       when(platform('i386-apple-darwin'), exit_code(138)),
22       when(platform('powerpc-apple-darwin'), exit_code(138)),
23       when(opsys('mingw32'), exit_code(1)),
24       # since these test are supposed to crash the
25       # profile report will be empty always.
26       # so disable the check for profiling
27       when(opsys('mingw32'), omit_ways(prof_ways))],
28      compile_and_run, [''])
29 test('divbyzero',
30      [# SIGFPE on Linux
31       exit_code(136),
32       # Apparently the output can be different on different
33       # Linux setups, so just ignore it. As long as we get
34       # the right exit code we're OK.
35       when(opsys('linux'), ignore_output),
36       when(opsys('mingw32'), exit_code(1)),
37       # since these test are supposed to crash the
38       # profile report will be empty always.
39       # so disable the check for profiling
40       when(opsys('mingw32'), omit_ways(prof_ways))],
41      compile_and_run, [''])
42
43 test('outofmem', when(opsys('darwin'), skip), 
44                  run_command, ['$MAKE -s --no-print-directory outofmem'])
45 test('outofmem2', extra_run_opts('+RTS -M5m -RTS'),
46                   run_command, ['$MAKE -s --no-print-directory outofmem2'])
47
48 test('T2047', [ignore_output, extra_run_opts('+RTS -c -RTS')],
49               compile_and_run, ['-package containers'])
50
51 # Blackhole-detection test.
52 # Skip GHCi due to #2786
53 test('T2783', [ omit_ways(['ghci']), exit_code(1) ], compile_and_run, [''])
54
55 # Test the work-stealing deque implementation.  We run this test in
56 # both threaded1 (-threaded -debug) and threaded2 (-threaded) ways.
57 test('testwsdeque', [unless(in_tree_compiler(), skip),
58                     req_smp, # needs atomic 'cas'
59                     c_src, only_ways(['threaded1', 'threaded2'])],
60                     compile_and_run, ['-I../../../rts'])
61
62 test('T3236', [c_src, only_ways(['normal','threaded1']), exit_code(1)], compile_and_run, [''])
63
64 test('stack001', extra_run_opts('+RTS -K32m -RTS'), compile_and_run, [''])
65 test('stack002', extra_run_opts('+RTS -K32m -k4m -RTS'), compile_and_run, [''])
66
67 # run this test with very small stack chunks to exercise the stack
68 # overflow/underflow machinery.
69 test('stack003', [ omit_ways('ghci'), # uses unboxed tuples
70                    extra_run_opts('500000 +RTS -kc1k -kb100 -K96m -RTS') ],
71                  compile_and_run, [''])
72
73 test('atomicinc', [ c_src, only_ways(['normal','threaded1', 'threaded2']) ], compile_and_run, [''])
74
75 test('T3424', # it's slow:
76               [ when(fast(), skip), only_ways(['normal','threaded1','ghci']) ],
77               compile_and_run, [''])
78
79 # Test for out-of-range heap size
80 test('rtsflags001', [ only_ways(['normal']), exit_code(1), extra_run_opts('+RTS -H0m -RTS') ], compile_and_run, [''])
81
82 # Crashed with 7.2 and earlier
83 test('rtsflags002', [ only_ways(['normal']) ], compile_and_run, ['-with-rtsopts="-B -B -B"'])
84
85 # Test to see if linker scripts link properly to real ELF files
86 test('T2615',
87      [ when(opsys('mingw32'), skip),
88        # OS X doesn't seem to support linker scripts
89        when(opsys('darwin'), skip),
90        # Solaris' linker does not support GNUish linker scripts
91        when(opsys('solaris2'), skip),
92        pre_cmd('$MAKE -s --no-print-directory T2615-prep'),
93        # Add current directory to dlopen search path
94        cmd_prefix('LD_LIBRARY_PATH=$LD_LIBRARY_PATH:. '),
95        extra_clean(['libfoo_T2615.so', 'libfoo_T2615.o'])],
96      compile_and_run,
97      ['-package ghc'])
98
99 # omit dyn and profiling ways, because we don't build dyn_l or p_l
100 # variants of the RTS by default
101 test('traceEvent', [ omit_ways(['dyn'] + prof_ways), 
102                      extra_run_opts('+RTS -ls -RTS') ], 
103                    compile_and_run, ['-eventlog'])
104
105 test('T4059',
106      extra_clean(['T4059_c.o']),
107      run_command,
108      ['$MAKE -s --no-print-directory T4059'])
109
110 # Test for #4274
111 test('exec_signals', [
112      when(opsys('mingw32'), skip),
113      pre_cmd('$MAKE -s --no-print-directory exec_signals-prep'),
114      cmd_prefix('./exec_signals_prepare'),
115      extra_clean(['exec_signals_child', 'exec_signals_prepare'])
116     ], compile_and_run, [''])
117
118 test('return_mem_to_os', normal, compile_and_run, [''])
119
120 test('T4850', when(opsys('mingw32'), expect_broken(4850)), run_command, ['$MAKE -s --no-print-directory T4850'])
121
122 def config_T5250(name, opts):
123     if not (config.arch in ['i386','x86_64']):
124         opts.skip = 1;
125
126 test('T5250', [ config_T5250,
127                 # stack ptr is not 16-byte aligned on 32-bit Windows
128                 when(platform('i386-unknown-mingw32'), expect_fail),
129                 when(platform('i386-unknown-linux'),
130                             expect_broken_for(4211,['llvm'])),
131                 extra_clean(['spalign.o']),
132                 omit_ways(['ghci']) ],
133               compile_and_run, ['spalign.c'])
134
135 test('T5423',
136      extra_clean(['T5423_cmm.o']),
137      run_command,
138      ['$MAKE -s --no-print-directory T5423'])
139
140 # Workaround bug #8458: old dlopen opens sections in the wrong order,
141 # so we just accept both orders.
142 def checkDynAsm(actual_file, normaliser):
143     actual_raw = read_no_crs(actual_file)
144     actual_str = normaliser(actual_raw)
145     actual = actual_str.split()
146     if actual == ['initArray1', 'initArray2', 'ctors1', 'ctors2', 'success']:
147         return 1
148     elif actual == ['ctors1', 'ctors2', 'initArray1', 'initArray2', 'success']:
149         if_verbose(1, 'T5435_dyn_asm detected old-style dlopen, see #8458')
150         return 1
151     elif opsys('darwin') and actual == ['modInitFunc1', 'modInitFunc2', 'success']:
152         return 1
153     elif opsys('mingw32') and actual == ['ctors1', 'ctors2', 'success']:
154         return 1
155     else:
156         if_verbose(1, 'T5435_dyn_asm failed with %s, see all.T for details' % actual)
157         return 0
158
159 # These should have extra_clean() arguments, but I need
160 # to somehow extract out the name of DLLs to do that
161
162 test('T5435_v_asm', normal, run_command, ['$MAKE -s --no-print-directory T5435_v_asm'])
163 test('T5435_v_gcc', normal, run_command, ['$MAKE -s --no-print-directory T5435_v_gcc'])
164 test('T5435_dyn_asm', check_stdout(checkDynAsm), run_command, ['$MAKE -s --no-print-directory T5435_dyn_asm'])
165 test('T5435_dyn_gcc', normal , run_command, ['$MAKE -s --no-print-directory T5435_dyn_gcc'])
166
167 test('T5993', extra_run_opts('+RTS -k8 -RTS'), compile_and_run, [''])
168
169 test('T6006', [ omit_ways(prof_ways + ['ghci']),
170                  extra_clean(['T6006_c.o']),
171                  pre_cmd('$MAKE -s --no-print-directory T6006_setup') ],
172                  # The T6006_setup hack is to ensure that we generate
173                  # T6006_stub.h before compiling T6006_c.c, which
174                  # needs it.
175                compile_and_run, ['T6006_c.c -no-hs-main'])
176
177 test('T7037',
178      [ extra_clean(['T7037_main.o','T7037_main']) ],
179      run_command,
180      ['$MAKE -s --no-print-directory T7037'])
181
182 test('T7087', exit_code(1), compile_and_run, [''])
183 test('T7160', normal, compile_and_run, [''])
184
185 test('T7040', [ extra_clean(['T7040_c.o']), omit_ways(['ghci']) ],
186      compile_and_run, ['T7040_c.c'])
187
188 test('T7040_ghci', [ only_ways(['ghci']),
189                       pre_cmd('$MAKE -s --no-print-directory T7040_ghci_setup'),
190                       extra_clean(['T7040_ghci_c.o']) ],
191                     compile_and_run, ['T7040_ghci_c.o'])
192
193 test('T7227', [ extra_run_opts('+RTS -tT7227.stat --machine-readable -RTS'),
194                 extra_clean(['T7227.stat']) ]
195             , compile_and_run, [''] )
196
197 test('T7636', [ exit_code(1), extra_run_opts('100000') ], compile_and_run, [''] )
198
199 test('stablename001', expect_fail_for(['hpc']), compile_and_run, [''])
200 # hpc should fail this, because it tags every variable occurrence with
201 # a different tick.  It's probably a bug if it works, hence expect_fail.
202
203 test('T7815', [ multi_cpu_race,
204                 extra_run_opts('50000 +RTS -N2 -RTS'),
205                 req_smp,
206                 only_ways(['threaded1', 'threaded2']) ], compile_and_run, [''] )
207
208 # ignore_output because it contains a unique:
209 #   ffishutdown: Main_dul: interrupted
210 test('ffishutdown', [ ignore_output, only_ways(['threaded1','threaded2']) ], compile_and_run, [''])
211
212 test('T7919', [extra_clean(['T7919A.o','T7919A.hi',
213                             'T7919A.dyn_o','T7919A.dyn_hi']),
214                when(fast(),skip) ],
215              compile_and_run, [config.ghc_th_way_flags])
216
217 test('T8035', normal, compile_and_run, [''])
218
219 test('linker_unload',
220      [ extra_clean(['Test.o','Test.hi', 'linker_unload']) ],
221      run_command,
222      ['$MAKE -s --no-print-directory linker_unload'])
223
224 test('T8209', [ only_ways(threaded_ways), ignore_output ],
225               compile_and_run, [''])
226
227 test('T8242', [ only_ways(threaded_ways), ignore_output ],
228               compile_and_run, [''])
229
230 test('T8124', [ only_ways(threaded_ways), omit_ways(['ghci']),
231                  when(opsys('mingw32'), skip), # uses pthreads
232                  extra_clean(['T8124_c.o']),
233                  pre_cmd('$MAKE -s --no-print-directory T8124_setup') ],
234                  # The T8124_setup hack is to ensure that we generate
235                  # T8124_stub.h before compiling T8124_c.c, which
236                  # needs it.
237                compile_and_run, ['T8124_c.c -no-hs-main'])
238
239 # +RTS -A8k makes it fail faster
240 # The ghci way gets confused by the RTS options
241 test('T9045', [ omit_ways(['ghci']), extra_run_opts('10000 +RTS -A8k -RTS') ], compile_and_run, [''])
242
243 # I couldn't reproduce 9078 with the -threaded runtime, but could easily
244 # with the non-threaded one.
245 test('T9078', [ omit_ways(threaded_ways) ], compile_and_run, ['-with-rtsopts="-DS" -debug'])
246
247 test('T10017', [ when(opsys('mingw32'), skip)
248                , only_ways(threaded_ways), extra_run_opts('+RTS -N2 -RTS') ], compile_and_run, [''])
249
250 test('rdynamic', [ unless(opsys('linux') or opsys('mingw32'), skip)
251                  , when(opsys('mingw32'), expect_broken(9381))
252                  # this needs runtime infrastructure to do in ghci:
253                  #  '-rdynamic' ghc, load modules only via dlopen(RTLD_BLOBAL) and more.
254                  , omit_ways(['ghci'])
255                  ],
256      compile_and_run, ['-rdynamic -package ghc'])
257
258 test('GcStaticPointers',
259      [ when(compiler_lt('ghc', '7.9'), skip)
260      , when(doing_ghci(), extra_hc_opts('-fobject-code'))
261      ],
262      compile_and_run, [''])
263 test('ListStaticPointers',
264      [ when(compiler_lt('ghc', '7.9'), skip)
265      , when(doing_ghci(), extra_hc_opts('-fobject-code'))
266      ],
267      compile_and_run, [''])
268
269 # 251 = RTS exit code for "out of memory"
270 test('overflow1', [ exit_code(251) ], compile_and_run, [''])
271 test('overflow2', [ exit_code(251) ], compile_and_run, [''])
272 test('overflow3', [ exit_code(251) ], compile_and_run, [''])
273
274 test('linker_error1',
275      [ extra_clean(['linker_error1.o','linker_error1']), ignore_output ],
276      run_command,
277      ['$MAKE -s --no-print-directory linker_error1'])
278
279 test('linker_error2',
280      [ extra_clean(['linker_error2.o','linker_error2_c.o', 'linker_error2']),
281        ignore_output ],
282      run_command,
283      ['$MAKE -s --no-print-directory linker_error2'])
284
285 test('linker_error3',
286      [ extra_clean(['linker_error3.o','linker_error3_c.o', 'linker_error3']),
287        ignore_output ],
288      run_command,
289      ['$MAKE -s --no-print-directory linker_error3'])
290
291 test('T9839_01', [ no_stdin, ignore_output],
292                 run_command,
293                 ['{compiler} -e 1 +RTS -T-s 2>&1 | \
294                   grep "flag -T given an argument when none was expected: -T-s"'])
295
296 test('T9839_02', [ only_ways(prof_ways), ignore_output, exit_code(1), extra_run_opts('+RTS -Pax')],
297                 compile_and_run,
298                 [''])
299
300 test('T9839_03', [ only_ways(prof_ways), ignore_output, exit_code(1), extra_run_opts('+RTS -Px')],
301                 compile_and_run,
302                 [''])