Statistics
| Branch: | Tag: | Revision:

root / test / hs / htest.hs @ 3fd38382

History | View | Annotate | Download (4.2 kB)

1
{-| Unittest runner for ganeti-htools.
2

    
3
-}
4

    
5
{-
6

    
7
Copyright (C) 2009, 2011, 2012, 2013 Google Inc.
8

    
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.
13

    
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.
18

    
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
22
02110-1301, USA.
23

    
24
-}
25

    
26
module Main(main) where
27

    
28
import Data.Monoid (mappend)
29
import Test.Framework
30
import System.Environment (getArgs)
31
import System.Log.Logger
32

    
33
import Test.AutoConf
34
import Test.Ganeti.TestImports ()
35
import Test.Ganeti.Attoparsec
36
import Test.Ganeti.BasicTypes
37
import Test.Ganeti.Common
38
import Test.Ganeti.Constants
39
import Test.Ganeti.Confd.Utils
40
import Test.Ganeti.Confd.Types
41
import Test.Ganeti.Daemon
42
import Test.Ganeti.Errors
43
import Test.Ganeti.HTools.Backend.Simu
44
import Test.Ganeti.HTools.Backend.Text
45
import Test.Ganeti.HTools.CLI
46
import Test.Ganeti.HTools.Cluster
47
import Test.Ganeti.HTools.Container
48
import Test.Ganeti.HTools.Graph
49
import Test.Ganeti.HTools.Instance
50
import Test.Ganeti.HTools.Loader
51
import Test.Ganeti.HTools.Node
52
import Test.Ganeti.HTools.PeerMap
53
import Test.Ganeti.HTools.Types
54
import Test.Ganeti.Hypervisor.Xen.XmParser
55
import Test.Ganeti.JSON
56
import Test.Ganeti.Jobs
57
import Test.Ganeti.JQueue
58
import Test.Ganeti.Luxi
59
import Test.Ganeti.Network
60
import Test.Ganeti.Objects
61
import Test.Ganeti.OpCodes
62
import Test.Ganeti.Query.Aliases
63
import Test.Ganeti.Query.Filter
64
import Test.Ganeti.Query.Language
65
import Test.Ganeti.Query.Network
66
import Test.Ganeti.Query.Query
67
import Test.Ganeti.Rpc
68
import Test.Ganeti.Runtime
69
import Test.Ganeti.Ssconf
70
import Test.Ganeti.Storage.Diskstats.Parser
71
import Test.Ganeti.Storage.Drbd.Parser
72
import Test.Ganeti.Storage.Drbd.Types
73
import Test.Ganeti.Storage.Lvm.LVParser
74
import Test.Ganeti.THH
75
import Test.Ganeti.Types
76
import Test.Ganeti.Utils
77

    
78
-- | Our default test options, overring the built-in test-framework
79
-- ones (but not the supplied command line parameters).
80
defOpts :: TestOptions
81
defOpts = TestOptions
82
       { topt_seed                               = Nothing
83
       , topt_maximum_generated_tests            = Just 500
84
       , topt_maximum_unsuitable_generated_tests = Just 5000
85
       , topt_maximum_test_size                  = Nothing
86
       , topt_maximum_test_depth                 = Nothing
87
       , topt_timeout                            = Nothing
88
       }
89

    
90
-- | All our defined tests.
91
allTests :: [Test]
92
allTests =
93
  [ testAutoConf
94
  , testBasicTypes
95
  , testAttoparsec
96
  , testCommon
97
  , testConstants
98
  , testConfd_Types
99
  , testConfd_Utils
100
  , testDaemon
101
  , testBlock_Diskstats_Parser
102
  , testBlock_Drbd_Parser
103
  , testBlock_Drbd_Types
104
  , testErrors
105
  , testHTools_Backend_Simu
106
  , testHTools_Backend_Text
107
  , testHTools_CLI
108
  , testHTools_Cluster
109
  , testHTools_Container
110
  , testHTools_Graph
111
  , testHTools_Instance
112
  , testHTools_Loader
113
  , testHTools_Node
114
  , testHTools_PeerMap
115
  , testHTools_Types
116
  , testHypervisor_Xen_XmParser
117
  , testJSON
118
  , testJobs
119
  , testJQueue
120
  , testLuxi
121
  , testNetwork
122
  , testObjects
123
  , testOpCodes
124
  , testQuery_Aliases
125
  , testQuery_Filter
126
  , testQuery_Language
127
  , testQuery_Network
128
  , testQuery_Query
129
  , testRpc
130
  , testRuntime
131
  , testSsconf
132
  , testStorage_Lvm_LVParser
133
  , testTHH
134
  , testTypes
135
  , testUtils
136
  ]
137

    
138
-- | Main function. Note we don't use defaultMain since we want to
139
-- control explicitly our test sizes (and override the default).
140
main :: IO ()
141
main = do
142
  ropts <- getArgs >>= interpretArgsOrExit
143
  let opts = maybe defOpts (defOpts `mappend`) $ ropt_test_options ropts
144
  -- silence the logging system, so that tests can execute I/O actions
145
  -- which create logs without polluting stderr
146
  -- FIXME: improve this by allowing tests to use logging if needed
147
  updateGlobalLogger rootLoggerName (setLevel EMERGENCY)
148
  defaultMainWithOpts allTests (ropts { ropt_test_options = Just opts })