OpenDNSSEC-enforcer  1.3.4
/build/buildd/opendnssec-1.3.4/enforcer/test/cunit/test.c
Go to the documentation of this file.
00001 /*
00002  * $Id: test.c 4643 2011-03-24 14:10:24Z sion $
00003  *
00004  * Copyright (c) 2008-2009 Nominet UK. All rights reserved.
00005  *
00006  * Redistribution and use in source and binary forms, with or without
00007  * modification, are permitted provided that the following conditions
00008  * are met:
00009  * 1. Redistributions of source code must retain the above copyright
00010  *    notice, this list of conditions and the following disclaimer.
00011  * 2. Redistributions in binary form must reproduce the above copyright
00012  *    notice, this list of conditions and the following disclaimer in the
00013  *    documentation and/or other materials provided with the distribution.
00014  *
00015  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
00016  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
00017  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
00018  * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
00019  * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
00020  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
00021  * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
00022  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
00023  * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
00024  * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
00025  * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00026  *
00027  */
00028 
00029 /*+
00030  * Filename: test.c
00031  *
00032  * Description:
00033  *      Main routine for the running of the various test programs.
00034 -*/
00035 
00036 #include <assert.h>
00037 #include <stdio.h>
00038 
00039 #include "CUnit/Basic.h"
00040 
00041 #include "test_routines.h"
00042 
00043 /* Define the external test routines (each of these creates a suite) */
00044 
00045 /* Database files */
00046 int TestDb(void);
00047 int TestDds(void);
00048 int TestDis(void);
00049 int TestDqs(void);
00050 int TestDus(void);
00051 int TestDt(void);
00052 
00053 /* Utility files */
00054 int TestKeyword(void);
00055 int TestMsg(void);
00056 int TestStr(void);
00057 int TestStr2(void);
00058 
00059 /* The KSM files */
00060 /*int KsmInitRundown(void);*/
00061 /*int KsmKeyword(void); - tested in TestKeyword above */
00062 int TestKsmPurge(void);
00063 int TestKsmKey(void);
00064 int TestKsmParameter(void);
00065 int TestKsmRequest(void);
00066 int TestKsmKeyDelete(void);
00067 /*int TestKsmParameterValue(void);*/
00068 int TestKsmUpdate(void);
00069 int TestKsmPolicy(void);
00070 int TestKsmZone(void);
00071 int TestKsmImport(void);
00072 
00073 /*
00074  * main() - Main Testing Routine
00075  *
00076  * Description:
00077  *      Runs the tests and prints success or failre.
00078  *
00079  * Arguments:
00080  *      -m  Print messages from routines in "util".
00081  *
00082  * Returns:
00083  *      int
00084  *          0 on success
00085  *          CUnit error code on failure.
00086  */
00087 
00088 int main(int argc, char **argv)
00089 {
00090     TestInitialize(argc, argv);
00091     TcuInitialize();
00092 
00093     /*
00094      * Add the test suites to the registry (with the ones that take the shortest
00095      * amount of time first).
00096      */
00097 
00098     if (
00099         (! TestDb()) &&
00100         (! TestDds()) &&
00101         (! TestDis()) &&
00102         (! TestDqs()) &&
00103         (! TestDus()) &&
00104         (! TestDt()) &&
00105         (! TestKeyword()) &&
00106                 (! TestMsg()) &&
00107         (! TestStr()) &&
00108 /*        (! TestStr2()) &&     */
00109         (! TestKsmPurge()) &&
00110         (! TestKsmKey()) &&
00111         (! TestKsmParameter()) &&
00112         (! TestKsmRequest()) &&
00113         (! TestKsmKeyDelete()) &&
00114         (! TestKsmUpdate()) &&
00115         (! TestKsmPolicy()) &&
00116         (! TestKsmZone()) &&
00117         (! TestKsmImport())
00118         ) {
00119 
00120         /* Run all the tests */
00121 
00122         TcuExecute();
00123     }
00124 
00125     return CU_get_number_of_failure_records();
00126 }