Statistics
| Branch: | Tag: | Revision:

root / test / hs / htest.hs @ b8585908

History | View | Annotate | Download (3.9 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.Drbd.Parser
37
import Test.Ganeti.Block.Drbd.Types
38
import Test.Ganeti.Common
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.Filter
63
import Test.Ganeti.Query.Language
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.THH
69
import Test.Ganeti.Types
70
import Test.Ganeti.Utils
71

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

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

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