Statistics
| Branch: | Tag: | Revision:

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

History | View | Annotate | Download (4 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.Block.Diskstats.Parser
37
import Test.Ganeti.Block.Drbd.Parser
38
import Test.Ganeti.Block.Drbd.Types
39
import Test.Ganeti.Common
40
import Test.Ganeti.Confd.Utils
41
import Test.Ganeti.Confd.Types
42
import Test.Ganeti.Daemon
43
import Test.Ganeti.Errors
44
import Test.Ganeti.HTools.Backend.Simu
45
import Test.Ganeti.HTools.Backend.Text
46
import Test.Ganeti.HTools.CLI
47
import Test.Ganeti.HTools.Cluster
48
import Test.Ganeti.HTools.Container
49
import Test.Ganeti.HTools.Graph
50
import Test.Ganeti.HTools.Instance
51
import Test.Ganeti.HTools.Loader
52
import Test.Ganeti.HTools.Node
53
import Test.Ganeti.HTools.PeerMap
54
import Test.Ganeti.HTools.Types
55
import Test.Ganeti.Hypervisor.Xen.XmParser
56
import Test.Ganeti.JSON
57
import Test.Ganeti.Jobs
58
import Test.Ganeti.JQueue
59
import Test.Ganeti.Luxi
60
import Test.Ganeti.Network
61
import Test.Ganeti.Objects
62
import Test.Ganeti.OpCodes
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.THH
71
import Test.Ganeti.Types
72
import Test.Ganeti.Utils
73

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

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

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