Skip to content

Commit

Permalink
Add env var to disable skip cache
Browse files Browse the repository at this point in the history
DISABLE_SKIP_CACHE=1 can be used to disable the skip cache. This
does not control the extensions cache.

See https://externals.io/message/116044 for related discussion.

Closes phpGH-7510.
  • Loading branch information
nikic committed Sep 29, 2021
1 parent b94b97f commit 9fc6be2
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions run-tests.php
Original file line number Diff line number Diff line change
Expand Up @@ -1866,7 +1866,8 @@ function run_test(string $php, $file, array $env): string

static $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;
Expand Down Expand Up @@ -3659,6 +3660,7 @@ private function mergeSuites(array &$dest, array $source): void

class SkipCache
{
private bool $enable;
private bool $keepFile;

private array $skips = [];
Expand All @@ -3669,8 +3671,9 @@ class SkipCache
private int $extHits = 0;
private int $extMisses = 0;

public function __construct(bool $keepFile)
public function __construct(bool $enable, bool $keepFile)
{
$this->enable = $enable;
$this->keepFile = $keepFile;
}

Expand All @@ -3691,10 +3694,10 @@ public function checkSkip(string $php, string $code, string $checkFile, string $

save_text($checkFile, $code, $tempFile);
$result = trim(system_with_timeout("$php \"$checkFile\"", $env));
if (strpos($result, 'nocache') !== 0) {
$this->skips[$key][$code] = $result;
} else {
if (strpos($result, 'nocache') === 0) {
$result = '';
} else if ($this->enable) {
$this->skips[$key][$code] = $result;
}
$this->misses++;

Expand Down

0 comments on commit 9fc6be2

Please sign in to comment.