Remove unused code in run-tests.php (#12553)

* chore: remove unused code in run-tests.php

* chore: remove unused code in run-tests.php

---------

Co-authored-by: Marcos Marcolin <marcos@ixcsoft.com.br>
This commit is contained in:
Marcos Marcolin 2023-10-30 13:19:43 -03:00 committed by GitHub
parent 3481f5d7a1
commit 3fd1e57ac0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -471,7 +471,6 @@ function main(): void
$cfg['keep'][$file] = true; $cfg['keep'][$file] = true;
} }
break; break;
//case 'l'
case 'm': case 'm':
$valgrind = new RuntestsValgrind($environment); $valgrind = new RuntestsValgrind($environment);
break; break;
@ -520,7 +519,6 @@ function main(): void
putenv('NO_INTERACTION=1'); putenv('NO_INTERACTION=1');
$environment['NO_INTERACTION'] = 1; $environment['NO_INTERACTION'] = 1;
break; break;
//case 'r'
case 's': case 's':
$output_file = $argv[++$i]; $output_file = $argv[++$i];
$just_save_results = true; $just_save_results = true;
@ -594,7 +592,6 @@ function main(): void
case '--bless': case '--bless':
$bless = true; $bless = true;
break; break;
//case 'w'
case '-': case '-':
// repeat check with full switch // repeat check with full switch
$switch = $argv[$i]; $switch = $argv[$i];
@ -1813,7 +1810,8 @@ function show_file_block(string $file, string $block, ?string $section = null):
} }
} }
function skip_test(string $tested, string $tested_file, string $shortname, string $reason) { function skip_test(string $tested, string $tested_file, string $shortname, string $reason): string
{
global $junit; global $junit;
show_result('SKIP', $tested, $tested_file, "reason: $reason"); show_result('SKIP', $tested, $tested_file, "reason: $reason");
@ -2204,7 +2202,6 @@ TEST $file
return 'SKIPPED'; return 'SKIPPED';
} }
if (!strncasecmp('info', $output, 4) && preg_match('/^info\s*(.+)/i', $output, $m)) { if (!strncasecmp('info', $output, 4) && preg_match('/^info\s*(.+)/i', $output, $m)) {
$info = " (info: $m[1])"; $info = " (info: $m[1])";
} elseif (!strncasecmp('warn', $output, 4) && preg_match('/^warn\s+(.+)/i', $output, $m)) { } elseif (!strncasecmp('warn', $output, 4) && preg_match('/^warn\s+(.+)/i', $output, $m)) {
@ -2935,8 +2932,7 @@ function generate_diff(string $wanted, ?string $wanted_re, string $output): stri
$regex = '/^' . expectf_to_regex($expected). '$/s'; $regex = '/^' . expectf_to_regex($expected). '$/s';
return preg_match($regex, $new); return preg_match($regex, $new);
}); });
$result = $differ->diff($w, $o); return $differ->diff($w, $o);
return $result;
} }
function error(string $message): void function error(string $message): void
@ -3358,7 +3354,7 @@ class JUnit
fwrite($this->fp, $xml); fwrite($this->fp, $xml);
} }
private function getSuitesXML(string $suite_name = '') private function getSuitesXML(string $suite_name = ''): string
{ {
// FIXME: $suite_name gets overwritten // FIXME: $suite_name gets overwritten
$result = ''; $result = '';
@ -3649,17 +3645,6 @@ class SkipCache
return $result; return $result;
} }
// public function __destruct()
// {
// echo "Skips: {$this->hits} hits, {$this->misses} misses.\n";
// echo "Extensions: {$this->extHits} hits, {$this->extMisses} misses.\n";
// echo "Cache distribution:\n";
//
// foreach ($this->skips as $php => $cache) {
// echo "$php: " . count($cache) . "\n";
// }
// }
} }
class RuntestsValgrind class RuntestsValgrind
@ -3669,11 +3654,6 @@ class RuntestsValgrind
protected $version_3_8_0 = false; protected $version_3_8_0 = false;
protected $tool = null; protected $tool = null;
public function getVersion(): string
{
return $this->version;
}
public function getHeader(): string public function getHeader(): string
{ {
return $this->header; return $this->header;
@ -3746,17 +3726,6 @@ class TestFile
return isset($this->sections[$name]); return isset($this->sections[$name]);
} }
public function hasAllSections(string ...$names): bool
{
foreach ($names as $section) {
if (!isset($this->sections[$section])) {
return false;
}
}
return true;
}
public function hasAnySections(string ...$names): bool public function hasAnySections(string ...$names): bool
{ {
foreach ($names as $section) { foreach ($names as $section) {
@ -3981,7 +3950,7 @@ final class Differ
public const OLD = 0; public const OLD = 0;
public const ADDED = 1; public const ADDED = 1;
public const REMOVED = 2; public const REMOVED = 2;
private $outputBuilder; private DiffOutputBuilder $outputBuilder;
private $isEqual; private $isEqual;
public function __construct(callable $isEqual) public function __construct(callable $isEqual)
@ -4043,8 +4012,6 @@ final class Differ
foreach ($end as $token) { foreach ($end as $token) {
$diff[] = [$token, self::OLD]; $diff[] = [$token, self::OLD];
$fromLine++;
$toLine++;
} }
return $diff; return $diff;
@ -4163,7 +4130,6 @@ class DiffOutputBuilder
{ {
global $context_line_count; global $context_line_count;
$i = 0; $i = 0;
$string = '';
$number_len = max(3, strlen((string)count($diffs))); $number_len = max(3, strlen((string)count($diffs)));
$line_number_spec = '%0' . $number_len . 'd'; $line_number_spec = '%0' . $number_len . 'd';
$buffer = fopen('php://memory', 'r+b'); $buffer = fopen('php://memory', 'r+b');