Esempio n. 1
0
 /** Compute the coverage summary diff */
 function ComputeDifference()
 {
     $build = new Build();
     $build->FillFromId($this->BuildId);
     $previousBuildId = $build->GetPreviousBuildId();
     if ($previousBuildId === FALSE) {
         return;
     }
     // Look at the number of errors and warnings differences
     $coverage = pdo_query("SELECT loctested,locuntested FROM coveragesummary WHERE buildid=" . qnum($this->BuildId));
     if (!$coverage) {
         add_last_sql_error("CoverageSummary:ComputeDifference");
         return false;
     }
     $coverage_array = pdo_fetch_array($coverage);
     $loctested = $coverage_array['loctested'];
     $locuntested = $coverage_array['locuntested'];
     $previouscoverage = pdo_query("SELECT loctested,locuntested FROM coveragesummary WHERE buildid=" . qnum($previousBuildId));
     if (pdo_num_rows($previouscoverage) > 0) {
         $previouscoverage_array = pdo_fetch_array($previouscoverage);
         $previousloctested = $previouscoverage_array['loctested'];
         $previouslocuntested = $previouscoverage_array['locuntested'];
         // Don't log if no diff
         $loctesteddiff = $loctested - $previousloctested;
         $locuntesteddiff = $locuntested - $previouslocuntested;
         if ($loctesteddiff != 0 && $locuntesteddiff != 0) {
             $summaryDiff = new CoverageSummaryDiff();
             $summaryDiff->BuildId = $this->BuildId;
             $summaryDiff->LocTested = $loctesteddiff;
             $summaryDiff->LocTested = $locuntesteddiff;
             $summaryDiff->Insert();
         }
     }
 }
Esempio n. 2
0
 /** Compute the coverage summary diff */
 public function ComputeDifference($previous_parentid = null)
 {
     $build = new Build();
     $build->Id = $this->BuildId;
     $previousBuildId = $build->GetPreviousBuildId($previous_parentid);
     if ($previousBuildId < 1) {
         return;
     }
     // Look at the number of errors and warnings differences
     $coverage = pdo_query('SELECT loctested,locuntested FROM coveragesummary WHERE buildid=' . qnum($this->BuildId));
     if (!$coverage) {
         add_last_sql_error('CoverageSummary:ComputeDifference');
         return false;
     }
     $coverage_array = pdo_fetch_array($coverage);
     $loctested = $coverage_array['loctested'];
     $locuntested = $coverage_array['locuntested'];
     $previouscoverage = pdo_query('SELECT loctested,locuntested FROM coveragesummary WHERE buildid=' . qnum($previousBuildId));
     if (pdo_num_rows($previouscoverage) > 0) {
         $previouscoverage_array = pdo_fetch_array($previouscoverage);
         $previousloctested = $previouscoverage_array['loctested'];
         $previouslocuntested = $previouscoverage_array['locuntested'];
         $summaryDiff = new CoverageSummaryDiff();
         $summaryDiff->BuildId = $this->BuildId;
         $loctesteddiff = $loctested - $previousloctested;
         $locuntesteddiff = $locuntested - $previouslocuntested;
         // Don't log if no diff unless an entry already exists
         // for this build.
         if ($summaryDiff->Exists() || $loctesteddiff != 0 || $locuntesteddiff != 0) {
             $summaryDiff->LocTested = $loctesteddiff;
             $summaryDiff->LocUntested = $locuntesteddiff;
             $summaryDiff->Insert();
         }
     }
 }