all.T 18.2 KB
Newer Older
1
test('testblockalloc',
2
     [c_src, only_ways(['normal','threaded1']), extra_run_opts('+RTS -I0')],
3
     compile_and_run, [''])
Simon Marlow's avatar
Simon Marlow committed
4

5
test('testmblockalloc',
6
     [c_src, only_ways(['normal','threaded1']), extra_run_opts('+RTS -I0')],
7 8 9 10 11
     compile_and_run, [''])
# -I0 is important: the idle GC will run the memory leak detector,
# which will crash because the mblocks we allocate are not in a state
# the leak detector is expecting.

Simon Marlow's avatar
Simon Marlow committed
12 13 14 15

# See bug #101, test requires +RTS -c (or equivalently +RTS -M<something>)
# only GHCi triggers the bug, but we run the test all ways for completeness.
test('bug1010', normal, compile_and_run, ['+RTS -c -RTS'])
16 17 18 19 20 21

def normalise_address(str):
    return re.sub('Access violation in generated code when reading [0]+',
                  'Access violation in generated code when reading ADDRESS',
                  str)

22
test('derefnull',
23
     [# LLVM Optimiser considers dereference of a null pointer
24 25 26 27 28 29 30 31
      # undefined and marks the code as unreachable which means
      # that later optimisations remove it altogether.
      omit_ways(['optllvm']),
      # SIGSEGV on Linux (which we make the default)
      exit_code(139),
      # Apparently the output can be different on different
      # Linux setups, so just ignore it. As long as we get
      # 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 35 36 37
      # The output under OS X is too unstable to readily compare
      when(platform('i386-apple-darwin'), [ignore_stderr, exit_code(139)]),
      when(platform('x86_64-apple-darwin'), [ignore_stderr, exit_code(139)]),
      when(platform('powerpc-apple-darwin'), [ignore_stderr, exit_code(139)]),
38
      when(opsys('mingw32'), [ignore_stderr, exit_code(11)]),
39 40 41 42
      # since these test are supposed to crash the
      # profile report will be empty always.
      # so disable the check for profiling
      when(opsys('mingw32'), omit_ways(prof_ways))],
43
     compile_and_run, ['-with-rtsopts="--generate-stack-traces=no"'])
44
test('divbyzero',
45
     [# SIGFPE on Linux
46 47 48 49
      exit_code(136),
      # Apparently the output can be different on different
      # Linux setups, so just ignore it. As long as we get
      # the right exit code we're OK.
50
      when(opsys('linux'), ignore_stderr),
51 52 53 54
      # PowerPC 64 bit and most likely PowerPC 32 bit processors
      # do not generate an exception (interrupt) for integer
      # division by zero but the result is undefined.
      # C programs compiled with gcc exit normally, so do we.
55 56
      when(platform('powerpc64-unknown-linux'), [ignore_stdout, exit_code(0)]),
      when(platform('powerpc64le-unknown-linux'), [ignore_stdout, exit_code(0)]),
57
      when(opsys('mingw32'), [ignore_stderr, exit_code(8)]),
58 59 60 61
      # The output under OS X is too unstable to readily compare
      when(platform('i386-apple-darwin'), [ignore_stderr, exit_code(136)]),
      when(platform('x86_64-apple-darwin'), [ignore_stderr, exit_code(136)]),
      when(platform('powerpc-apple-darwin'), [ignore_stderr, exit_code(136)]),
62 63 64 65
      # since these test are supposed to crash the
      # profile report will be empty always.
      # so disable the check for profiling
      when(opsys('mingw32'), omit_ways(prof_ways))],
66
     compile_and_run, ['-with-rtsopts="--generate-stack-traces=no"'])
Simon Marlow's avatar
Simon Marlow committed
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'])
Simon Marlow's avatar
Simon Marlow committed
71

72
test('T2047', [ignore_stdout, extra_run_opts('+RTS -c -RTS')],
73
              compile_and_run, ['-package containers'])
Simon Marlow's avatar
Simon Marlow committed
74 75 76

# Blackhole-detection test.
# Skip GHCi due to #2786
77 78 79
test('T2783', [ omit_ways(['ghci']), exit_code(1)
              , expect_broken_for(2783, ['threaded1'])
	      ], compile_and_run, [''])
