示例#1
0
 /**
  * Runs the runner. Before running you should check if run is allowed (isRunAllowed())
  *
  * @see Base\Cli.Runner::run()
  */
 public function run()
 {
     if ($this->isRunAllowed()) {
         $this->initTestRun();
         $this->testRun->run();
     } else {
         throw new Exception('Not allowed to run');
     }
 }
示例#2
0
$euid = posix_getuid();
if ($euid != 0) {
    print "Error, this script must be run as root\n";
    exit(1);
}
// determine os flavor
$distros = array();
$f = exec('cat /etc/issue', $dist, $dRtn);
$distros = explode(' ', $dist[0]);
//echo "DB: distros[0] is:{$distros[0]}\n";
// configure for fossology and install fossology packages.
// Note that after this point, you could just stop if one could rely on the install
// process to give a valid exit code... Another script will run the agent unit
// and functional tests.
// create this class which can be used by any release/os
$testUtils = new TestRun();
// distro can be Debian, Red, Fedora, Ubuntu
switch ($distros[0]) {
    case 'Debian':
        $debian = TRUE;
        // is this needed?
        $debianVersion = $distros[2];
        echo "debian version is:{$debianVersion}\n";
        try {
            $Debian = new ConfigSys($distros[0], $debianVersion);
        } catch (Exception $e) {
            echo "FATAL! could not process ini file for Debian {$debianVersion} system\n";
            exit(1);
        }
        if (insertDeb($Debian) === FALSE) {
            echo "FATAL! cannot insert deb line into /etc/apt/sources.list\n";
示例#3
0
    $msg = $hdr . $error . "\n" . $longMsg . "\n";
    // mailx will not take a string as the message body... save to a tmp
    // file and give it that.
    $tmpFile = tempnam('.', 'testError');
    $F = fopen($tmpFile, 'w') or die("Can not open tmp file {$tmpFile}\n");
    fwrite($F, $msg);
    fclose($F);
    $last = exec("mailx -s 'test Setup Failed' {$mailTo} < {$tmpFile} ", $tossme, $rptGen);
}
// check if we are running under jenkins, and if so, use that path
if (array_key_exists('WORKSPACE', $_ENV)) {
    $JenkinsWkSpace = $_ENV['WORKSPACE'];
    $path = $JenkinsWkSpace;
    print "workspaces path is:{$JenkinsWkSpace}\n";
}
$tonight = new TestRun($path);
// Step 1 update sources
/* not sure the code below will be needed with jenkins...
 print "removing model.dat file so sources will update\n";
 $modelPath = $WORKSPACE . 'fossology/agents/copyright_analysis/model.dat';
 //$last = exec("rm $modelPath 2>&1", $output, $rtn);
 $last = exec("rm -f $modelPath ", $output, $rtn);

 // if the file doesn't exist, that's OK
 if((preg_match('/No such file or directory/',$last, $matches)) != 1)
 {
 if($rtn != 0)
 {
 $error = "Error, could not remove $modelPath, sources will not update, exiting\n";
 print $error;
 reportError($error,NULL);
 /**
  * Updata a test run to reprooved.
  *
  * @param integer $id
  *        	the ID of the model to be updated
  */
 public function actionFailTestRun($id)
 {
     $model = TestRun::model()->findByPk($id);
     // Uncomment the following line if AJAX validation is needed
     // $this->performAjaxValidation($model);
     $model->setAttribute('status', 2);
     if ($model->save()) {
         $this->redirect(array('view', 'id' => $model->id_runs));
     }
     $dataProvider = new CActiveDataProvider('Runs');
     $this->render('index', array('dataProvider' => $dataProvider));
 }
示例#5
0
<?php

require 'vendor/autoload.php';
include 'controllers/test/structure.php';
include 'controllers/test/run.php';
include 'controllers/test/contents.php';
include 'controllers/test/sources.php';
$app = new \Slim\Slim(array('debug' => true));
function cors($response)
{
    $response['Access-Control-Allow-Origin'] = '*';
    $response['Access-Control-Allow-Headers'] = 'Content-Type';
    $response['X-XSS-Protection'] = '0';
}
$response = $app->response();
cors($response);
TestStructure::load($app);
cors($response);
TestRun::load($app);
cors($response);
TestContents::load($app);
cors($response);
TestSources::load($app);
$app->run();
 public function QuantidadeTotal($id)
 {
     $testRuns = TestRun::model()->findAllByAttributes(array('id_runs' => $id));
     $quantidadeTotal = count($testRuns);
     $quanti = Runs::QuantidadePass($id);
     $quantifail = Runs::QuantidadeFail($id);
     //$result = $quanti + $quantifail;
     $porcentagem = floor(($quanti + $quantifail) / ($quantidadeTotal == 0 ? 1 : $quantidadeTotal) * 100);
     return $porcentagem;
 }