summaryrefslogtreecommitdiff
path: root/testsuite/tests/utils
diff options
context:
space:
mode:
authorMatthew Pickering <matthewtpickering@gmail.com>2021-12-08 16:56:15 +0000
committerMarge Bot <ben+marge-bot@smart-cactus.org>2021-12-22 14:47:40 -0500
commit3ed909118126a93f03ef17fed52eaf602b91ae1b (patch)
tree669ce30095f26b440cab35daf006b102a4c7c48f /testsuite/tests/utils
parent09b6cb45505c2c32ddaffcdb930fb3f7873b2cfc (diff)
downloadhaskell-3ed909118126a93f03ef17fed52eaf602b91ae1b.tar.gz
testsuite: Remove reqlib modifier
The reqlib modifer was supposed to indicate that a test needed a certain library in order to work. If the library happened to be installed then the test would run as normal. However, CI has never run these tests as the packages have not been installed and we don't want out tests to depend on things which might get externally broken by updating the compiler. The new strategy is to run these tests in head.hackage, where the tests have been cabalised as well as possible. Some tests couldn't be transferred into the normal style testsuite but it's better than never running any of the reqlib tests. https://gitlab.haskell.org/ghc/head.hackage/-/merge_requests/169 A few submodules also had reqlib tests and have been updated to remove it. Closes #16264 #20032 #17764 #16561
Diffstat (limited to 'testsuite/tests/utils')
-rw-r--r--testsuite/tests/utils/should_run/T14854.hs87
-rw-r--r--testsuite/tests/utils/should_run/T14854.stdout2
-rw-r--r--testsuite/tests/utils/should_run/all.T9
3 files changed, 1 insertions, 97 deletions
diff --git a/testsuite/tests/utils/should_run/T14854.hs b/testsuite/tests/utils/should_run/T14854.hs
deleted file mode 100644
index ce6ac4b024..0000000000
--- a/testsuite/tests/utils/should_run/T14854.hs
+++ /dev/null
@@ -1,87 +0,0 @@
-{-# LANGUAGE RecordWildCards #-}
-module Main (main) where
-
-import GHC.Data.FastString
-
-import Control.Concurrent
-import Control.DeepSeq
-import Control.Exception
-import Control.Monad
-import Data.ByteString (ByteString)
-import Data.ByteString.Builder
-import qualified Data.ByteString.Char8 as Char
-import Data.ByteString.Lazy (toStrict)
-import Data.List
-import Data.Monoid
-import qualified Data.Sequence as Seq
-import Data.Time
-import GHC.Conc
-import System.IO
-import System.Random
-import Text.Printf
-
-data Options = Options
- { optThreads :: Int -- ^ the number of threads to run concurrently
- , optRepeat :: Int -- ^ how many times do we create the same 'FastString'
- , optCount :: Int -- ^ the total number of different 'FastString's
- , optPrefix :: Int -- ^ the length of prefix in each 'FastString'
- }
-
-defOptions :: Options
-defOptions = Options
- { optThreads = 8
- , optRepeat = 16
- , optCount = 10000
- , optPrefix = 0
- }
-
-run :: [[ByteString]] -> (ByteString -> Int) -> IO Int
-run jobs op = do
- mvars <- forM ([0 ..] `zip` jobs) $ \(i, job) -> do
- mvar <- newEmptyMVar
- forkOn i $ do
- uniq <- evaluate $ force $ maximum $ map op job
- putMVar mvar uniq
- return mvar
- uniqs <- mapM takeMVar mvars
- evaluate $ force $ maximum uniqs - 603979775
-
-summary :: IO [[[a]]] -> IO Int
-summary getTable = do
- table <- getTable
- evaluate $ force $ length $ concat $ concat table
-
-timeIt :: String -> IO a -> IO a
-timeIt name io = do
- before <- getCurrentTime
- ret <- io
- after <- getCurrentTime
- hPrintf stderr "%s: %.2fms\n" name
- (realToFrac $ diffUTCTime after before * 1000 :: Double)
- return ret
-
-main :: IO ()
-main = do
- seed <- randomIO
- let Options{..} = defOptions
- shuffle (i:is) s
- | Seq.null s = []
- | otherwise = m: shuffle is (l <> r)
- where
- (l, m Seq.:< r) = Seq.viewl <$> Seq.splitAt (i `rem` Seq.length s) s
- inputs =
- shuffle (randoms $ mkStdGen seed) $
- mconcat $ replicate optRepeat $
- Seq.fromFunction optCount $ \i -> toStrict $ toLazyByteString $
- byteString (Char.replicate optPrefix '_') <> intDec i
- jobs <- evaluate $ force $ transpose $
- map (take optThreads) $
- takeWhile (not . null) $
- iterate (drop optThreads) inputs
- setNumCapabilities (length jobs)
- -- The maximum unique may be greater than 'optCount'
- u <- timeIt "run" $ run jobs $ uniqueOfFS . mkFastStringByteString
- print $ optCount <= u && u <= min optThreads optRepeat * optCount
- -- But we should never have duplicate 'FastString's in the table
- n <- timeIt "summary" $ summary getFastStringTable
- print $ n == optCount
diff --git a/testsuite/tests/utils/should_run/T14854.stdout b/testsuite/tests/utils/should_run/T14854.stdout
deleted file mode 100644
index dbde422651..0000000000
--- a/testsuite/tests/utils/should_run/T14854.stdout
+++ /dev/null
@@ -1,2 +0,0 @@
-True
-True
diff --git a/testsuite/tests/utils/should_run/all.T b/testsuite/tests/utils/should_run/all.T
index e2ae0f9a78..d3607e6590 100644
--- a/testsuite/tests/utils/should_run/all.T
+++ b/testsuite/tests/utils/should_run/all.T
@@ -1,9 +1,2 @@
-test('T14854',
- [only_ways(threaded_ways),
- omit_ways(['ghci']),
- reqlib('random'),
- ignore_stderr],
- compile_and_run,
- ['-package ghc'])
-
test('T15953', [ignore_stdout], makefile_test, [])
+