80 81 82

# Test the work-stealing deque implementation.  We run this test in
# both threaded1 (-threaded -debug) and threaded2 (-threaded) ways.
83 84
test('testwsdeque', [extra_files(['../../../rts/WSDeque.h']),
                     unless(in_tree_compiler(), skip),
85
                    req_smp, # needs atomic 'cas'
86
                    c_src, only_ways(['threaded1', 'threaded2'])],
87
                    compile_and_run, [''])
Simon Marlow's avatar
Simon Marlow committed
88

89
test('T3236', [c_src, only_ways(['normal','threaded1']), exit_code(1)], compile_and_run, [''])
Simon Marlow's avatar
Simon Marlow committed
90 91

test('stack001', extra_run_opts('+RTS -K32m -RTS'), compile_and_run, [''])
92 93 94
test('stack002', [extra_files(['stack001.hs']),
                  extra_run_opts('+RTS -K32m -k4m -RTS')],
     compile_and_run, [''])
95

96 97 98 99 100 101
# run this test with very small stack chunks to exercise the stack
# overflow/underflow machinery.
test('stack003', [ omit_ways('ghci'), # uses unboxed tuples
                   extra_run_opts('500000 +RTS -kc1k -kb100 -K96m -RTS') ],
                 compile_and_run, [''])

Ben Gamari's avatar
Ben Gamari committed
102
# Test that +RTS -K0 (e.g. no stack limit) parses correctly
103 104 105
test('stack004', [ extra_run_opts('+RTS -K0 -RTS')
		 , expect_broken_for(14913, ['ghci'])
		 ], compile_and_run, [''])
Ben Gamari's avatar
Ben Gamari committed
106

Simon Marlow's avatar
Simon Marlow committed
107
test('atomicinc', [ c_src, only_ways(['normal','threaded1', 'threaded2']) ], compile_and_run, [''])
108 109
test('atomicxchg', [ c_src, only_ways(['threaded1', 'threaded2']) ],
compile_and_run, [''])
Simon Marlow's avatar
Simon Marlow committed
110

111
test('T3424', # it's slow:
ian@well-typed.com's avatar
ian@well-typed.com committed
112
              [ when(fast(), skip), only_ways(['normal','threaded1','ghci']) ],
113
              compile_and_run, [''])
Simon Marlow's avatar
Simon Marlow committed
114 115

# Test for out-of-range heap size
116
test('rtsflags001', [ only_ways(['normal']), exit_code(1), extra_run_opts('+RTS -H0m -RTS') ], compile_and_run, [''])
117

118 119 120
# Crashed with 7.2 and earlier
test('rtsflags002', [ only_ways(['normal']) ], compile_and_run, ['-with-rtsopts="-B -B -B"'])

121
# Test to see if linker scripts link properly to real ELF files
Ian Lynagh's avatar
Ian Lynagh committed
122
test('T2615',
123 124
     [extra_files(['libfoo_T2615.c', 'libfoo_script_T2615.so']),
       when(opsys('mingw32'), skip),
125
       # OS X doesn't seem to support linker scripts
126
       when(opsys('darwin'), skip),
127
       # Solaris' linker does not support GNUish linker scripts
128
       when(opsys('solaris2'), skip),
ian@well-typed.com's avatar
ian@well-typed.com committed
129 130 131
       pre_cmd('$MAKE -s --no-print-directory T2615-prep'),
       # Add current directory to dlopen search path
       cmd_prefix('LD_LIBRARY_PATH=$LD_LIBRARY_PATH:. '),
132
       extra_clean(['libfoo_T2615.so', 'libfoo_T2615.o'])],
Ian Lynagh's avatar
Ian Lynagh committed
133 134 135
     compile_and_run,
     ['-package ghc'])

136 137
# omit dyn and profiling ways, because we don't build dyn_l or p_l
# variants of the RTS by default
138 139
test('traceEvent', [ omit_ways(['dyn'] + prof_ways),
                     extra_run_opts('+RTS -ls -RTS') ],
140
                   compile_and_run, ['-eventlog'])
