Commit c6306140 authored by Peter Wortmann's avatar Peter Wortmann Committed by Austin Seipp

Debug test case and test suite way

Adds a test way for debug (-g -dannot-lint) as well as a test covering
basic source tick functionality.

The debug way fails for a number of test cases because of annotation
linting: Tracing simplification (e.g. rule firings) will see
duplicated output, and sometimes expression matching might take so
long that the test case timeouts. We blacklist these tests.

(From Phabricator D169)
parent f46aa733
......@@ -174,7 +174,8 @@ test('T8766',
test('T9111', normal, compile, [''])
test('T9395', normal, compile_and_run, [''])
test('T9532', normal, compile_and_run, [''])
# Fails for debug way due to annotation linting timeout
test('T9532', omit_ways(['debug']), compile_and_run, [''])
test('T9586', normal, compile, [''])
test('T9681', normal, compile_fail, [''])
test('T8089', normal, compile_and_run, [''])
......
......@@ -28,7 +28,8 @@ config.other_ways = ['prof',
'llvm', 'debugllvm',
'profllvm', 'profoptllvm', 'profthreadedllvm',
'threaded1llvm', 'threaded2llvm',
'dynllvm']
'dynllvm',
'debug']
if (ghc_with_native_codegen == 1):
config.compile_ways.append('optasm')
......@@ -104,6 +105,7 @@ config.way_flags = lambda name : {
'prof_hr' : ['-O', '-prof', '-static', '-auto-all'],
'dyn' : ['-O', '-dynamic'],
'static' : ['-O', '-static'],
'debug' : ['-O', '-g', '-dannot-lint'],
# llvm variants...
'profllvm' : ['-prof', '-static', '-auto-all', '-fllvm'],
'profoptllvm' : ['-O', '-prof', '-static', '-auto-all', '-fllvm'],
......@@ -136,6 +138,7 @@ config.way_rts_flags = {
'prof_hr' : ['-hr'],
'dyn' : [],
'static' : [],
'debug' : [],
# llvm variants...
'profllvm' : ['-p'],
'profoptllvm' : ['-hc', '-p'],
......
......@@ -5,3 +5,28 @@ include $(TOP)/mk/test.mk
T2578:
'$(TEST_HC)' $(TEST_HC_OPTS) --make T2578 -fforce-recomp -v0
debug:
# Without optimisations, we should get annotations for basically
# all expressions in the example program.
echo == Dbg ==
'$(TEST_HC)' $(TEST_HC_OPTS) debug -fforce-recomp -g -dppr-ticks -ddump-cmm \
| grep -o src\<debug.hs:.*\> | sort -u
./debug
# With optimisations we will get fewer annotations.
echo == Dbg -O2 ==
'$(TEST_HC)' $(TEST_HC_OPTS) debug -fforce-recomp -g -dppr-ticks -ddump-cmm -O2 \
> debug.cmm
cat debug.cmm | grep -o src\<debug.hs:.*\> | sort -u
# Common block elimination should elimation should merge the
# blocks corresponding to alternatives 1 and 2, therefore there
# must be a block containing exactly these two annotations
# directly next to each other.
echo == CBE ==
cat debug.cmm | grep -A1 -B1 src\<debug.hs:3:.*\> \
| grep src\<debug.hs:4:.*\> \
| grep -o src\<.*\> | sort -u
./debug
rm debug
......@@ -25,3 +25,7 @@ test('T8205', normal, compile, ['-O0'])
test('T9155', normal, compile, ['-O2'])
test('T9303', normal, compile, ['-O2'])
test('T9329', [cmm_src], compile, [''])
test('debug', extra_clean(['debug.cmm']),
run_command,
['$MAKE -s --no-print-directory debug'])
module Main where
fib :: Int -> Int
fib 0 = 1 -- GHC should merge the blocks
fib 1 = 1 -- of these two alternatives
fib n = fib (n-1) + fib (n-2)
main = print $ fib 10
== Dbg ==
src<debug.hs:(3,1)-(5,29)>
src<debug.hs:3:9>
src<debug.hs:4:9>
src<debug.hs:5:13-17>
src<debug.hs:5:14>
src<debug.hs:5:21-29>
src<debug.hs:5:25-29>
src<debug.hs:5:26>
src<debug.hs:5:9-17>
src<debug.hs:5:9-29>
src<debug.hs:6:1-21>
89
== Dbg -O2 ==
src<debug.hs:(3,1)-(5,29)>
src<debug.hs:3:9>
src<debug.hs:4:9>
src<debug.hs:5:25-29>
src<debug.hs:5:9-29>
src<debug.hs:6:1-21>
src<debug.hs:6:16-21>
== CBE ==
src<debug.hs:4:9>
89
......@@ -9,6 +9,8 @@ test('barton-mangler-bug',
'Plot.hi', 'Plot.o',
'PlotExample.hi', 'PlotExample.o',
'TypesettingTricks.hi', 'TypesettingTricks.o']),
omit_compiler_types(['hugs'])],
omit_compiler_types(['hugs']),
omit_ways('debug') # Fails for debug way due to annotation linting timeout
],
multimod_compile_and_run, ['Main', ''])
......@@ -107,7 +107,7 @@ test('T6117', normal, compile_and_run, [''])
test('T5751', normal, compile_and_run, [''])
test('T5913', normal, compile_and_run, [''])
test('T7748', normal, compile_and_run, [''])
test('T7861', exit_code(1), compile_and_run, [''])
test('T7861', [omit_ways('debug'), exit_code(1)], compile_and_run, [''])
test('TcTypeNatSimpleRun', normal, compile_and_run, [''])
test('T8119', normal, ghci_script, ['T8119.script'])
test('T8492', normal, compile_and_run, [''])
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment