FOSSology  3.2.0rc1
Open Source License Compliance by Open Source Software
testRun.c
1 /*********************************************************************
2 Copyright (C) 2011-2013 Hewlett-Packard Development Company, L.P.
3 
4 This program is free software; you can redistribute it and/or
5 modify it under the terms of the GNU General Public License
6 version 2 as published by the Free Software Foundation.
7 
8 This program is distributed in the hope that it will be useful,
9 but WITHOUT ANY WARRANTY; without even the implied warranty of
10 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 GNU General Public License for more details.
12 
13 You should have received a copy of the GNU General Public License along
14 with this program; if not, write to the Free Software Foundation, Inc.,
15 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
16  *********************************************************************/
21 #include <stdio.h>
22 #include <stdlib.h>
23 #include <assert.h>
24 #include "CUnit/CUnit.h"
25 #include "CUnit/Automated.h"
26 
27 #include "libfossology.h"
28 #include "libfocunit.h"
29 #include "libfodbreposysconf.h"
30 
31 /* test case sets */
32 extern CU_TestInfo testcases_GetFieldValue[];
33 extern CU_TestInfo testcases_GetMetadata[];
34 //extern CU_TestInfo testcases_ProcessUpload[];
35 extern CU_TestInfo testcases_RecordMetadataRPM[];
36 extern CU_TestInfo testcases_RecordMetadataDEB[];
37 extern CU_TestInfo testcases_GetMetadataDebSource[];
38 extern CU_TestInfo testcases_GetMetadataDebBinary[];
39 
40 char *DBConfFile = NULL;
41 fo_dbManager* dbManager = NULL;
42 
43 #define AGENT_DIR "../../"
44 
48 int PkgagentDBInit()
49 {
50  dbManager = createTestEnvironment(AGENT_DIR, "pkgagent", 1);
52  return dbManager ? 0 : 1;
53 }
54 
58 int PkgagentDBClean()
59 {
60  if (dbManager) {
61  dropTestEnvironment(dbManager, AGENT_DIR, "pkgagent");
62  }
63  return 0;
64 }
65 
66 /* create test suite */
67 #if CU_VERSION_P == 213
68 CU_SuiteInfo suites[] = {
69  {"Testing the function GetFieldValue:", NULL, NULL, NULL, NULL, testcases_GetFieldValue},
70  //{"Testing the function ProcessUpload:", NULL, NULL, NULL, NULL, testcases_ProcessUpload},
71  {"Testing the function RecordMetadataDEB:", NULL, NULL, (CU_SetUpFunc)PkgagentDBInit, (CU_TearDownFunc)PkgagentDBClean, testcases_RecordMetadataDEB},
72  {"Testing the function GetMetadataDebSource:", NULL, NULL, (CU_SetUpFunc)PkgagentDBInit, (CU_TearDownFunc)PkgagentDBClean, testcases_GetMetadataDebSource},
73  {"Testing the function RecordMetadataRPM:", NULL, NULL, (CU_SetUpFunc)PkgagentDBInit, (CU_TearDownFunc)PkgagentDBClean, testcases_RecordMetadataRPM},
74  {"Testing the function GetMetadataDebBinary:", NULL, NULL, (CU_SetUpFunc)PkgagentDBInit, (CU_TearDownFunc)PkgagentDBClean, testcases_GetMetadataDebBinary},
75  {"Testing the function GetMetadata:", NULL, NULL, (CU_SetUpFunc)PkgagentDBInit, (CU_TearDownFunc)PkgagentDBClean, testcases_GetMetadata},
76  CU_SUITE_INFO_NULL
77 };
78 #else
79 CU_SuiteInfo suites[] = {
80  {"Testing the function GetFieldValue:", NULL, NULL, testcases_GetFieldValue},
81  //{"Testing the function ProcessUpload:", NULL, NULL, testcases_ProcessUpload},
82  {"Testing the function RecordMetadataDEB:", PkgagentDBInit, PkgagentDBClean, testcases_RecordMetadataDEB},
83  {"Testing the function GetMetadataDebSource:", PkgagentDBInit, PkgagentDBClean, testcases_GetMetadataDebSource},
84  {"Testing the function RecordMetadataRPM:", PkgagentDBInit, PkgagentDBClean, testcases_RecordMetadataRPM},
85  {"Testing the function GetMetadataDebBinary:", PkgagentDBInit, PkgagentDBClean, testcases_GetMetadataDebBinary},
86  {"Testing the function GetMetadata:", PkgagentDBInit, PkgagentDBClean, testcases_GetMetadata},
87  CU_SUITE_INFO_NULL
88 };
89 #endif
90 
91 int main( int argc, char *argv[] )
92 {
93  return focunit_main(argc, argv, "pkgagent_Tests", suites) ;
94 }
char * DBConfFile
DB conf file location.
Definition: testRun.c:33
CU_TestInfo testcases_GetFieldValue[]
testcases for function GetFieldValue
CU_TestInfo testcases_RecordMetadataDEB[]
testcases for function RecordMetadataDEB
CU_SuiteInfo suites[]
all test suites for delagent
Definition: testRun.h:54
char * get_dbconf()
get Db.conf path just created by create_db_repo_sysconf()
CU_TestInfo testcases_RecordMetadataRPM[]
testcases for function RecordMetadataRPM
int main(int argc, char *argv[])
main test function
Definition: testRun.c:146
CU_TestInfo testcases_GetMetadataDebBinary[]
testcases for function GetMetadataDebBinary and ProcessUpload
The main FOSSology C library.
fo_dbManager * dbManager
fo_dbManager object
Definition: process.c:28
CU_TestInfo testcases_GetMetadata[]
testcases for function GetMetadata
CU_TestInfo testcases_GetMetadataDebSource[]
testcases for function GetMetadataDebSource