Ian Lynagh's avatar
Ian Lynagh committed
141

142 143 144 145
test('traceBinaryEvent', [ omit_ways(['dyn'] + prof_ways),
                           extra_run_opts('+RTS -ls -RTS') ],
                         compile_and_run, ['-eventlog'])

146
test('T4059', [], run_command, ['$MAKE -s --no-print-directory T4059'])
Simon Marlow's avatar
Simon Marlow committed
147

148
# Test for #4274
149 150 151 152 153
test('exec_signals',
     [when(opsys('mingw32'), skip),
      pre_cmd('$MAKE -s --no-print-directory exec_signals-prep'),
      cmd_prefix('./exec_signals_prepare')],
     compile_and_run, [''])
154 155

test('return_mem_to_os', normal, compile_and_run, [''])
Simon Marlow's avatar
Simon Marlow committed
156

157
test('T4850', when(opsys('mingw32'), expect_broken(4850)), run_command, ['$MAKE -s --no-print-directory T4850'])
158

159
def config_T5250(name, opts):
160 161 162
    if not (config.arch in ['i386','x86_64']):
        opts.skip = 1;

163 164
test('T5250', [extra_files(['spalign.c']),
                config_T5250,
165
                # stack ptr is not 16-byte aligned on 32-bit Windows
166 167
                when(platform('i386-unknown-mingw32'), expect_fail),
                when(platform('i386-unknown-linux'),
168 169 170 171
                            expect_broken_for(4211,['llvm'])),
                extra_clean(['spalign.o']),
                omit_ways(['ghci']) ],
              compile_and_run, ['spalign.c'])
172

173
test('T5423', [], run_command, ['$MAKE -s --no-print-directory T5423'])
Ian Lynagh's avatar
Ian Lynagh committed
174

175 176 177 178 179 180
# Workaround bug #8458: old dlopen opens sections in the wrong order,
# so we just accept both orders.
def checkDynAsm(actual_file, normaliser):
    actual_raw = read_no_crs(actual_file)
    actual_str = normaliser(actual_raw)
    actual = actual_str.split()
181
    if actual == ['initArray1', 'initArray2', 'success']:
182
        return True
183
    elif opsys('darwin') and actual == ['modInitFunc1', 'modInitFunc2', 'success']:
184
        return True
185
    elif opsys('mingw32') and actual == ['ctors1', 'ctors2', 'success']:
186
        return True
187 188
    else:
        if_verbose(1, 'T5435_dyn_asm failed with %s, see all.T for details' % actual)
189
        return False
190

191 192 193 194 195
# T5435_v_asm got split into two tests because depending
# on the linker, .init_array and .ctors sections are loaded
# in a different order (but all entries within a section
# do get loaded in a deterministic order). So we test each
# separately now.
196 197
# These should have extra_clean() arguments, but I need
# to somehow extract out the name of DLLs to do that
198
test('T5435_v_asm_a', [extra_files(['T5435.hs', 'T5435_asm.c']),
199 200
                     when(arch('powerpc64') or arch('powerpc64le'),
                          expect_broken(11259))],
201 202 203 204
     run_command, ['$MAKE -s --no-print-directory T5435_v_asm_a'])
# this one just needs to run on linux, as darwin/mingw32 are covered
# by the _a test already.
test('T5435_v_asm_b', [extra_files(['T5435.hs', 'T5435_asm.c']),
205 206
                      when(arch('powerpc64') or arch('powerpc64le'),
                          expect_broken(11259)),
207 208
		      when(opsys('darwin') or opsys('mingw32'), skip)],
     run_command, ['$MAKE -s --no-print-directory T5435_v_asm_b'])
209 210 211
test('T5435_v_gcc', [extra_files(['T5435.hs', 'T5435_gcc.c']),
                     when(arch('powerpc64') or arch('powerpc64le'),
                          expect_broken(11259))],
212
     run_command, ['$MAKE -s --no-print-directory T5435_v_gcc'])
213 214 215
test('T5435_dyn_asm', [extra_files(['T5435.hs', 'T5435_asm.c']),
                       check_stdout(checkDynAsm)],
     run_command, ['$MAKE -s --no-print-directory T5435_dyn_asm'])
