31 require_once(
'../lib/bootstrap.php');
32 require_once(
'../lib/common-Test.php');
33 require_once(
'../lib/createRC.php');
37 if ( !defined(
'TESTROOT') ) {
38 $TESTROOT = dirname(getcwd());
39 $_ENV[
'TESTROOT'] = $TESTROOT;
40 putenv(
"TESTROOT=$TESTROOT");
41 define(
'TESTROOT',$TESTROOT);
49 if ( array_key_exists(
'WORKSPACE', $_ENV) ) {
50 $WORKSPACE = $_ENV[
'WORKSPACE'];
53 $func = TESTROOT .
"/functional";
55 if ( @chdir($func) === FALSE ) {
57 echo
"FATAL!, could not cd to:\n$func\n";
65 putenv(
"SYSCONFDIR={$GLOBALS['SYSCONFDIR']}");
66 $_ENV[
'SYSCONFDIR'] = $GLOBALS[
'SYSCONFDIR'];
72 $modules = parse_ini_file(
'../dataFiles/funcTests.ini',1);
73 foreach ($modules as $key => $value) {
78 if ( is_null($WORKSPACE) ) {
80 backToParent(
'../..');
83 if (@chdir($WORKSPACE .
"/src") === FALSE)
85 echo
"FATAL! " . __FILE__ .
" could not cd to " . $WORKSPACE .
"/src\n";
91 $original_directory = getcwd();
95 foreach ( $funcList as $funcTest ) {
98 chdir($original_directory);
104 $other = substr($funcTest, 0, 3);
111 if($other ==
'lib' || $other ==
'cli') {
113 if(@chdir($funcTest .
'/tests') === FALSE) {
115 echo
"Error! cannot cd to " . $funcTest .
"/tests, skipping test\n";
126 if(@chdir($funcTest .
'/agent_tests/Functional') === FALSE) {
128 echo
"Error! cannot cd to " . $funcTest .
"/agent_tests/Functional, skipping test\n";
135 $Make =
new RunTest($funcTest);
136 $runResults = $Make->MakeTest();
139 if($funcTest ==
'nomos')
141 $diffResult = array();
142 foreach ($Make->makeOutput as $makeOutput)
143 if((strpos($makeOutput,
'< File')!=
false) || (strpos($makeOutput,
'> File')!=
false))
145 $diffResult[] = $makeOutput;
147 if(count($diffResult)!=0)
151 foreach($diffResult as $diff)
152 echo substr($diff, strpos($diff,
'=> ')+3) .
"\n";
153 $runResults[
'nomosfunc'] = count($diffResult);
157 exec(
"cp ./nomos-regression-test.html ".TESTROOT.
"/reports/functional/");
159 $Make->printResults($runResults);
161 if ( !processXUnit($funcTest) ) {
162 echo
"Error! could not create html report for $funcTest at\n" .
163 __FILE__ .
" on " . __LINE__ .
"\n";
class for making an agent unit or functional test
bootstrap($sysconfdir="")
Bootstrap the fossology php library.