[commit: ghc] master: Debug test case and test suite way (c630614)

git at git.haskell.org git at git.haskell.org
Tue Dec 16 21:02:32 UTC 2014


Repository : ssh://git@git.haskell.org/ghc

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/c63061402291ece9ba7fd460e6b95e0ab7c729df/ghc

>---------------------------------------------------------------

commit c63061402291ece9ba7fd460e6b95e0ab7c729df
Author: Peter Wortmann <scpmw at leeds.ac.uk>
Date:   Sun Dec 7 01:04:05 2014 +0100

    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)


>---------------------------------------------------------------

c63061402291ece9ba7fd460e6b95e0ab7c729df
 libraries/base/tests/all.T                         |  3 ++-
 testsuite/config/ghc                               |  5 ++++-
 testsuite/tests/codeGen/should_compile/Makefile    | 25 ++++++++++++++++++++++
 testsuite/tests/codeGen/should_compile/all.T       |  4 ++++
 testsuite/tests/codeGen/should_compile/debug.hs    |  6 ++++++
 .../tests/codeGen/should_compile/debug.stdout      | 24 +++++++++++++++++++++
 testsuite/tests/programs/barton-mangler-bug/test.T |  4 +++-
 testsuite/tests/typecheck/should_run/all.T         |  2 +-
 8 files changed, 69 insertions(+), 4 deletions(-)

diff --git a/libraries/base/tests/all.T b/libraries/base/tests/all.T
index d4686e5..1154a53 100644
--- a/libraries/base/tests/all.T
+++ b/libraries/base/tests/all.T
@@ -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, [''])
diff --git a/testsuite/config/ghc b/testsuite/config/ghc
index 84b89d4..10565dd 100644
--- a/testsuite/config/ghc
+++ b/testsuite/config/ghc
@@ -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'],
diff --git a/testsuite/tests/codeGen/should_compile/Makefile b/testsuite/tests/codeGen/should_compile/Makefile
index c804a12..b186e0d 100644
--- a/testsuite/tests/codeGen/should_compile/Makefile
+++ b/testsuite/tests/codeGen/should_compile/Makefile
@@ -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
diff --git a/testsuite/tests/codeGen/should_compile/all.T b/testsuite/tests/codeGen/should_compile/all.T
index a6b6894..b571839 100644
--- a/testsuite/tests/codeGen/should_compile/all.T
+++ b/testsuite/tests/codeGen/should_compile/all.T
@@ -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'])
diff --git a/testsuite/tests/codeGen/should_compile/debug.hs b/testsuite/tests/codeGen/should_compile/debug.hs
new file mode 100644
index 0000000..dfb6d60
--- /dev/null
+++ b/testsuite/tests/codeGen/should_compile/debug.hs
@@ -0,0 +1,6 @@
+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
diff --git a/testsuite/tests/codeGen/should_compile/debug.stdout b/testsuite/tests/codeGen/should_compile/debug.stdout
new file mode 100644
index 0000000..59332ff
--- /dev/null
+++ b/testsuite/tests/codeGen/should_compile/debug.stdout
@@ -0,0 +1,24 @@
+== 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
diff --git a/testsuite/tests/programs/barton-mangler-bug/test.T b/testsuite/tests/programs/barton-mangler-bug/test.T
index bb140f56f..f6ad425 100644
--- a/testsuite/tests/programs/barton-mangler-bug/test.T
+++ b/testsuite/tests/programs/barton-mangler-bug/test.T
@@ -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', ''])
 
diff --git a/testsuite/tests/typecheck/should_run/all.T b/testsuite/tests/typecheck/should_run/all.T
index 53c97ea..5b20034 100755
--- a/testsuite/tests/typecheck/should_run/all.T
+++ b/testsuite/tests/typecheck/should_run/all.T
@@ -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, [''])



More information about the ghc-commits mailing list