216
test('T5435_dyn_gcc', extra_files(['T5435.hs', 'T5435_gcc.c']) , run_command, ['$MAKE -s --no-print-directory T5435_dyn_gcc'])
217

218
test('T5993', extra_run_opts('+RTS -k8 -RTS'), compile_and_run, [''])
Simon Marlow's avatar
Simon Marlow committed
219

Simon Marlow's avatar
Simon Marlow committed
220
test('T6006', [ omit_ways(prof_ways + ['ghci']),
Simon Marlow's avatar
Simon Marlow committed
221
                 extra_clean(['T6006_c.o']),
ian@well-typed.com's avatar
ian@well-typed.com committed
222
                 pre_cmd('$MAKE -s --no-print-directory T6006_setup') ],
Simon Marlow's avatar
Simon Marlow committed
223 224 225 226 227
                 # The T6006_setup hack is to ensure that we generate
                 # T6006_stub.h before compiling T6006_c.c, which
                 # needs it.
               compile_and_run, ['T6006_c.c -no-hs-main'])

228
test('T7037', [], run_command, ['$MAKE -s --no-print-directory T7037'])
Simon Marlow's avatar
Simon Marlow committed
229

230
test('T7087', exit_code(1), compile_and_run, [''])
Simon Marlow's avatar
Simon Marlow committed
231
test('T7160', normal, compile_and_run, [''])
Simon Marlow's avatar
Simon Marlow committed
232

233
test('T7040', [omit_ways(['ghci'])], compile_and_run, ['T7040_c.c'])
Simon Marlow's avatar
Simon Marlow committed
234

235
test('T7040_ghci',
236 237
     [extra_files(['T7040_c.h']),
      only_ways(['ghci']),
238 239
      pre_cmd('$MAKE -s --no-print-directory T7040_ghci_setup')],
     compile_and_run, ['T7040_ghci_c.o'])
Simon Marlow's avatar
Simon Marlow committed
240

241 242
test('T7227', [extra_run_opts('+RTS -tT7227.stat --machine-readable -RTS')],
     compile_and_run, [''])
Simon Marlow's avatar
Simon Marlow committed
243 244

test('T7636', [ exit_code(1), extra_run_opts('100000') ], compile_and_run, [''] )
Simon Marlow's avatar
Simon Marlow committed
245 246 247 248

test('stablename001', expect_fail_for(['hpc']), compile_and_run, [''])
# hpc should fail this, because it tags every variable occurrence with
# a different tick.  It's probably a bug if it works, hence expect_fail.
ryates@cs.rochester.edu's avatar
ryates@cs.rochester.edu committed
249

250
test('T7815', [ multi_cpu_race,
ryates@cs.rochester.edu's avatar
ryates@cs.rochester.edu committed
251
                extra_run_opts('50000 +RTS -N2 -RTS'),
252
                req_smp,
ryates@cs.rochester.edu's avatar
ryates@cs.rochester.edu committed
253
                only_ways(['threaded1', 'threaded2']) ], compile_and_run, [''] )
254

255
# ignore_stderr because it contains a unique:
256
#   ffishutdown: Main_dul: interrupted
257 258
test('ffishutdown', [ignore_stderr, only_ways(['threaded1','threaded2'])],
     compile_and_run, [''])
Simon Marlow's avatar
Simon Marlow committed
259

260 261
test('T7919', [when(fast(), skip), omit_ways(prof_ways)], compile_and_run,
     [config.ghc_th_way_flags])
Simon Marlow's avatar
Simon Marlow committed
262

263
test('T8035', normal, compile_and_run, [''])
264 265

test('linker_unload',
266 267
     [extra_files(['LinkerUnload.hs', 'Test.hs']),
      when(arch('powerpc64') or arch('powerpc64le'), expect_broken(11259))],
268
     run_command, ['$MAKE -s --no-print-directory linker_unload'])
Simon Marlow's avatar
Simon Marlow committed
269

270
test('T8209', [ req_smp, only_ways(threaded_ways), ignore_stdout ],
Simon Marlow's avatar
Simon Marlow committed
271
              compile_and_run, [''])
aljee@hyper.cx's avatar
aljee@hyper.cx committed
272

