Skip to content

Commit a3b4b4a

Browse files
Remove "compare coverage" page (#3617)
The little-used coverage comparison page has been broken on and off for many years, and I'm currently in the process of implementing replacement functionality. This PR strips out all of the old code in preparation for that work.
1 parent c025b0f commit a3b4b4a

File tree

11 files changed

+6
-1061
lines changed

11 files changed

+6
-1061
lines changed

app/Http/Controllers/CoverageController.php

Lines changed: 0 additions & 449 deletions
This file was deleted.

app/Http/Controllers/FilterController.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -122,15 +122,13 @@ private static function getFiltersForPage(string $page_id): array
122122
'subproject',
123123
'testname',
124124
],
125-
'compareCoverage.php' => ['subproject'],
126125
default => [],
127126
};
128127
}
129128

130129
private static function isDatePage(string $page_id): bool
131130
{
132131
switch ($page_id) {
133-
case 'compareCoverage.php':
134132
case 'index.php':
135133
case 'indexchildren.php':
136134
case 'project.php':

app/cdash/include/filterdataFunctions.php

Lines changed: 0 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -436,34 +436,6 @@ public function getSqlField($field): string
436436
}
437437
}
438438

439-
class CompareCoveragePhpFilters extends DefaultFilters
440-
{
441-
public function getDefaultFilter(): array
442-
{
443-
return [
444-
'field' => 'subproject',
445-
'fieldtype' => 'string',
446-
'compare' => 61,
447-
'value' => '',
448-
];
449-
}
450-
451-
public function getSqlField($field): string
452-
{
453-
$sql_field = '';
454-
switch (strtolower($field)) {
455-
case 'subproject':
456-
$sql_field = 'sp.name';
457-
break;
458-
459-
default:
460-
trigger_error("unknown field: $field", E_USER_WARNING);
461-
break;
462-
}
463-
return $sql_field;
464-
}
465-
}
466-
467439
class TestOverviewPhpFilters extends DefaultFilters
468440
{
469441
public function getDefaultFilter(): array
@@ -524,10 +496,6 @@ function createPageSpecificFilters($page_id)
524496
return new TestOverviewPhpFilters();
525497
break;
526498

527-
case 'compareCoverage.php':
528-
return new CompareCoveragePhpFilters();
529-
break;
530-
531499
default:
532500
trigger_error('unknown $page_id value: ' . $page_id .
533501
' Add a new subclass of DefaultFilters for ' . $page_id,

app/cdash/tests/test_aggregatesubprojectcoverage.php

Lines changed: 0 additions & 101 deletions
Original file line numberDiff line numberDiff line change
@@ -190,107 +190,6 @@ public function testVerifyResults()
190190
return $success;
191191
}
192192

193-
public function testCompareCoverage(): void
194-
{
195-
$answers = [
196-
'Total' => [
197-
'debug' => 68.97,
198-
'release' => 51.35,
199-
'aggregate' => 72.97],
200-
'Third Party' => [
201-
'debug' => 100,
202-
'release' => 53.85,
203-
'aggregate' => 69.23],
204-
'Experimental' => [
205-
'debug' => 62.5,
206-
'release' => 50,
207-
'aggregate' => 75],
208-
'Production' => [
209-
'debug' => 62.5,
210-
'release' => 50,
211-
'aggregate' => 75]];
212-
$this->compareCoverageCheck('', $answers);
213-
}
214-
215-
public function testCompareCoverageWithFilters(): void
216-
{
217-
$extra_url = '&filtercount=1&showfilters=1&field1=subproject&compare1=62&value1=MyReleaseOnlyFeature';
218-
$answers = [
219-
'Total' => [
220-
'debug' => 68.97,
221-
'release' => 51.72,
222-
'aggregate' => 79.31],
223-
'Third Party' => [
224-
'debug' => 100,
225-
'release' => 60,
226-
'aggregate' => 100],
227-
'Experimental' => [
228-
'debug' => 62.5,
229-
'release' => 50,
230-
'aggregate' => 75],
231-
'Production' => [
232-
'debug' => 62.5,
233-
'release' => 50,
234-
'aggregate' => 75]];
235-
$this->compareCoverageCheck($extra_url, $answers);
236-
}
237-
238-
public function compareCoverageCheck($extra_url, $answers): void
239-
{
240-
// Load test data from API.
241-
$this->get($this->url . "/api/v1/compareCoverage.php?project=CrossSubProjectExample&date=2016-02-16$extra_url");
242-
$content = $this->getBrowser()->getContent();
243-
$jsonobj = json_decode($content, true);
244-
245-
// Verify correct number of builds.
246-
$num_builds = count($jsonobj['builds']);
247-
if ($num_builds !== 3) {
248-
$this->fail("Expected 3 builds, found $num_builds");
249-
}
250-
251-
// Figure out how to distinguish between our coverage builds.
252-
$builds = [];
253-
foreach ($jsonobj['builds'] as $build) {
254-
switch ($build['name']) {
255-
case 'debug_coverage':
256-
$builds['debug'] = $build['key'];
257-
break;
258-
case 'release_coverage':
259-
$builds['release'] = $build['key'];
260-
break;
261-
case 'Aggregate Coverage':
262-
$builds['aggregate'] = $build['key'];
263-
break;
264-
default:
265-
$this->fail('Unexpected build: ' . $build['name']);
266-
break;
267-
}
268-
}
269-
270-
// Verify number of groups.
271-
$num_groups = count($jsonobj['coveragegroups']);
272-
if ($num_groups !== 4) {
273-
$this->fail("Expected 4 coveragegroups, found $num_groups");
274-
}
275-
276-
// Verify coverage percentage numbers.
277-
foreach ($jsonobj['coveragegroups'] as $group) {
278-
$groupname = $group['label'];
279-
if (!array_key_exists($groupname, $answers)) {
280-
$this->fail("Unexpected group: $groupname");
281-
continue;
282-
}
283-
284-
foreach ($builds as $buildtype => $key) {
285-
$expected = $answers[$groupname][$buildtype];
286-
$found = $group[$key];
287-
if ($expected !== $found) {
288-
$this->fail("Expected $expected but found $found for $buildtype $groupname");
289-
}
290-
}
291-
}
292-
}
293-
294193
public function checkCoverage($coverage, $expected_loctested,
295194
$expected_locuntested, $expected_percentage,
296195
$name)

0 commit comments

Comments
 (0)