root / test / hs / htest.hs @ 4757ccc4
History | View | Annotate | Download (4.3 kB)
1 | 525bfb36 | Iustin Pop | {-| Unittest runner for ganeti-htools. |
---|---|---|---|
2 | 15f4c8ca | Iustin Pop | |
3 | 15f4c8ca | Iustin Pop | -} |
4 | 15f4c8ca | Iustin Pop | |
5 | e2fa2baf | Iustin Pop | {- |
6 | e2fa2baf | Iustin Pop | |
7 | ca7b4f48 | Iustin Pop | Copyright (C) 2009, 2011, 2012, 2013 Google Inc. |
8 | e2fa2baf | Iustin Pop | |
9 | e2fa2baf | Iustin Pop | This program is free software; you can redistribute it and/or modify |
10 | e2fa2baf | Iustin Pop | it under the terms of the GNU General Public License as published by |
11 | e2fa2baf | Iustin Pop | the Free Software Foundation; either version 2 of the License, or |
12 | e2fa2baf | Iustin Pop | (at your option) any later version. |
13 | e2fa2baf | Iustin Pop | |
14 | e2fa2baf | Iustin Pop | This program is distributed in the hope that it will be useful, but |
15 | e2fa2baf | Iustin Pop | WITHOUT ANY WARRANTY; without even the implied warranty of |
16 | e2fa2baf | Iustin Pop | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
17 | e2fa2baf | Iustin Pop | General Public License for more details. |
18 | e2fa2baf | Iustin Pop | |
19 | e2fa2baf | Iustin Pop | You should have received a copy of the GNU General Public License |
20 | e2fa2baf | Iustin Pop | along with this program; if not, write to the Free Software |
21 | e2fa2baf | Iustin Pop | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA |
22 | e2fa2baf | Iustin Pop | 02110-1301, USA. |
23 | e2fa2baf | Iustin Pop | |
24 | e2fa2baf | Iustin Pop | -} |
25 | e2fa2baf | Iustin Pop | |
26 | 15f4c8ca | Iustin Pop | module Main(main) where |
27 | 15f4c8ca | Iustin Pop | |
28 | 95f6c931 | Iustin Pop | import Data.Monoid (mappend) |
29 | 95f6c931 | Iustin Pop | import Test.Framework |
30 | 7345b69b | Iustin Pop | import System.Environment (getArgs) |
31 | a664325e | Iustin Pop | import System.Log.Logger |
32 | 38f536cb | Iustin Pop | |
33 | e4dac3e1 | Jose A. Lopes | import Test.AutoConf |
34 | b88fcdd0 | Iustin Pop | import Test.Ganeti.TestImports () |
35 | 43b3b5c1 | Michele Tartara | import Test.Ganeti.Attoparsec |
36 | 1493a93b | Iustin Pop | import Test.Ganeti.BasicTypes |
37 | 51000365 | Iustin Pop | import Test.Ganeti.Common |
38 | 285d04a1 | Jose A. Lopes | import Test.Ganeti.Constants |
39 | f51eacf3 | Iustin Pop | import Test.Ganeti.Confd.Utils |
40 | fef919b7 | Iustin Pop | import Test.Ganeti.Confd.Types |
41 | 51000365 | Iustin Pop | import Test.Ganeti.Daemon |
42 | ef3ad027 | Iustin Pop | import Test.Ganeti.Errors |
43 | 879d9290 | Iustin Pop | import Test.Ganeti.HTools.Backend.Simu |
44 | 879d9290 | Iustin Pop | import Test.Ganeti.HTools.Backend.Text |
45 | e1ee7d5a | Iustin Pop | import Test.Ganeti.HTools.CLI |
46 | e1ee7d5a | Iustin Pop | import Test.Ganeti.HTools.Cluster |
47 | e1ee7d5a | Iustin Pop | import Test.Ganeti.HTools.Container |
48 | 8e6623c8 | Guido Trotter | import Test.Ganeti.HTools.Graph |
49 | e1ee7d5a | Iustin Pop | import Test.Ganeti.HTools.Instance |
50 | f51eacf3 | Iustin Pop | import Test.Ganeti.HTools.Loader |
51 | e1ee7d5a | Iustin Pop | import Test.Ganeti.HTools.Node |
52 | e1ee7d5a | Iustin Pop | import Test.Ganeti.HTools.PeerMap |
53 | e1ee7d5a | Iustin Pop | import Test.Ganeti.HTools.Types |
54 | b8585908 | Michele Tartara | import Test.Ganeti.Hypervisor.Xen.XmParser |
55 | 2d87bd0a | Iustin Pop | import Test.Ganeti.JSON |
56 | f51eacf3 | Iustin Pop | import Test.Ganeti.Jobs |
57 | aa79e62e | Iustin Pop | import Test.Ganeti.JQueue |
58 | aed2325f | Iustin Pop | import Test.Ganeti.Luxi |
59 | 76a0266e | Helga Velroyen | import Test.Ganeti.Network |
60 | e5a29b6c | Iustin Pop | import Test.Ganeti.Objects |
61 | aed2325f | Iustin Pop | import Test.Ganeti.OpCodes |
62 | 3fd38382 | Hrvoje Ribicic | import Test.Ganeti.Query.Aliases |
63 | 90171729 | Iustin Pop | import Test.Ganeti.Query.Filter |
64 | efa0d4fd | Hrvoje Ribicic | import Test.Ganeti.Query.Instance |
65 | aed2325f | Iustin Pop | import Test.Ganeti.Query.Language |
66 | 834bea99 | Helga Velroyen | import Test.Ganeti.Query.Network |
67 | b9bdc10e | Iustin Pop | import Test.Ganeti.Query.Query |
68 | 305e174c | Iustin Pop | import Test.Ganeti.Rpc |
69 | ca7b4f48 | Iustin Pop | import Test.Ganeti.Runtime |
70 | aed2325f | Iustin Pop | import Test.Ganeti.Ssconf |
71 | 0cf8edad | Michele Tartara | import Test.Ganeti.Storage.Diskstats.Parser |
72 | 0cf8edad | Michele Tartara | import Test.Ganeti.Storage.Drbd.Parser |
73 | 0cf8edad | Michele Tartara | import Test.Ganeti.Storage.Drbd.Types |
74 | 0cf8edad | Michele Tartara | import Test.Ganeti.Storage.Lvm.LVParser |
75 | f51eacf3 | Iustin Pop | import Test.Ganeti.THH |
76 | 5e9deac0 | Iustin Pop | import Test.Ganeti.Types |
77 | 26d62e4c | Iustin Pop | import Test.Ganeti.Utils |
78 | 509809db | Iustin Pop | |
79 | 95f6c931 | Iustin Pop | -- | Our default test options, overring the built-in test-framework |
80 | 44be51aa | Iustin Pop | -- ones (but not the supplied command line parameters). |
81 | 44be51aa | Iustin Pop | defOpts :: TestOptions |
82 | 44be51aa | Iustin Pop | defOpts = TestOptions |
83 | 95f6c931 | Iustin Pop | { topt_seed = Nothing |
84 | 95f6c931 | Iustin Pop | , topt_maximum_generated_tests = Just 500 |
85 | 95f6c931 | Iustin Pop | , topt_maximum_unsuitable_generated_tests = Just 5000 |
86 | 95f6c931 | Iustin Pop | , topt_maximum_test_size = Nothing |
87 | 95f6c931 | Iustin Pop | , topt_maximum_test_depth = Nothing |
88 | 95f6c931 | Iustin Pop | , topt_timeout = Nothing |
89 | 8e4f6d56 | Iustin Pop | } |
90 | 15f4c8ca | Iustin Pop | |
91 | 95f6c931 | Iustin Pop | -- | All our defined tests. |
92 | f842aecd | Iustin Pop | allTests :: [Test] |
93 | 06fe0cea | Iustin Pop | allTests = |
94 | e4dac3e1 | Jose A. Lopes | [ testAutoConf |
95 | e4dac3e1 | Jose A. Lopes | , testBasicTypes |
96 | 43b3b5c1 | Michele Tartara | , testAttoparsec |
97 | 44be51aa | Iustin Pop | , testCommon |
98 | 285d04a1 | Jose A. Lopes | , testConstants |
99 | fef919b7 | Iustin Pop | , testConfd_Types |
100 | 44be51aa | Iustin Pop | , testConfd_Utils |
101 | 44be51aa | Iustin Pop | , testDaemon |
102 | 3ed5cd7e | Michele Tartara | , testBlock_Diskstats_Parser |
103 | fd80be11 | Michele Tartara | , testBlock_Drbd_Parser |
104 | 9de303af | Michele Tartara | , testBlock_Drbd_Types |
105 | ef3ad027 | Iustin Pop | , testErrors |
106 | 879d9290 | Iustin Pop | , testHTools_Backend_Simu |
107 | 879d9290 | Iustin Pop | , testHTools_Backend_Text |
108 | 44be51aa | Iustin Pop | , testHTools_CLI |
109 | 44be51aa | Iustin Pop | , testHTools_Cluster |
110 | 44be51aa | Iustin Pop | , testHTools_Container |
111 | 8e6623c8 | Guido Trotter | , testHTools_Graph |
112 | 44be51aa | Iustin Pop | , testHTools_Instance |
113 | 44be51aa | Iustin Pop | , testHTools_Loader |
114 | 44be51aa | Iustin Pop | , testHTools_Node |
115 | 44be51aa | Iustin Pop | , testHTools_PeerMap |
116 | 44be51aa | Iustin Pop | , testHTools_Types |
117 | b8585908 | Michele Tartara | , testHypervisor_Xen_XmParser |
118 | 44be51aa | Iustin Pop | , testJSON |
119 | 44be51aa | Iustin Pop | , testJobs |
120 | aa79e62e | Iustin Pop | , testJQueue |
121 | 44be51aa | Iustin Pop | , testLuxi |
122 | 76a0266e | Helga Velroyen | , testNetwork |
123 | 44be51aa | Iustin Pop | , testObjects |
124 | 44be51aa | Iustin Pop | , testOpCodes |
125 | 3fd38382 | Hrvoje Ribicic | , testQuery_Aliases |
126 | 44be51aa | Iustin Pop | , testQuery_Filter |
127 | efa0d4fd | Hrvoje Ribicic | , testQuery_Instance |
128 | 44be51aa | Iustin Pop | , testQuery_Language |
129 | 834bea99 | Helga Velroyen | , testQuery_Network |
130 | 44be51aa | Iustin Pop | , testQuery_Query |
131 | 44be51aa | Iustin Pop | , testRpc |
132 | ca7b4f48 | Iustin Pop | , testRuntime |
133 | 44be51aa | Iustin Pop | , testSsconf |
134 | 0cf8edad | Michele Tartara | , testStorage_Lvm_LVParser |
135 | f51eacf3 | Iustin Pop | , testTHH |
136 | 5e9deac0 | Iustin Pop | , testTypes |
137 | 26d62e4c | Iustin Pop | , testUtils |
138 | 06fe0cea | Iustin Pop | ] |
139 | 06fe0cea | Iustin Pop | |
140 | 95f6c931 | Iustin Pop | -- | Main function. Note we don't use defaultMain since we want to |
141 | 95f6c931 | Iustin Pop | -- control explicitly our test sizes (and override the default). |
142 | 38f536cb | Iustin Pop | main :: IO () |
143 | 15f4c8ca | Iustin Pop | main = do |
144 | 95f6c931 | Iustin Pop | ropts <- getArgs >>= interpretArgsOrExit |
145 | 44be51aa | Iustin Pop | let opts = maybe defOpts (defOpts `mappend`) $ ropt_test_options ropts |
146 | a664325e | Iustin Pop | -- silence the logging system, so that tests can execute I/O actions |
147 | a664325e | Iustin Pop | -- which create logs without polluting stderr |
148 | a664325e | Iustin Pop | -- FIXME: improve this by allowing tests to use logging if needed |
149 | a664325e | Iustin Pop | updateGlobalLogger rootLoggerName (setLevel EMERGENCY) |
150 | f842aecd | Iustin Pop | defaultMainWithOpts allTests (ropts { ropt_test_options = Just opts }) |