Revision ee4ffc8a
b/htools/Ganeti/HTools/CLI.hs | ||
---|---|---|
74 | 74 |
, oShowHelp |
75 | 75 |
, oShowVer |
76 | 76 |
, oStdSpec |
77 |
, oTestCount |
|
77 | 78 |
, oTieredSpec |
78 | 79 |
, oVerbose |
79 | 80 |
) where |
... | ... | |
138 | 139 |
, optShowNodes :: Maybe [String] -- ^ Whether to show node status |
139 | 140 |
, optShowVer :: Bool -- ^ Just show the program version |
140 | 141 |
, optStdSpec :: Maybe RSpec -- ^ Requested standard specs |
142 |
, optTestCount :: Maybe Int -- ^ Optional test count override |
|
141 | 143 |
, optTieredSpec :: Maybe RSpec -- ^ Requested specs for tiered mode |
142 | 144 |
, optReplay :: Maybe String -- ^ Unittests: RNG state |
143 | 145 |
, optVerbose :: Int -- ^ Verbosity level |
... | ... | |
177 | 179 |
, optShowNodes = Nothing |
178 | 180 |
, optShowVer = False |
179 | 181 |
, optStdSpec = Nothing |
182 |
, optTestCount = Nothing |
|
180 | 183 |
, optTieredSpec = Nothing |
181 | 184 |
, optReplay = Nothing |
182 | 185 |
, optVerbose = 1 |
... | ... | |
397 | 400 |
"STDSPEC") |
398 | 401 |
"enable standard specs allocation, given as 'disk,ram,cpu'" |
399 | 402 |
|
403 |
oTestCount :: OptType |
|
404 |
oTestCount = Option "" ["test-count"] |
|
405 |
(ReqArg (\ inp opts -> do |
|
406 |
tcount <- tryRead "parsing test count" inp |
|
407 |
return $ opts { optTestCount = Just tcount } ) |
|
408 |
"COUNT") |
|
409 |
"override the target test count" |
|
410 |
|
|
400 | 411 |
oTieredSpec :: OptType |
401 | 412 |
oTieredSpec = Option "" ["tiered-alloc"] |
402 | 413 |
(ReqArg (\ inp opts -> do |
b/htools/test.hs | ||
---|---|---|
28 | 28 |
import Data.Char |
29 | 29 |
import Data.IORef |
30 | 30 |
import Data.List |
31 |
import Data.Maybe (fromMaybe) |
|
31 | 32 |
import System.Console.GetOpt () |
32 | 33 |
import System.Environment (getArgs) |
33 | 34 |
import System.Exit |
... | ... | |
46 | 47 |
, oVerbose |
47 | 48 |
, oShowVer |
48 | 49 |
, oShowHelp |
50 |
, oTestCount |
|
49 | 51 |
] |
50 | 52 |
|
51 | 53 |
fast :: Args |
... | ... | |
141 | 143 |
case vs of |
142 | 144 |
[rng, size] -> return $ Just (read rng, read size) |
143 | 145 |
_ -> fail "Invalid state given" |
144 |
return args { chatty = optVerbose opts > 1, |
|
145 |
replay = r |
|
146 |
return args { chatty = optVerbose opts > 1 |
|
147 |
, replay = r |
|
148 |
, maxSuccess = fromMaybe (maxSuccess args) (optTestCount opts) |
|
149 |
, maxDiscard = fromMaybe (maxDiscard args) (optTestCount opts) |
|
146 | 150 |
} |
147 | 151 |
|
148 | 152 |
main :: IO () |
Also available in: Unified diff