summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthew Pickering <matthewtpickering@gmail.com>2020-11-18 11:57:24 +0000
committerMatthew Pickering <matthewtpickering@gmail.com>2020-11-18 16:30:35 +0000
commit02618707cd39b74d109de9e1c45c495eb8d5f340 (patch)
treebb0f73731f21e8fcd35c85b5c12747d19f2440b9
parent1886fe3bb219cd777eef3c16481c65f55bcb0507 (diff)
downloadhaskell-wip/con-info-new.tar.gz
Add test for whereFrom#wip/con-info-new
-rw-r--r--testsuite/tests/profiling/should_run/all.T12
-rw-r--r--testsuite/tests/profiling/should_run/staticcallstack001.hs19
-rw-r--r--testsuite/tests/profiling/should_run/staticcallstack001.stdout3
-rw-r--r--testsuite/tests/profiling/should_run/staticcallstack002.hs14
-rw-r--r--testsuite/tests/profiling/should_run/staticcallstack002.stdout4
5 files changed, 52 insertions, 0 deletions
diff --git a/testsuite/tests/profiling/should_run/all.T b/testsuite/tests/profiling/should_run/all.T
index dec77add28..740646a6f6 100644
--- a/testsuite/tests/profiling/should_run/all.T
+++ b/testsuite/tests/profiling/should_run/all.T
@@ -8,6 +8,18 @@ test('heapprof002',
test('T11489', [req_profiling], makefile_test, ['T11489'])
+test('staticcallstack001',
+ [ omit_ways(['ghci-ext-prof']), # produces a different stack
+ ], compile_and_run,
+ ['-O0 -g3 -fdistinct-constructor-tables -finfo-table-map'])
+
+test('staticcallstack002',
+ [ omit_ways(['ghci-ext-prof']), # produces a different stack
+ ], compile_and_run,
+ ['-O0 -g3 -fdistinct-constructor-tables -finfo-table-map'])
+
+
+
# Below this line, run tests only with profiling ways.
setTestOpts(req_profiling)
setTestOpts(extra_ways(['prof', 'ghci-ext-prof']))
diff --git a/testsuite/tests/profiling/should_run/staticcallstack001.hs b/testsuite/tests/profiling/should_run/staticcallstack001.hs
new file mode 100644
index 0000000000..78849d0ef1
--- /dev/null
+++ b/testsuite/tests/profiling/should_run/staticcallstack001.hs
@@ -0,0 +1,19 @@
+module Main where
+
+import GHC.Stack.CCS
+
+data D = D Int deriving Show
+
+ff = id (D 5)
+{-# NOINLINE ff #-}
+{-# NOINLINE qq #-}
+
+qq x = D x
+
+caf = D 5
+
+main = do
+ print . tail =<< whereFrom (D 5)
+ print . tail =<< whereFrom caf
+ print . tail =<< whereFrom (id (D 5))
+
diff --git a/testsuite/tests/profiling/should_run/staticcallstack001.stdout b/testsuite/tests/profiling/should_run/staticcallstack001.stdout
new file mode 100644
index 0000000000..6c425c32bf
--- /dev/null
+++ b/testsuite/tests/profiling/should_run/staticcallstack001.stdout
@@ -0,0 +1,3 @@
+["0","","main","Main","staticcallstack001.hs:16:20-34"]
+["0","","caf","Main","staticcallstack001.hs:13:1-9"]
+["15","D","main","Main","staticcallstack001.hs:18:30-39"]
diff --git a/testsuite/tests/profiling/should_run/staticcallstack002.hs b/testsuite/tests/profiling/should_run/staticcallstack002.hs
new file mode 100644
index 0000000000..87df13bee0
--- /dev/null
+++ b/testsuite/tests/profiling/should_run/staticcallstack002.hs
@@ -0,0 +1,14 @@
+{-# LANGUAGE UnboxedTuples #-}
+module Main where
+
+import GHC.Stack.CCS
+
+-- Unboxed data constructors don't have info tables so there is
+-- a special case to not generate distinct info tables for unboxed
+-- constructors.
+main = do
+ print . tail =<< whereFrom (undefined (# #))
+ print . tail =<< whereFrom (undefined (# () #))
+ print . tail =<< whereFrom (undefined (# (), () #))
+ print . tail =<< whereFrom (undefined (# | () #))
+
diff --git a/testsuite/tests/profiling/should_run/staticcallstack002.stdout b/testsuite/tests/profiling/should_run/staticcallstack002.stdout
new file mode 100644
index 0000000000..c96b6fa7f3
--- /dev/null
+++ b/testsuite/tests/profiling/should_run/staticcallstack002.stdout
@@ -0,0 +1,4 @@
+["15","Any","main","Main","staticcallstack002.hs:10:30-46"]
+["15","Any","main","Main","staticcallstack002.hs:11:30-49"]
+["15","Any","main","Main","staticcallstack002.hs:12:30-53"]
+["15","Any","main","Main","staticcallstack002.hs:13:30-51"]