FOSSology  3.2.0rc1
Open Source License Compliance by Open Source Software
run_tests.c
1 /*
2 Author: Daniele Fognini, Andreas Wuerl
3 Copyright (C) 2013-2015, Siemens AG
4 
5 This program is free software; you can redistribute it and/or
6 modify it under the terms of the GNU General Public License
7 version 2 as published by the Free Software Foundation.
8 
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
13 
14 You should have received a copy of the GNU General Public License along
15 with this program; if not, write to the Free Software Foundation, Inc.,
16 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17 */
18 
19 /* local includes */
20 #include <libfocunit.h>
21 
22 /* cunit includes */
23 #include <libfodbreposysconf.h>
24 
25 #define AGENT_DIR "../../"
26 
28 
29 /* ************************************************************************** */
30 /* **** test case sets ****************************************************** */
31 /* ************************************************************************** */
32 
33 extern CU_TestInfo string_operations_testcases[];
34 extern CU_TestInfo file_operations_testcases[];
35 extern CU_TestInfo license_testcases[];
36 extern CU_TestInfo highlight_testcases[];
37 extern CU_TestInfo hash_testcases[];
38 extern CU_TestInfo diff_testcases[];
39 extern CU_TestInfo match_testcases[];
40 extern CU_TestInfo database_testcases[];
41 extern CU_TestInfo encoding_testcases[];
42 extern CU_TestInfo serialize_testcases[];
43 
44 extern int license_setUpFunc();
45 extern int license_tearDownFunc();
46 
47 extern int database_setUpFunc();
48 extern int database_tearDownFunc();
49 
50 /* ************************************************************************** */
51 /* **** create test suite *************************************************** */
52 /* ************************************************************************** */
53 
54 #if CU_VERSION_P == 213
55 CU_SuiteInfo suites[] = {
56  {"Testing process:", NULL, NULL, NULL, NULL, string_operations_testcases},
57  {"Testing monk:", NULL, NULL, NULL, NULL, file_operations_testcases},
58  {"Testing license:", NULL, NULL, (CU_SetUpFunc)license_setUpFunc, (CU_TearDownFunc)license_tearDownFunc, license_testcases},
59  {"Testing highlighting:", NULL, NULL, NULL, NULL, highlight_testcases},
60  {"Testing hash:", NULL, NULL, NULL, NULL, hash_testcases},
61  {"Testing diff:", NULL, NULL, NULL, NULL, diff_testcases},
62  {"Testing match:", NULL, NULL, NULL, NULL, match_testcases},
63  {"Testing database:", NULL, NULL, (CU_SetUpFunc)database_setUpFunc, (CU_TearDownFunc)database_tearDownFunc, database_testcases},
64  {"Testing encoding:", NULL, NULL, NULL, NULL, encoding_testcases},
65  {"Testing serialize:", NULL, NULL, NULL, NULL, serialize_testcases},
66  CU_SUITE_INFO_NULL
67 };
68 #else
69 CU_SuiteInfo suites[] = {
70  {"Testing process:", NULL, NULL, string_operations_testcases},
71  {"Testing monk:", NULL, NULL, file_operations_testcases},
72  {"Testing license:", license_setUpFunc, license_tearDownFunc, license_testcases},
73  {"Testing highlighting:", NULL, NULL, highlight_testcases},
74  {"Testing hash:", NULL, NULL, hash_testcases},
75  {"Testing diff:", NULL, NULL, diff_testcases},
76  {"Testing match:", NULL, NULL, match_testcases},
77  {"Testing database:", database_setUpFunc, database_tearDownFunc, database_testcases},
78  {"Testing encoding:", NULL, NULL, encoding_testcases},
79  {"Testing serialize:", NULL, NULL, serialize_testcases},
80  CU_SUITE_INFO_NULL
81 };
82 #endif
83 
84 /* ************************************************************************** */
85 /* **** main test functions ************************************************* */
86 /* ************************************************************************** */
87 
88 int main(int argc, char** argv) {
89  dbManager = createTestEnvironment(AGENT_DIR, "monk", 0);
90  const int returnValue = focunit_main(argc, argv, "monk_agent_Tests", suites);
91  if (returnValue == 0) {
92  dropTestEnvironment(dbManager, AGENT_DIR, "monk");
93  } else {
94  printf("preserving test environment in '%s'\n", get_sysconfdir());
95  }
96  return returnValue;
97 }
CU_SuiteInfo suites[]
all test suites for delagent
Definition: run_tests.c:65
fo_dbManager * dbManager
fo_dbManager object
Definition: process.c:28
char * get_sysconfdir()
get sysconfig dir path just created by create_db_repo_sysconf()