diff options
author | Ben Gamari <ben@smart-cactus.org> | 2019-06-18 12:17:48 -0400 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2019-06-22 10:06:05 -0400 |
commit | 1f2fff89afebb065b27eba0f6e1f89e25c1c158d (patch) | |
tree | 6f88bba996904b65864f2c456de126763ab720a9 /testsuite | |
parent | b0d6bf2a34d5e2e0cfb2410f58e768935d527be0 (diff) | |
download | haskell-1f2fff89afebb065b27eba0f6e1f89e25c1c158d.tar.gz |
testsuite: Add caf_crash testcase
Diffstat (limited to 'testsuite')
-rw-r--r-- | testsuite/tests/ghci/caf_crash/A.hs | 18 | ||||
-rw-r--r-- | testsuite/tests/ghci/caf_crash/B.hs | 5 | ||||
-rw-r--r-- | testsuite/tests/ghci/caf_crash/D.hs | 22 | ||||
-rw-r--r-- | testsuite/tests/ghci/caf_crash/all.T | 6 | ||||
-rw-r--r-- | testsuite/tests/ghci/caf_crash/caf_crash.script | 9 | ||||
-rw-r--r-- | testsuite/tests/ghci/caf_crash/caf_crash.stdout | 7 |
6 files changed, 67 insertions, 0 deletions
diff --git a/testsuite/tests/ghci/caf_crash/A.hs b/testsuite/tests/ghci/caf_crash/A.hs new file mode 100644 index 0000000000..302c3b3132 --- /dev/null +++ b/testsuite/tests/ghci/caf_crash/A.hs @@ -0,0 +1,18 @@ +module A (caf, mainx, square) where + +import B (idd) + +caf :: Int +caf = 23423 + +mainx :: IO () +mainx = do + putStrLn $ show (caf + idd) + putStrLn "Hello" + putStrLn "World" + +square :: IO Int +square = do + let ss = "I'm a square" + putStrLn $ ss + return $ length ss diff --git a/testsuite/tests/ghci/caf_crash/B.hs b/testsuite/tests/ghci/caf_crash/B.hs new file mode 100644 index 0000000000..06dc96ee20 --- /dev/null +++ b/testsuite/tests/ghci/caf_crash/B.hs @@ -0,0 +1,5 @@ +module B (idd) where + +idd :: Int +idd = 100000242418429 + diff --git a/testsuite/tests/ghci/caf_crash/D.hs b/testsuite/tests/ghci/caf_crash/D.hs new file mode 100644 index 0000000000..3dfcdc99ee --- /dev/null +++ b/testsuite/tests/ghci/caf_crash/D.hs @@ -0,0 +1,22 @@ +module D where + +import A + +data MyFunc = MyFunc String (IO Int) + +funcCaf :: [MyFunc] +funcCaf = [MyFunc "square" square] + +f1 :: MyFunc -> String +f1 (MyFunc s _) = s + +f2 :: MyFunc -> IO Int +f2 (MyFunc s d) = d + +main :: IO () +main = do + mainx + putStrLn $ show $ length funcCaf + putStrLn $ show $ f1 $ head funcCaf + yay <- f2 $ head funcCaf + print yay diff --git a/testsuite/tests/ghci/caf_crash/all.T b/testsuite/tests/ghci/caf_crash/all.T new file mode 100644 index 0000000000..6fe22dd454 --- /dev/null +++ b/testsuite/tests/ghci/caf_crash/all.T @@ -0,0 +1,6 @@ +test('caf_crash', + [extra_files(['A.hs', 'B.hs', 'D.hs', ]), + when(ghc_dynamic(), skip), + extra_ways(['ghci-ext']), + omit_ways(['ghci']), ], + ghci_script, ['caf_crash.script']) diff --git a/testsuite/tests/ghci/caf_crash/caf_crash.script b/testsuite/tests/ghci/caf_crash/caf_crash.script new file mode 100644 index 0000000000..6e09c2ab21 --- /dev/null +++ b/testsuite/tests/ghci/caf_crash/caf_crash.script @@ -0,0 +1,9 @@ +:set -fobject-code +:l D.hs +:set -fbyte-code +:add *D +main +:l [] +System.Mem.performGC +System.Mem.performGC +3+4 diff --git a/testsuite/tests/ghci/caf_crash/caf_crash.stdout b/testsuite/tests/ghci/caf_crash/caf_crash.stdout new file mode 100644 index 0000000000..19539a410d --- /dev/null +++ b/testsuite/tests/ghci/caf_crash/caf_crash.stdout @@ -0,0 +1,7 @@ +100000242441852 +Hello +World +1 +"square" +I'm a square +12 |