OpenDNSSEC-enforcer  1.3.15
test.c
Go to the documentation of this file.
1 /*
2  * $Id: test.c 4643 2011-03-24 14:10:24Z sion $
3  *
4  * Copyright (c) 2008-2009 Nominet UK. All rights reserved.
5  *
6  * Redistribution and use in source and binary forms, with or without
7  * modification, are permitted provided that the following conditions
8  * are met:
9  * 1. Redistributions of source code must retain the above copyright
10  * notice, this list of conditions and the following disclaimer.
11  * 2. Redistributions in binary form must reproduce the above copyright
12  * notice, this list of conditions and the following disclaimer in the
13  * documentation and/or other materials provided with the distribution.
14  *
15  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
16  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
17  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18  * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
19  * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
21  * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
22  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
23  * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
24  * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
25  * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26  *
27  */
28 
29 /*+
30  * Filename: test.c
31  *
32  * Description:
33  * Main routine for the running of the various test programs.
34 -*/
35 
36 #include <assert.h>
37 #include <stdio.h>
38 
39 #include "CUnit/Basic.h"
40 
41 #include "test_routines.h"
42 
43 /* Define the external test routines (each of these creates a suite) */
44 
45 /* Database files */
46 int TestDb(void);
47 int TestDds(void);
48 int TestDis(void);
49 int TestDqs(void);
50 int TestDus(void);
51 int TestDt(void);
52 
53 /* Utility files */
54 int TestKeyword(void);
55 int TestMsg(void);
56 int TestStr(void);
57 int TestStr2(void);
58 
59 /* The KSM files */
60 /*int KsmInitRundown(void);*/
61 /*int KsmKeyword(void); - tested in TestKeyword above */
62 int TestKsmPurge(void);
63 int TestKsmKey(void);
64 int TestKsmParameter(void);
65 int TestKsmRequest(void);
66 int TestKsmKeyDelete(void);
67 /*int TestKsmParameterValue(void);*/
68 int TestKsmUpdate(void);
69 int TestKsmPolicy(void);
70 int TestKsmZone(void);
71 int TestKsmImport(void);
72 
73 /*
74  * main() - Main Testing Routine
75  *
76  * Description:
77  * Runs the tests and prints success or failre.
78  *
79  * Arguments:
80  * -m Print messages from routines in "util".
81  *
82  * Returns:
83  * int
84  * 0 on success
85  * CUnit error code on failure.
86  */
87 
88 int main(int argc, char **argv)
89 {
90  TestInitialize(argc, argv);
91  TcuInitialize();
92 
93  /*
94  * Add the test suites to the registry (with the ones that take the shortest
95  * amount of time first).
96  */
97 
98  if (
99  (! TestDb()) &&
100  (! TestDds()) &&
101  (! TestDis()) &&
102  (! TestDqs()) &&
103  (! TestDus()) &&
104  (! TestDt()) &&
105  (! TestKeyword()) &&
106  (! TestMsg()) &&
107  (! TestStr()) &&
108 /* (! TestStr2()) && */
109  (! TestKsmPurge()) &&
110  (! TestKsmKey()) &&
111  (! TestKsmParameter()) &&
112  (! TestKsmRequest()) &&
113  (! TestKsmKeyDelete()) &&
114  (! TestKsmUpdate()) &&
115  (! TestKsmPolicy()) &&
116  (! TestKsmZone()) &&
117  (! TestKsmImport())
118  ) {
119 
120  /* Run all the tests */
121 
122  TcuExecute();
123  }
124 
125  return CU_get_number_of_failure_records();
126 }