25 require_once
'/usr/local/simpletest/unit_tester.php';
26 require_once
'/usr/local/simpletest/collector.php';
27 require_once
'/usr/local/simpletest/web_tester.php';
28 require_once
'/usr/local/simpletest/reporter.php';
29 require_once
'/usr/local/simpletest/extensions/junit_xml_reporter.php';
31 require_once(
'common-Report.php');
40 if(chdir(
'fossology/tests') === FALSE)
42 echo
"FATAL! cannot cd to fossology/tests\n";
49 if(array_key_exists(
'WORKSPACE', $_ENV))
51 $WORKSPACE = $_ENV[
'WORKSPACE'];
55 $xslFile = $WORKSPACE .
'/fossology/tests/Reports/hudson/junit-noframes.xsl';
58 $ckConfig = exec(
'./checkConfig.php', $configOut, $configRtn);
61 echo
"FATAL! Cannot create test configuation file TestEnvironment.php in " .
62 "....fossology/tests\n";
65 $ckTdata = exec(
'./checkTestData.php', $tdOut, $tdRtn);
68 echo
"FATAL! Errors when downloading and installing test data\n";
69 echo
"Errors were:\n";print_r($tdOut) .
"\n";
74 $cmdLine =
"$WORKSPACE" .
'/fossology/tests/runFunctionalTests.php > '.
75 "$WORKSPACE" .
'/fossology/tests/Functional-Test-Results.xml';
76 $lastFunc = exec($cmdLine, $output, $rtn);
81 $inFile = $WORKSPACE .
'/fossology/tests/Functional-Test-Results.xml';
82 $outFile = $WORKSPACE .
'/fossology/tests/Reports/FunctionalTestResults.html';
84 $report = genHtml($inFile, $outFile, $xslFile);
87 echo
"Error: Could not generate an Upload Test HTML report." .
88 "FunctionalTestResults.html.\n";
94 $upFail = check4failures($inFile);
97 echo
"There were errors in $inFile\n";
104 echo
"Failure: Could not check file $inFile for failures\n";
109 if(chdir($home) === FALSE)
111 echo
"FATAL! cannot cd to $home\n";
115 $cmdLine =
"$WORKSPACE" .
'/fossology/tests/runUploadsTest.php > ' .
116 "$WORKSPACE" .
'/fossology/tests/Uploads-Results.xml';
117 $lastFunc = exec($cmdLine, $output, $rtn);
120 echo
"NOTE: Uploads did not finish in 2 hours, will not run Verify Tests\n";
125 $inFile = $WORKSPACE .
'/fossology/tests/Uploads-Results.xml';
126 $outFile = $WORKSPACE .
'/fossology/tests/Reports/UploadsTestResults.html';
129 $report = genHtml($inFile, $outFile, $xslFile);
132 echo
"Error: Could not generate an Upload Test HTML report " .
133 "Uploads-Results.xml.\n";
139 $urFail = check4failures($inFile);
140 if(!is_null($urFail))
142 echo
"There were errors in the $inFile\n";
149 echo
"Failure: Could not check file $inFile for failures\n";
155 $xmlFile =
"$WORKSPACE" .
'/fossology/tests/Uploads-Test-Results.xml';
156 $cmdLine =
"$WORKSPACE" .
'/fossology/tests/runVerifyUploadsTests.php > ' .
158 $lastFunc = exec($cmdLine, $output, $rtn);
162 $inFile = $WORKSPACE .
'/fossology/tests/Uploads-Test-Results.xml';
163 $outFile = $WORKSPACE .
'/fossology/tests/Reports/VerifyTestResults.html';
165 $fileString = file_get_contents($inFile,FALSE ,NULL, 1);
167 $bytes = file_put_contents($inFile, $fileString);
173 $report = genHtml($inFile, $outFile, $xslFile);
176 echo
"Error: Could not generate an Upload Test HTML report " .
177 "VerifyTestResults.html.";
183 $verFail = check4failures($inFile);
184 if(!is_null($verFail))
186 echo
"There were errors in the $inFile\n";
193 echo
"Failure: Could not check file $inFile for failures\n";
200 echo
"ERROR: No data written to file:\n$cacheFile\n";