1 {-| Unittest runner for ganeti-htools.
7 Copyright (C) 2009, 2011, 2012, 2013 Google Inc.
9 This program is free software; you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation; either version 2 of the License, or
12 (at your option) any later version.
14 This program is distributed in the hope that it will be useful, but
15 WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 General Public License for more details.
19 You should have received a copy of the GNU General Public License
20 along with this program; if not, write to the Free Software
21 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
26 module Main(main) where
28 import Data.Monoid (mappend)
30 import System.Environment (getArgs)
31 import System.Log.Logger
33 import Test.Ganeti.TestImports ()
34 import Test.Ganeti.Attoparsec
35 import Test.Ganeti.BasicTypes
36 import Test.Ganeti.Common
37 import Test.Ganeti.Confd.Utils
38 import Test.Ganeti.Confd.Types
39 import Test.Ganeti.Daemon
40 import Test.Ganeti.Errors
41 import Test.Ganeti.HTools.Backend.Simu
42 import Test.Ganeti.HTools.Backend.Text
43 import Test.Ganeti.HTools.CLI
44 import Test.Ganeti.HTools.Cluster
45 import Test.Ganeti.HTools.Container
46 import Test.Ganeti.HTools.Graph
47 import Test.Ganeti.HTools.Instance
48 import Test.Ganeti.HTools.Loader
49 import Test.Ganeti.HTools.Node
50 import Test.Ganeti.HTools.PeerMap
51 import Test.Ganeti.HTools.Types
52 import Test.Ganeti.Hypervisor.Xen.XmParser
53 import Test.Ganeti.JSON
54 import Test.Ganeti.Jobs
55 import Test.Ganeti.JQueue
56 import Test.Ganeti.Luxi
57 import Test.Ganeti.Network
58 import Test.Ganeti.Objects
59 import Test.Ganeti.OpCodes
60 import Test.Ganeti.Query.Filter
61 import Test.Ganeti.Query.Language
62 import Test.Ganeti.Query.Network
63 import Test.Ganeti.Query.Query
64 import Test.Ganeti.Rpc
65 import Test.Ganeti.Runtime
66 import Test.Ganeti.Ssconf
67 import Test.Ganeti.Storage.Diskstats.Parser
68 import Test.Ganeti.Storage.Drbd.Parser
69 import Test.Ganeti.Storage.Drbd.Types
70 import Test.Ganeti.Storage.Lvm.LVParser
71 import Test.Ganeti.THH
72 import Test.Ganeti.Types
73 import Test.Ganeti.Utils
75 -- | Our default test options, overring the built-in test-framework
76 -- ones (but not the supplied command line parameters).
77 defOpts :: TestOptions
80 , topt_maximum_generated_tests = Just 500
81 , topt_maximum_unsuitable_generated_tests = Just 5000
82 , topt_maximum_test_size = Nothing
83 , topt_maximum_test_depth = Nothing
84 , topt_timeout = Nothing
87 -- | All our defined tests.
96 , testBlock_Diskstats_Parser
97 , testBlock_Drbd_Parser
98 , testBlock_Drbd_Types
100 , testHTools_Backend_Simu
101 , testHTools_Backend_Text
104 , testHTools_Container
106 , testHTools_Instance
111 , testHypervisor_Xen_XmParser
126 , testStorage_Lvm_LVParser
132 -- | Main function. Note we don't use defaultMain since we want to
133 -- control explicitly our test sizes (and override the default).
136 ropts <- getArgs >>= interpretArgsOrExit
137 let opts = maybe defOpts (defOpts `mappend`) $ ropt_test_options ropts
138 -- silence the logging system, so that tests can execute I/O actions
139 -- which create logs without polluting stderr
140 -- FIXME: improve this by allowing tests to use logging if needed
141 updateGlobalLogger rootLoggerName (setLevel EMERGENCY)
142 defaultMainWithOpts allTests (ropts { ropt_test_options = Just opts })