Statistics
| Branch: | Tag: | Revision:

root / htest / test.hs @ 76a0266e

History | View | Annotate | Download (3.4 kB)

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

    
3
-}
4

    
5
{-
6

    
7
Copyright (C) 2009, 2011, 2012 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

    
32
import Test.Ganeti.TestImports ()
33
import Test.Ganeti.Attoparsec
34
import Test.Ganeti.BasicTypes
35
import Test.Ganeti.Block.Drbd.Parser
36
import Test.Ganeti.Block.Drbd.Types
37
import Test.Ganeti.Common
38
import Test.Ganeti.Confd.Utils
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.JSON
53
import Test.Ganeti.Jobs
54
import Test.Ganeti.Luxi
55
import Test.Ganeti.Network
56
import Test.Ganeti.Objects
57
import Test.Ganeti.OpCodes
58
import Test.Ganeti.Query.Filter
59
import Test.Ganeti.Query.Language
60
import Test.Ganeti.Query.Query
61
import Test.Ganeti.Rpc
62
import Test.Ganeti.Ssconf
63
import Test.Ganeti.THH
64
import Test.Ganeti.Types
65
import Test.Ganeti.Utils
66

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

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

    
117
-- | Main function. Note we don't use defaultMain since we want to
118
-- control explicitly our test sizes (and override the default).
119
main :: IO ()
120
main = do
121
  ropts <- getArgs >>= interpretArgsOrExit
122
  let opts = maybe defOpts (defOpts `mappend`) $ ropt_test_options ropts
123
  defaultMainWithOpts allTests (ropts { ropt_test_options = Just opts })