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