Statistics
| Branch: | Tag: | Revision:

root / test / hs / htest.hs @ 285d04a1

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

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

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

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