273
test('T8242', [ req_smp, only_ways(threaded_ways), ignore_stdout ],
aljee@hyper.cx's avatar
aljee@hyper.cx committed
274
              compile_and_run, [''])
Simon Marlow's avatar
Simon Marlow committed
275

276
test('T8124', [ only_ways(threaded_ways), omit_ways(['ghci']),
277
                 when(opsys('mingw32'), skip), # uses pthreads
Simon Marlow's avatar
Simon Marlow committed
278 279 280 281 282 283
                 extra_clean(['T8124_c.o']),
                 pre_cmd('$MAKE -s --no-print-directory T8124_setup') ],
                 # The T8124_setup hack is to ensure that we generate
                 # T8124_stub.h before compiling T8124_c.c, which
                 # needs it.
               compile_and_run, ['T8124_c.c -no-hs-main'])
284 285 286 287 288

# +RTS -A8k makes it fail faster
# The ghci way gets confused by the RTS options
test('T9045', [ omit_ways(['ghci']), extra_run_opts('10000 +RTS -A8k -RTS') ], compile_and_run, [''])

289 290 291
# T9078 needs to be compiled with -debug, which threaded1 does for us.
# Assert failure is reproducible with ghc-7.8.2.
test('T9078', only_ways(['threaded1']), compile_and_run, [''])
292

293 294
test('T10017', [ when(opsys('mingw32'), skip)
               , only_ways(threaded_ways), extra_run_opts('+RTS -N2 -RTS') ], compile_and_run, [''])
AndreasVoellmy's avatar
AndreasVoellmy committed
295

296
test('T11108', normal, compile_and_run, [''])
Ben Gamari's avatar
Ben Gamari committed
297

298 299 300 301 302
test('rdynamic', [ unless(opsys('linux') or opsys('mingw32'), skip)
                 # this needs runtime infrastructure to do in ghci:
                 #  '-rdynamic' ghc, load modules only via dlopen(RTLD_BLOBAL) and more.
                 , omit_ways(['ghci'])
                 ],
303 304
     compile_and_run, ['-rdynamic -package ghc'])

305
test('GcStaticPointers', [when(doing_ghci(), extra_hc_opts('-fobject-code'))],
306
     compile_and_run, [''])
307
test('ListStaticPointers', [when(doing_ghci(), extra_hc_opts('-fobject-code'))],
308 309
     compile_and_run, [''])

310
# 251 = RTS exit code for "out of memory"
311 312
test('overflow1', [ exit_code(251), when(wordsize(32), expect_broken(15255)) ],
     compile_and_run, [''])
313 314
test('overflow2', [ exit_code(251) ], compile_and_run, [''])
test('overflow3', [ exit_code(251) ], compile_and_run, [''])
315

316 317
test('linker_error1', [extra_files(['linker_error.c']),
                       ignore_stderr], run_command,
318 319
     ['$MAKE -s --no-print-directory linker_error1'])

320 321
test('linker_error2', [extra_files(['linker_error.c']),
                       ignore_stderr], run_command,
322 323
     ['$MAKE -s --no-print-directory linker_error2'])

324 325
test('linker_error3', [extra_files(['linker_error.c']),
                       ignore_stderr], run_command,
326
     ['$MAKE -s --no-print-directory linker_error3'])
327

328 329 330 331 332 333 334 335 336 337 338
def grep_stderr(pattern):
    def wrapper(cmd, pattern=pattern):
        swap12 = '3>&1 1>&2 2>&3 3>&-' # Swap file descriptors 1 and 2.
        return('{cmd} {swap12} | grep "{pattern}" {swap12}'.format(**locals()))
    return cmd_wrapper(wrapper)

# The ghci way gets confused by the RTS options
test('T9839_01',
     [omit_ways(['ghci']), extra_run_opts('+RTS -T-s'), no_check_hp,
      grep_stderr('given an argument when none was expected')],
     compile_and_run, [''])
339

340 341 342 343
test('T9839_02',
     [only_ways(prof_ways), extra_run_opts('+RTS -Pax'), no_check_hp,
      grep_stderr('given an argument when none was expected')],
     compile_and_run, [''])
344

