X-Git-Url: https://code.grnet.gr/git/ganeti-local/blobdiff_plain/305e174ca422174d31aafa69ca6dc0f8f6961d8b..fd80be110509dacf0c0c5eb64907814ef30aa28c:/htest/test.hs?ds=sidebyside diff --git a/htest/test.hs b/htest/test.hs index 67ab776..eade8bf 100644 --- a/htest/test.hs +++ b/htest/test.hs @@ -29,15 +29,42 @@ import Data.Monoid (mappend) import Test.Framework import System.Environment (getArgs) -import Ganeti.HTools.QC +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.Instance +import Test.Ganeti.HTools.Loader +import Test.Ganeti.HTools.Node +import Test.Ganeti.HTools.PeerMap +import Test.Ganeti.HTools.Types +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 @@ -46,66 +73,45 @@ fast = TestOptions , 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, testUtils) - , (True, testPeerMap) - , (True, testContainer) - , (True, testInstance) - , (True, testNode) - , (True, testText) - , (True, testSimu) - , (True, testOpCodes) - , (True, testJobs) - , (True, testLoader) - , (True, testTypes) - , (True, testCLI) - , (True, testJSON) - , (True, testLuxi) - , (True, testSsconf) - , (True, testQlang) - , (True, testRpc) - , (True, testConfdUtils) - , (True, testObjects) - , (False, testCluster) + [ 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 })