Commit ee4ffc8a authored by Iustin Pop's avatar Iustin Pop
Browse files

Allow overriding the target test count



This is not perfect, as the override applies identical target test
values to both the 'fast' and 'slow' tests (making the slow tests take
a long time), but it allows a quick override for manual runs.
Signed-off-by: default avatarIustin Pop <iustin@google.com>
Reviewed-by: default avatarRené Nussbaumer <rn@google.com>
parent eae69eee
......@@ -74,6 +74,7 @@ module Ganeti.HTools.CLI
, oShowHelp
, oShowVer
, oStdSpec
, oTestCount
, oTieredSpec
, oVerbose
) where
......@@ -138,6 +139,7 @@ data Options = Options
, optShowNodes :: Maybe [String] -- ^ Whether to show node status
, optShowVer :: Bool -- ^ Just show the program version
, optStdSpec :: Maybe RSpec -- ^ Requested standard specs
, optTestCount :: Maybe Int -- ^ Optional test count override
, optTieredSpec :: Maybe RSpec -- ^ Requested specs for tiered mode
, optReplay :: Maybe String -- ^ Unittests: RNG state
, optVerbose :: Int -- ^ Verbosity level
......@@ -177,6 +179,7 @@ defaultOptions = Options
, optShowNodes = Nothing
, optShowVer = False
, optStdSpec = Nothing
, optTestCount = Nothing
, optTieredSpec = Nothing
, optReplay = Nothing
, optVerbose = 1
......@@ -397,6 +400,14 @@ oStdSpec = Option "" ["standard-alloc"]
"STDSPEC")
"enable standard specs allocation, given as 'disk,ram,cpu'"
oTestCount :: OptType
oTestCount = Option "" ["test-count"]
(ReqArg (\ inp opts -> do
tcount <- tryRead "parsing test count" inp
return $ opts { optTestCount = Just tcount } )
"COUNT")
"override the target test count"
oTieredSpec :: OptType
oTieredSpec = Option "" ["tiered-alloc"]
(ReqArg (\ inp opts -> do
......
......@@ -28,6 +28,7 @@ module Main(main) where
import Data.Char
import Data.IORef
import Data.List
import Data.Maybe (fromMaybe)
import System.Console.GetOpt ()
import System.Environment (getArgs)
import System.Exit
......@@ -46,6 +47,7 @@ options =
, oVerbose
, oShowVer
, oShowHelp
, oTestCount
]
fast :: Args
......@@ -141,8 +143,10 @@ transformTestOpts args opts = do
case vs of
[rng, size] -> return $ Just (read rng, read size)
_ -> fail "Invalid state given"
return args { chatty = optVerbose opts > 1,
replay = r
return args { chatty = optVerbose opts > 1
, replay = r
, maxSuccess = fromMaybe (maxSuccess args) (optTestCount opts)
, maxDiscard = fromMaybe (maxDiscard args) (optTestCount opts)
}
main :: IO ()
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment