Merge branch 'PHP-8.1'

* PHP-8.1:
  Add env var to disable skip cache
This commit is contained in:
Nikita Popov 2021-09-29 13:05:34 +02:00
commit c16f01324d

View file

@ -1866,7 +1866,8 @@ function run_test(string $php, $file, array $env): string
static $skipCache; static $skipCache;
if (!$skipCache) { if (!$skipCache) {
$skipCache = new SkipCache($cfg['keep']['skip']); $enableSkipCache = !($env['DISABLE_SKIP_CACHE'] ?? '0');
$skipCache = new SkipCache($enableSkipCache, $cfg['keep']['skip']);
} }
$temp_filenames = null; $temp_filenames = null;
@ -3662,6 +3663,7 @@ class JUnit
class SkipCache class SkipCache
{ {
private bool $enable;
private bool $keepFile; private bool $keepFile;
private array $skips = []; private array $skips = [];
@ -3672,8 +3674,9 @@ class SkipCache
private int $extHits = 0; private int $extHits = 0;
private int $extMisses = 0; private int $extMisses = 0;
public function __construct(bool $keepFile) public function __construct(bool $enable, bool $keepFile)
{ {
$this->enable = $enable;
$this->keepFile = $keepFile; $this->keepFile = $keepFile;
} }
@ -3694,10 +3697,10 @@ class SkipCache
save_text($checkFile, $code, $tempFile); save_text($checkFile, $code, $tempFile);
$result = trim(system_with_timeout("$php \"$checkFile\"", $env)); $result = trim(system_with_timeout("$php \"$checkFile\"", $env));
if (strpos($result, 'nocache') !== 0) { if (strpos($result, 'nocache') === 0) {
$this->skips[$key][$code] = $result;
} else {
$result = ''; $result = '';
} else if ($this->enable) {
$this->skips[$key][$code] = $result;
} }
$this->misses++; $this->misses++;