36 require_once
'/usr/local/simpletest/unit_tester.php';
37 require_once
'/usr/local/simpletest/collector.php';
38 require_once
'/usr/local/simpletest/web_tester.php';
39 require_once
'/usr/local/simpletest/reporter.php';
40 require_once
'/usr/local/simpletest/extensions/junit_xml_reporter.php';
42 require_once(
'common-Report.php');
51 if(chdir(
'fossology/tests') === FALSE)
53 echo
"FATAL! cannot cd to fossology/tests\n";
60 if(array_key_exists(
'WORKSPACE', $_ENV))
62 $WORKSPACE = $_ENV[
'WORKSPACE'];
66 $xslFile = $WORKSPACE .
'/fossology/tests/Reports/hudson/junit-noframes.xsl';
69 $ckConfig = exec(
'./checkConfig.php', $configOut, $configRtn);
72 echo
"FATAL! Cannot create test configuation file TestEnvironment.php in " .
73 "....fossology/tests\n";
76 $ckTdata = exec(
'./checkTestData.php', $tdOut, $tdRtn);
79 echo
"FATAL! Errors when downloading and installing test data\n";
80 echo
"Errors were:\n";print_r($tdOut) .
"\n";
85 $cmdLine =
"$WORKSPACE" .
'/fossology/tests/runFunctionalTests.php > '.
86 "$WORKSPACE" .
'/fossology/tests/Functional-Test-Results.xml';
87 $lastFunc = exec($cmdLine, $output, $rtn);
92 $inFile = $WORKSPACE .
'/fossology/tests/Functional-Test-Results.xml';
93 $outFile = $WORKSPACE .
'/fossology/tests/Reports/FunctionalTestResults.html';
95 $report = genHtml($inFile, $outFile, $xslFile);
98 echo
"Error: Could not generate an Upload Test HTML report." .
99 "FunctionalTestResults.html.\n";
105 $upFail = check4failures($inFile);
106 if(!is_null($upFail))
108 echo
"There were errors in $inFile\n";
115 echo
"Failure: Could not check file $inFile for failures\n";
120 if(chdir($home) === FALSE)
122 echo
"FATAL! cannot cd to $home\n";
126 $cmdLine =
"$WORKSPACE" .
'/fossology/tests/runUploadsTest.php > ' .
127 "$WORKSPACE" .
'/fossology/tests/Uploads-Results.xml';
128 $lastFunc = exec($cmdLine, $output, $rtn);
131 echo
"NOTE: Uploads did not finish in 2 hours, will not run Verify Tests\n";
136 $inFile = $WORKSPACE .
'/fossology/tests/Uploads-Results.xml';
137 $outFile = $WORKSPACE .
'/fossology/tests/Reports/UploadsTestResults.html';
140 $report = genHtml($inFile, $outFile, $xslFile);
143 echo
"Error: Could not generate an Upload Test HTML report " .
144 "Uploads-Results.xml.\n";
150 $urFail = check4failures($inFile);
151 if(!is_null($urFail))
153 echo
"There were errors in the $inFile\n";
160 echo
"Failure: Could not check file $inFile for failures\n";
166 $xmlFile =
"$WORKSPACE" .
'/fossology/tests/Uploads-Test-Results.xml';
167 $cmdLine =
"$WORKSPACE" .
'/fossology/tests/runVerifyUploadsTests.php > ' .
169 $lastFunc = exec($cmdLine, $output, $rtn);
173 $inFile = $WORKSPACE .
'/fossology/tests/Uploads-Test-Results.xml';
174 $outFile = $WORKSPACE .
'/fossology/tests/Reports/VerifyTestResults.html';
176 $fileString = file_get_contents($inFile,FALSE ,NULL, 1);
178 $bytes = file_put_contents($inFile, $fileString);
184 $report = genHtml($inFile, $outFile, $xslFile);
187 echo
"Error: Could not generate an Upload Test HTML report " .
188 "VerifyTestResults.html.";
194 $verFail = check4failures($inFile);
195 if(!is_null($verFail))
197 echo
"There were errors in the $inFile\n";
204 echo
"Failure: Could not check file $inFile for failures\n";
211 echo
"ERROR: No data written to file:\n$cacheFile\n";