}
// Run the upload verification tests
$xmlFile = "{$WORKSPACE}" . '/fossology/tests/Uploads-Test-Results.xml';
$cmdLine = "{$WORKSPACE}" . '/fossology/tests/runVerifyUploadsTests.php > ' . "{$xmlFile}";
$lastFunc = exec($cmdLine, $output, $rtn);
// remove the blank line at the top of the file
// @todo find out how the blank line is being generated and fix.
$inFile = $WORKSPACE . '/fossology/tests/Uploads-Test-Results.xml';
$outFile = $WORKSPACE . '/fossology/tests/Reports/VerifyTestResults.html';
$fileString = file_get_contents($inFile, FALSE, NULL, 1);
$bytes = 0;
$bytes = file_put_contents($inFile, $fileString);
if ($bytes > 0) {
    // Generate an upload test html report from the junit report
    //echo "Generating html report\n";
    $report = genHtml($inFile, $outFile, $xslFile);
    if (!empty($report)) {
        echo "Error: Could not generate an Upload Test HTML report " . "VerifyTestResults.html.";
    } else {
        try {
            $verFail = check4failures($inFile);
            if (!is_null($verFail)) {
                echo "There were errors in the {$inFile}\n";
                //print_r($verFail) . "\n";
                exit(1);
            }
        } catch (Exception $e) {
            echo "Failure: Could not check file {$inFile} for failures\n";
            exit(1);
        }
    }
Beispiel #2
0
                if (fileCmpSyntax($outFileFull, $etalonFileFull)) {
                    $successCnt++;
                    echo "{$inFile}...OK\n";
                } else {
                    $failedCnt++;
                    echo "{$inFile}...FAIL\n";
                }
            } else {
                if ($mode == 3) {
                    if (fileCmpSymbol($outFileFull, $etalonFileFull)) {
                        $successCnt++;
                        echo "{$inFile}...OK\n";
                    } else {
                        $failedCnt++;
                        echo "{$inFile}...FAIL\n";
                    }
                }
            }
        }
    }
    echo "SUCCESSED/FAILED/UNKNOWN\n";
    echo "{$successCnt}/{$failedCnt}/{$unknownCnt}\n";
}
//argv = [0, in_dir, out_dir, etalon_dir, mode]
//mode: 1 -> lex
//      2 -> syntax
//      3 -> tables
testAll($argv[1], $argv[2], $argv[3], $argv[4]);
if ($argv[4] == 2) {
    genHtml($argv[1], $argv[2]);
}
/**
 * \brief gather and transform the xunit xml results files to html for
 * XUnit style reports
 *
 * NOTE: this function assumes that it is running in
 * ...fossology/src/<module-name>/agent_tests/Functional
 *
 * @param string $unitTest the name of the module to process
 *
 * @return boolean
 *
 * @todo add a second param to indicate unit or functional test, this allows the
 * report to copy results to the correct directory.
 */
function processXunit($unitTest)
{
    if (empty($unitTest)) {
        return FALSE;
    }
    foreach (glob("{$unitTest}*.xml") as $fileName) {
        // remove .xml from name
        $outFile = basename($fileName, '.xml');
        /** functional tests in ./lib/php/tests */
        if ('lib-php' === $unitTest) {
            $outPath = TESTROOT . "/reports/unit/{$outFile}.html";
        } else {
            $outPath = TESTROOT . "/reports/functional/{$outFile}.html";
        }
        // remove the old HTML file before creating a new one.
        $rmLast = exec("rm -rf {$outPath}", $rmOut, $rmRtn);
        $xslPath = TESTROOT . "/reports/junit-noframes.xsl";
        //echo "DB: Starting to generate html report for $fileName\n";
        $report = genHtml($fileName, $outPath, $xslPath);
        if (!empty($report)) {
            echo "Error: Could not generate a HTML Test report from {$fileName}.\n";
            echo "DB: report is:\n{$report}\n";
            return FALSE;
        }
        //echo "DB: Generated html file:$outFile" . ".html\n";
    }
    return TRUE;
}
Beispiel #4
0
function dispHtml($cont, $sp_num)
{
    echo genHtml($cont, $sp_num);
}
Beispiel #5
0
/**
 * \brief transform the xml to html for CUnit style reports
 *
 * @param string $fileName the xml file to transform
 *
 * @return boolean
 */
function genCunitRep($fileName)
{
    if (empty($fileName)) {
        return FALSE;
    }
    // get List or Run string so the correct xsl file is used.
    $xslFile = "CUnit-Run.xsl";
    // default
    if (preg_grep("/Results/", array($fileName))) {
        $xslFile = "CUnit-Run.xsl";
    } else {
        if (preg_grep("/Listing/", array($fileName))) {
            $xslFile = "CUnit-List.xsl";
        }
    }
    // remove .xml from name
    $outFile = basename($fileName, '.xml');
    $outPath = TESTROOT . "/reports/unit/{$outFile}.html";
    $xslPath = "/usr/share/CUnit/{$xslFile}";
    // remove the old HTML file before creating a new one.
    $rmLast = exec("rm -rf {$outPath}", $rmOut, $rmRtn);
    //echo "DB: Starting to generate html report for $fileName\n";
    $report = genHtml($fileName, $outPath, $xslPath);
    if (!empty($report)) {
        echo "Error: Could not generate a HTML Test report from {$fileName}.\n";
        return FALSE;
    }
    //echo "DB: Generated html file:$outFile" . ".html\n";
    return TRUE;
}