29 require_once (__DIR__ .
"/../../../testing/db/createEmptyTestEnvironment.php");
39 protected $testfile =
'../testdata/fossology-1.2.0-1.el5.i386.rpm';
71 list($test_name, $this->db_conf, $DB_NAME,
$PG_CONN) = setupTestEnv($cwd,
"pkgagent");
73 $this->agentDir =
'../../agent';
74 $this->pkgagent = $this->agentDir .
'/pkgagent -c ' . $this->db_conf;
87 $last = exec(
"$this->pkgagent -h 2>&1", $usageOut, $rtn);
91 $usage =
"Usage: $this->agentDir/pkgagent [options] [file [file [...]]";
92 $dashI =
'-i :: initialize the database, then exit.';
93 $this->assertEquals($usage, $usageOut[0]);
94 $this->assertEquals($dashI,
trim($usageOut[1]));
107 $last = exec(
"$this->pkgagent -i 2>&1", $got, $rtn);
110 $this->fail(
"pkgagent FAILED!, return value is:$rtn\n");
112 $this->assertTrue(
true);
115 $this->fail(
"pkgagent FAILED! output in -i test\n");
116 print_r($got) .
"\n";
131 $expected = array(
'Name:fossology',
134 'Summary:FOSSology is a licenses exploration tool',
138 $last = exec(
"$this->pkgagent -C $this->testfile 2>&1", $got, $rtn);
143 $this->fail(
"pkgagent FAILED!, no output for test, stopping test");
147 foreach($expected as $match) {
148 if(FALSE === in_array($match, $got)){
149 $this->fail(
"pkgagent FAILED! did not fine $match in output\n");
152 $this->assertEquals(
'OK',$got[$size-1]);
166 $last = exec(
"$this->pkgagent -C -vv $this->testfile 2>&1", $got, $rtn);
171 $this->fail(
"pkgagent FAILED!, no output for -vv test, stopping test");
185 $expected = array(
'Name:fossology',
188 'Summary:FOSSology is a licenses exploration tool',
190 'Name:fossology-1.2.0-1.el5.src.rpm',
194 foreach($expected as $match) {
195 if(FALSE === in_array($match, $got)){
196 $this->fail(
"pkgagent FAILED! did not fine $match in output\n");
199 $this->assertEquals(
'OK',$got[$size-1]);
testI()
Test DB init flag.
testHelp()
Test help message.
testOneRPMV()
Test CLI in verbose with one RPM.
foreach($Options as $Option=> $OptVal) if(0==$reference_flag &&0==$nomos_flag) $PG_CONN
list_t type structure used to keep various lists. (e.g. there are multiple lists).
Test cli parameter i and v and rpm file and no parameters.
testOneRPM()
Test CLI with single RPM.
setUp()
Set up test environment.
char * trim(char *ptext)
Trimming whitespace.