import System.Environment (getArgs)
import Test.Ganeti.TestImports ()
+import Test.Ganeti.Attoparsec
import Test.Ganeti.BasicTypes
+import Test.Ganeti.Block.Drbd.Parser
+import Test.Ganeti.Common
import Test.Ganeti.Confd.Utils
+import Test.Ganeti.Daemon
+import Test.Ganeti.Errors
+import Test.Ganeti.HTools.Backend.Simu
+import Test.Ganeti.HTools.Backend.Text
import Test.Ganeti.HTools.CLI
import Test.Ganeti.HTools.Cluster
import Test.Ganeti.HTools.Container
-import Test.Ganeti.HTools.Loader
import Test.Ganeti.HTools.Instance
+import Test.Ganeti.HTools.Loader
import Test.Ganeti.HTools.Node
import Test.Ganeti.HTools.PeerMap
-import Test.Ganeti.HTools.Simu
-import Test.Ganeti.HTools.Text
import Test.Ganeti.HTools.Types
-import Test.Ganeti.HTools.Utils
-import Test.Ganeti.Jobs
import Test.Ganeti.JSON
+import Test.Ganeti.Jobs
import Test.Ganeti.Luxi
import Test.Ganeti.Objects
import Test.Ganeti.OpCodes
+import Test.Ganeti.Query.Filter
import Test.Ganeti.Query.Language
+import Test.Ganeti.Query.Query
import Test.Ganeti.Rpc
import Test.Ganeti.Ssconf
+import Test.Ganeti.THH
+import Test.Ganeti.Types
+import Test.Ganeti.Utils
-- | Our default test options, overring the built-in test-framework
--- ones.
-fast :: TestOptions
-fast = TestOptions
+-- ones (but not the supplied command line parameters).
+defOpts :: TestOptions
+defOpts = TestOptions
{ topt_seed = Nothing
, topt_maximum_generated_tests = Just 500
, topt_maximum_unsuitable_generated_tests = Just 5000
, topt_timeout = Nothing
}
--- | Our slow test options.
-slow :: TestOptions
-slow = fast
- { topt_maximum_generated_tests = Just 50
- , topt_maximum_unsuitable_generated_tests = Just 500
- }
-
-- | All our defined tests.
-allTests :: [(Bool, (String, [Test]))]
+allTests :: [Test]
allTests =
- [ (True, testBasicTypes)
- , (True, testConfd_Utils)
- , (True, testHTools_CLI)
- , (True, testHTools_Container)
- , (True, testHTools_Instance)
- , (True, testHTools_Loader)
- , (True, testHTools_Node)
- , (True, testHTools_PeerMap)
- , (True, testHTools_Simu)
- , (True, testHTools_Text)
- , (True, testHTools_Types)
- , (True, testHTools_Utils)
- , (True, testJSON)
- , (True, testJobs)
- , (True, testLuxi)
- , (True, testObjects)
- , (True, testOpCodes)
- , (True, testQuery_Language)
- , (True, testRpc)
- , (True, testSsconf)
- , (False, testHTools_Cluster)
- , (False, testSlowObjects)
+ [ testBasicTypes
+ , testAttoparsec
+ , testCommon
+ , testConfd_Utils
+ , testDaemon
+ , testBlock_Drbd_Parser
+ , testErrors
+ , testHTools_Backend_Simu
+ , testHTools_Backend_Text
+ , testHTools_CLI
+ , testHTools_Cluster
+ , testHTools_Container
+ , testHTools_Instance
+ , testHTools_Loader
+ , testHTools_Node
+ , testHTools_PeerMap
+ , testHTools_Types
+ , testJSON
+ , testJobs
+ , testLuxi
+ , testObjects
+ , testOpCodes
+ , testQuery_Filter
+ , testQuery_Language
+ , testQuery_Query
+ , testRpc
+ , testSsconf
+ , testTHH
+ , testTypes
+ , testUtils
]
--- | Slow a test's max tests, if provided as such.
-makeSlowOrFast :: Bool -> TestOptions -> TestOptions
-makeSlowOrFast is_fast opts =
- let template = if is_fast then fast else slow
- fn_val v = if is_fast then v else v `div` 10
- in case topt_maximum_generated_tests opts of
- -- user didn't override the max_tests, so we'll do it here
- Nothing -> opts `mappend` template
- -- user did override, so we ignore the template and just directly
- -- decrease the max_tests, if needed
- Just max_tests -> opts { topt_maximum_generated_tests =
- Just (fn_val max_tests)
- }
-
-- | Main function. Note we don't use defaultMain since we want to
-- control explicitly our test sizes (and override the default).
main :: IO ()
main = do
ropts <- getArgs >>= interpretArgsOrExit
- -- note: we do this overriding here since we need some groups to
- -- have a smaller test count; so in effect we're basically
- -- overriding t-f's inheritance here, but only for max_tests
- let (act_fast, act_slow) =
- case ropt_test_options ropts of
- Nothing -> (fast, slow)
- Just topts -> (makeSlowOrFast True topts, makeSlowOrFast False topts)
- actual_opts is_fast = if is_fast then act_fast else act_slow
- let tests = map (\(is_fast, (group_name, group_tests)) ->
- plusTestOptions (actual_opts is_fast) $
- testGroup group_name group_tests) allTests
- defaultMainWithOpts tests ropts
+ let opts = maybe defOpts (defOpts `mappend`) $ ropt_test_options ropts
+ defaultMainWithOpts allTests (ropts { ropt_test_options = Just opts })