From d7cbd1f761c406f7282807739732ae4cc8838ccb Mon Sep 17 00:00:00 2001
From: Johan Tibell <johan.tibell@gmail.com>
Date: Thu, 19 May 2011 17:33:49 +0200
Subject: [PATCH] Always run cgrun068

---
 tests/ghc-regress/codeGen/should_run/all.T       |    1 +
 tests/ghc-regress/codeGen/should_run/cgrun068.hs |   27 +++++++++++++--------
 2 files changed, 18 insertions(+), 10 deletions(-)

diff --git a/tests/ghc-regress/codeGen/should_run/all.T b/tests/ghc-regress/codeGen/should_run/all.T
index 5852c86..58cd643 100644
--- a/tests/ghc-regress/codeGen/should_run/all.T
+++ b/tests/ghc-regress/codeGen/should_run/all.T
@@ -76,6 +76,7 @@ test('cgrun065', normal, compile_and_run, [''])
 test('cgrun066', normal, compile_and_run, [''])
 test('cgrun067', extra_clean(['Cgrun067A.hi', 'Cgrun067A.o']),
      compile_and_run, [''])
+test('cgrun068', normal, compile_and_run, [''])
 
 test('1861', extra_run_opts('0'), compile_and_run, [''])
 
diff --git a/tests/ghc-regress/codeGen/should_run/cgrun068.hs b/tests/ghc-regress/codeGen/should_run/cgrun068.hs
index c78edb3..f5096ad 100644
--- a/tests/ghc-regress/codeGen/should_run/cgrun068.hs
+++ b/tests/ghc-regress/codeGen/should_run/cgrun068.hs
@@ -3,6 +3,10 @@
 
 -- !!! stress tests of copying/cloning primitive arrays
 
+-- Note: You can run this test manually with an argument
+-- (i.e. ./cgrun068 10000) if you want to run the stress test for
+-- longer.
+
 {-
 Test strategy
 =============
@@ -32,12 +36,19 @@ import GHC.Exts
 import GHC.ST hiding (liftST)
 import Prelude hiding (length, read)
 import qualified Prelude as P
+import qualified Prelude as P
+import System.Environment
 import System.Random
 
 main :: IO ()
 main = do
-    putStr (test_copyMutableArray ++ "\n" ++
-            test_cloneMutableArray ++ "\n"
+    args <- getArgs
+    -- Number of copies to perform
+    let numMods = case args of
+            [] -> 100
+            [n] -> P.read n :: Int
+    putStr (test_copyMutableArray numMods ++ "\n" ++
+            test_cloneMutableArray numMods ++ "\n"
            )
 
 -- Number of arrays
@@ -48,10 +59,6 @@ numArrays = 100
 maxLen :: Int
 maxLen = 1024
 
--- Number of copies to perform
-numMods :: Int
-numMods = 10000
-
 -- Create an array of arrays, with each sub-array having random length
 -- and content.
 setup :: Rng s (MArray s (MArray s Int))
@@ -120,8 +127,8 @@ clone marr f = do
 
 -- Copy a slice of the source array into a destination array and check
 -- that the copy succeeded.
-test_copyMutableArray :: String
-test_copyMutableArray = runST $ run $ do
+test_copyMutableArray :: Int -> String
+test_copyMutableArray numMods = runST $ run $ do
     marr <- local setup
     marrRef <- setup
     let go i
@@ -165,8 +172,8 @@ unlinesShow =  concatMap (\ x -> show x ++ "\n")
 
 -- Copy a slice of the source array into a destination array and check
 -- that the copy succeeded.
-test_cloneMutableArray :: String
-test_cloneMutableArray = runST $ run $ do
+test_cloneMutableArray :: Int -> String
+test_cloneMutableArray numMods = runST $ run $ do
     marr <- local setup
     marrRef <- setup
     let go i
-- 
1.7.3.1

