all.T 4.14 KB
Newer Older
1 2
# Test for #1227, #1418

Simon Marlow's avatar
Simon Marlow committed
3
extra_prof_ways = ['prof', 'prof_hc_hb', 'prof_hb', 'prof_hd', 'prof_hy', 'prof_hr']
4 5

test('heapprof001',
6
     [only_ways(prof_ways),
7
      when(have_profiling(), extra_ways(extra_prof_ways)),
8
      extra_run_opts('7')],
9
     compile_and_run, [''])
Simon Marlow's avatar
Simon Marlow committed
10

11 12 13
test('heapprof002',
     [ pre_cmd('cp heapprof001.hs heapprof002.hs')
     , extra_clean(['heapprof002.hs'])
14
     , extra_ways(['normal_h'])
15 16 17 18
     , extra_run_opts('7')
     ],
     compile_and_run, [''])

19
test('T2592',
20
     [only_ways(['profasm']), req_profiling,
Simon Marlow's avatar
Simon Marlow committed
21 22
      extra_run_opts('+RTS -M1m -RTS'), exit_code(251)],
     compile_and_run, [''])
Ian Lynagh's avatar
Ian Lynagh committed
23 24 25 26

test('T3001',
     [only_ways(['prof_hb']), extra_ways(['prof_hb']), req_profiling],
     compile_and_run, [''])
Ian Lynagh's avatar
Ian Lynagh committed
27 28 29 30

test('T3001-2',
     [only_ways(['prof_hb']), extra_ways(['prof_hb']), req_profiling],
     compile_and_run, ['-package bytestring'])
31

Simon Marlow's avatar
Simon Marlow committed
32
test('scc001', [req_profiling,
Simon Marlow's avatar
Simon Marlow committed
33 34 35 36
                extra_ways(['prof']), only_ways(prof_ways),
                expect_broken_for(10037,['prof'])],
        # As with ioprof001, the unoptimised profile is different but
        # not badly wrong (CAF attribution is different).
Simon Marlow's avatar
Simon Marlow committed
37
     compile_and_run,
38
     ['-fno-state-hack -fno-full-laziness']) # Note [consistent stacks]
39

Simon Marlow's avatar
Simon Marlow committed
40
test('scc002', [req_profiling,
Simon Marlow's avatar
Simon Marlow committed
41
                extra_ways(['prof']), only_ways(prof_ways)],
Simon Marlow's avatar
Simon Marlow committed
42 43 44 45
     compile_and_run,
     [''])

test('scc003', [req_profiling,
Simon Marlow's avatar
Simon Marlow committed
46
                extra_ways(['prof']), only_ways(prof_ways)],
Simon Marlow's avatar
Simon Marlow committed
47 48
     compile_and_run,
     ['-fno-state-hack']) # Note [consistent stacks]
Simon Marlow's avatar
Simon Marlow committed
49

50
test('scc004', [req_profiling,
Simon Marlow's avatar
Simon Marlow committed
51
                extra_ways(['prof']), only_ways(prof_ways),
52 53 54 55
                expect_broken(5654)],
     compile_and_run,
     [''])

Simon Marlow's avatar
Simon Marlow committed
56 57 58 59 60
test('scc005', [req_profiling,
                extra_ways(['prof']), only_ways(prof_ways)],
     compile_and_run,
     [''])

61
test('T5314',
Simon Marlow's avatar
Simon Marlow committed
62
     [ only_ways(prof_ways),
Simon Marlow's avatar
Simon Marlow committed
63 64 65 66 67 68
       extra_ways(extra_prof_ways),
       req_profiling ],
     compile_and_run,
     [''])

test('T680',
Simon Marlow's avatar
Simon Marlow committed
69
     [ req_profiling, extra_ways(['prof']), only_ways(prof_ways) ],
Simon Marlow's avatar
Simon Marlow committed
70 71 72 73
     compile_and_run,
     ['-fno-full-laziness']) # Note [consistent stacks]

test('T2552',
Simon Marlow's avatar
Simon Marlow committed
74 75
     [ req_profiling, extra_ways(['prof']), only_ways(prof_ways),
       expect_broken_for(10037,['prof'])],
Simon Marlow's avatar
Simon Marlow committed
76 77 78 79
     compile_and_run,
     [''])

test('T949',
Simon Marlow's avatar
Simon Marlow committed
80
     [ req_profiling, extra_ways(extra_prof_ways), only_ways(prof_ways) ],
Simon Marlow's avatar
Simon Marlow committed
81 82
     compile_and_run,
     [''])
Simon Marlow's avatar
Simon Marlow committed
83 84

test('ioprof',
Simon Marlow's avatar
Simon Marlow committed
85
     [ req_profiling, extra_ways(['prof']), only_ways(prof_ways),
Simon Marlow's avatar
Simon Marlow committed
86
       expect_broken_for(10037,['prof']),
87 88 89
        # The results for 'prof' are fine, but the ordering changes.
        # We care more about getting the optimised results right, so ignoring
        # this for now.
Simon Marlow's avatar
Simon Marlow committed
90 91 92 93 94 95 96
       exit_code(1) ],
     compile_and_run,
     ['-fno-full-laziness -fno-state-hack']) # Note [consistent stacks]

# These two examples are from the User's Guide:

test('prof-doc-fib',
Simon Marlow's avatar
Simon Marlow committed
97
     [ req_profiling, extra_ways(['prof']), only_ways(prof_ways) ],
Simon Marlow's avatar
Simon Marlow committed
98 99 100 101
     compile_and_run,
     [''])

test('prof-doc-last',
Simon Marlow's avatar
Simon Marlow committed
102
     [ req_profiling, extra_ways(['prof']), only_ways(prof_ways) ],
Simon Marlow's avatar
Simon Marlow committed
103
     compile_and_run,
104
     ['-fno-full-laziness'])
Simon Marlow's avatar
Simon Marlow committed
105

106
test('T5559', # unicode in cost centre names
Simon Marlow's avatar
Simon Marlow committed
107
     [ req_profiling, extra_ways(['prof']), only_ways(prof_ways) ],
108 109 110
     compile_and_run,
     [''])

Simon Marlow's avatar
Simon Marlow committed
111 112 113 114 115 116 117 118
# Note [consistent stacks]
#  Certain optimisations can change the stacks we get out of the
#  profiler.  These flags are necessary (but perhaps not sufficient)
#  to get consistent stacks:
#
#       -fno-state-hack
#       -fno-full-laziness

Ian Lynagh's avatar
Ian Lynagh committed
119
test('callstack001',
Simon Marlow's avatar
Simon Marlow committed
120 121 122
     [ req_profiling, extra_ways(['prof']), only_ways(prof_ways),
       expect_broken_for(10037,['prof'])],
     # unoptimised results are different w.r.t. CAF attribution
123
     compile_and_run, ['-fprof-auto-calls -fno-full-laziness -fno-state-hack'])
124

125 126
test('callstack002',
     [ req_profiling, extra_ways(['prof']), only_ways(prof_ways) ],
127
     compile_and_run, ['-fprof-auto-calls -fno-full-laziness -fno-state-hack'])
Simon Marlow's avatar
Simon Marlow committed
128 129 130 131 132 133

# Should not stack overflow with -prof -auto-all
test('T5363',
     [ req_profiling, extra_ways(['prof']), only_ways(prof_ways) ],
     compile_and_run, [''])

134 135 136
test('profinline001',
    [ req_profiling, extra_ways(['prof']), only_ways(prof_ways) ],
    compile_and_run, [''])