20 require_once(
'../lib/bootstrap.php');
21 require_once(
'../lib/common-Test.php');
22 require_once(
'../lib/createRC.php');
26 if ( !defined(
'TESTROOT') ) {
27 $TESTROOT = dirname(getcwd());
28 $_ENV[
'TESTROOT'] = $TESTROOT;
29 putenv(
"TESTROOT=$TESTROOT");
30 define(
'TESTROOT',$TESTROOT);
38 if ( array_key_exists(
'WORKSPACE', $_ENV) ) {
39 $WORKSPACE = $_ENV[
'WORKSPACE'];
42 $func = TESTROOT .
"/functional";
44 if ( @chdir($func) === FALSE ) {
46 echo
"FATAL!, could not cd to:\n$func\n";
54 putenv(
"SYSCONFDIR={$GLOBALS['SYSCONFDIR']}");
55 $_ENV[
'SYSCONFDIR'] = $GLOBALS[
'SYSCONFDIR'];
61 $modules = parse_ini_file(
'../dataFiles/funcTests.ini',1);
62 foreach ($modules as $key => $value) {
67 if ( is_null($WORKSPACE) ) {
69 backToParent(
'../..');
72 if (@chdir($WORKSPACE .
"/src") === FALSE)
74 echo
"FATAL! " . __FILE__ .
" could not cd to " . $WORKSPACE .
"/src\n";
80 $original_directory = getcwd();
84 foreach ( $funcList as $funcTest ) {
87 chdir($original_directory);
93 $other = substr($funcTest, 0, 3);
100 if($other ==
'lib' || $other ==
'cli') {
102 if(@chdir($funcTest .
'/tests') === FALSE) {
104 echo
"Error! cannot cd to " . $funcTest .
"/tests, skipping test\n";
115 if(@chdir($funcTest .
'/agent_tests/Functional') === FALSE) {
117 echo
"Error! cannot cd to " . $funcTest .
"/agent_tests/Functional, skipping test\n";
124 $Make =
new RunTest($funcTest);
125 $runResults = $Make->MakeTest();
128 if($funcTest ==
'nomos')
130 $diffResult = array();
131 foreach ($Make->makeOutput as $makeOutput)
132 if((strpos($makeOutput,
'< File')!=
false) || (strpos($makeOutput,
'> File')!=
false))
134 $diffResult[] = $makeOutput;
136 if(count($diffResult)!=0)
140 foreach($diffResult as $diff)
141 echo substr($diff, strpos($diff,
'=> ')+3) .
"\n";
142 $runResults[
'nomosfunc'] = count($diffResult);
146 exec(
"cp ./nomos-regression-test.html ".TESTROOT.
"/reports/functional/");
148 $Make->printResults($runResults);
150 if ( !processXUnit($funcTest) ) {
151 echo
"Error! could not create html report for $funcTest at\n" .
152 __FILE__ .
" on " . __LINE__ .
"\n";
class for making an agent unit or functional test
bootstrap($sysconfdir="")
Bootstrap the fossology php library.