345 346 347 348
test('T9839_03',
     [only_ways(prof_ways), extra_run_opts('+RTS -Px'), no_check_hp,
      grep_stderr('given an argument when none was expected')],
     compile_and_run, [''])
349

350 351 352
test('T9839_04',
     [only_ways(prof_ways), extra_run_opts('+RTS -xc')],
     compile_and_run, [''])
353

354 355 356 357
test('T9839_05',
     [only_ways(prof_ways), extra_run_opts('+RTS -xcx'), no_check_hp,
      grep_stderr('given an argument when none was expected')],
     compile_and_run, [''])
358

359 360 361 362
test('T9839_06',
     [only_ways(prof_ways), extra_run_opts('+RTS -xtx'), no_check_hp,
      grep_stderr('given an argument when none was expected')],
     compile_and_run, [''])
363

364
# ignore_stderr as RTS reports slightly different error messages
365 366
# in 'epoll' and 'select' backends on reading from EBADF
# mingw32 skip as UNIX pipe and close(fd) is used to exercise the problem
367
test('T10590', [ignore_stderr, when(opsys('mingw32'), skip)], compile_and_run, [''])
368 369 370 371

# 20000 was easily enough to trigger the bug with 7.10
test('T10904', [ omit_ways(['ghci']), extra_run_opts('20000') ],
               compile_and_run, ['T10904lib.c'])
372

thomie's avatar
thomie committed
373 374
test('T10728', [extra_run_opts('+RTS -maxN3 -RTS'), only_ways(['threaded2'])],
               compile_and_run, [''])
375

376 377
test('T9405', [when(msys(), expect_broken(12714))], run_command,
     ['$MAKE -s --no-print-directory T9405'])
378

379 380 381
test('T11788', when(ghc_dynamic(), skip),
              run_command, ['$MAKE -s --no-print-directory T11788'])

382 383
test('T10296a', [req_smp], run_command,
     ['$MAKE -s --no-print-directory T10296a'])
384 385

test('T10296b', [only_ways('threaded2')], compile_and_run, [''])
Simon Marlow's avatar
Simon Marlow committed
386 387 388

test('numa001', [ extra_run_opts('8'), extra_ways(['debug_numa']) ]
                , compile_and_run, [''])
389

390 391 392
test('T12497', [ unless(opsys('mingw32'), skip)
               ],
               run_command, ['$MAKE -s --no-print-directory T12497'])
393

394 395
# This test sometimes produces out of sequence samples in the profasm way, but
# not reliably, so we just skip it. See ticket #15065.
396
# Test is being skipped on darwin due to it's flakiness.
397
test('T12903', [ when(opsys('mingw32'), skip)
398 399 400
               , when(opsys('darwin'), skip)
	           , omit_ways(['ghci', 'profasm'])]
	       , compile_and_run, [''])
401

402
test('T13832', exit_code(1), compile_and_run, ['-threaded'])
403
test('T13894', normal, compile_and_run, [''])
404 405
# this test fails with the profasm way on some machines but not others,
# so we just skip it.
406 407 408
test('T14497', [omit_ways(['profasm']), multi_cpu_race], compile_and_run, ['-O'])
test('T14695', [normal, ignore_stderr]
             , run_command, ['$MAKE -s --no-print-directory T14695'])
409 410 411 412 413
test('T14702', [ ignore_stdout
               , only_ways(['threaded1', 'threaded2'])
               , extra_run_opts('+RTS -A32m -N8 -T -RTS')
               ]
               , compile_and_run, [''])
414 415

test('T14900', normal, compile_and_run, ['-package ghc-compact'])
416 417
test('InternalCounters', normal, run_command,
  ['$MAKE -s --no-print-directory InternalCounters'])
418 419 420 421 422 423
test('alloccounter1', normal, compile_and_run,
  [
    # avoid allocating stack chunks, which counts as
    # allocation and messes up the results:
    '-with-rtsopts=-k1m'
  ])
424 425 426 427 428 429 430

test('nursery-chunks1',
  [ extra_run_opts('4 100 +RTS -n32k -A1m -RTS')
  , only_ways(['threaded1','threaded2'])
  ],
  compile_and_run,
  [''])