Revision 06fe0cea
b/test.hs | ||
---|---|---|
29 | 29 |
import Test.QuickCheck.Batch |
30 | 30 |
import System.IO |
31 | 31 |
import System.Exit |
32 |
import System (getArgs) |
|
32 | 33 |
|
33 | 34 |
import Ganeti.HTools.QC |
34 | 35 |
|
35 |
fastOptions :: TestOptions
|
|
36 |
fastOptions = TestOptions
|
|
36 |
fast :: TestOptions |
|
37 |
fast = TestOptions |
|
37 | 38 |
{ no_of_tests = 500 |
38 | 39 |
, length_of_tests = 10 |
39 | 40 |
, debug_tests = False } |
40 | 41 |
|
41 |
slowOptions :: TestOptions
|
|
42 |
slowOptions = TestOptions
|
|
42 |
slow :: TestOptions |
|
43 |
slow = TestOptions |
|
43 | 44 |
{ no_of_tests = 50 |
44 | 45 |
, length_of_tests = 100 |
45 | 46 |
, debug_tests = False } |
... | ... | |
59 | 60 |
_ -> return () |
60 | 61 |
return tr |
61 | 62 |
|
63 |
allTests :: [(String, TestOptions, [TestOptions -> IO TestResult])] |
|
64 |
allTests = |
|
65 |
[ ("PeerMap", fast, testPeerMap) |
|
66 |
, ("Container", fast, testContainer) |
|
67 |
, ("Instance", fast, testInstance) |
|
68 |
, ("Node", fast, testNode) |
|
69 |
, ("Text", fast, testText) |
|
70 |
, ("OpCodes", fast, testOpCodes) |
|
71 |
, ("Cluster", slow, testCluster) |
|
72 |
] |
|
73 |
|
|
62 | 74 |
main :: IO () |
63 | 75 |
main = do |
64 | 76 |
errs <- newIORef 0 |
65 | 77 |
let wrap = map (wrapTest errs) |
66 |
runTests "PeerMap" fastOptions $ wrap testPeerMap |
|
67 |
runTests "Container" fastOptions $ wrap testContainer |
|
68 |
runTests "Instance" fastOptions $ wrap testInstance |
|
69 |
runTests "Node" fastOptions $ wrap testNode |
|
70 |
runTests "Text" fastOptions $ wrap testText |
|
71 |
runTests "OpCodes" fastOptions $ wrap testOpCodes |
|
72 |
runTests "Cluster" slowOptions $ wrap testCluster |
|
78 |
args <- getArgs |
|
79 |
let tests = if null args |
|
80 |
then allTests |
|
81 |
else filter (\(name, _, _) -> name `elem` args) allTests |
|
82 |
mapM_ (\(name, opts, tl) -> runTests name opts (wrap tl)) tests |
|
73 | 83 |
terr <- readIORef errs |
74 | 84 |
(if terr > 0 |
75 | 85 |
then do |
Also available in: Unified diff