Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 0 additions & 29 deletions test/tests/Performance/PatternSafetyTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,6 @@
namespace Aternos\Codex\Minecraft\Test\Performance;

use Aternos\Codex\Analysis\PatternInsightInterface;
use Aternos\Codex\Minecraft\Analysis\Problem\Bukkit\ChunkLoadExceptionProblem;
use Aternos\Codex\Minecraft\Analysis\Problem\Forge\ClientOnlyModProblem;
use Aternos\Codex\Minecraft\Analysis\Problem\Forge\ModFatalProblem;
use Aternos\Codex\Minecraft\Analysis\Problem\Paper\ServerJarInPluginFolderProblem;
use Aternos\Codex\Minecraft\Analysis\Problem\Forge\ModDependencyProblem;
use Aternos\Codex\Minecraft\Test\Logs\TestLog;
use FilesystemIterator;
use Generator;
Expand Down Expand Up @@ -70,14 +65,6 @@ class PatternSafetyTest extends TestCase
"newlines" => "\n",
];

/**
* Patterns that are known to fail on scaled entries or to grow quadratically.
* They are reported as incomplete instead of failing, remove a pattern here when fixing it.
* Which of them actually fails depends on whether PCRE JIT is enabled.
*/
protected const array KNOWN_UNSAFE_PATTERNS = [
];

/**
* @var string[]|null
*/
Expand Down Expand Up @@ -144,8 +131,6 @@ public function test_pattern_works_on_test_log_entries(string $class, int|string
#[DataProvider("providePatterns")]
public function test_pattern_works_on_scaled_entries(string $class, int|string $patternKey, string $pattern): void
{
$this->skipKnownUnsafePattern($class, $patternKey);

$failures = [];
foreach (static::getTestLogEntries() as $logPath => $entries) {
foreach ($entries as $entryIndex => $entry) {
Expand All @@ -168,8 +153,6 @@ public function test_pattern_works_on_scaled_entries(string $class, int|string $
#[DataProvider("providePatterns")]
public function test_pattern_time_grows_linearly(string $class, int|string $patternKey, string $pattern): void
{
$this->skipKnownUnsafePattern($class, $patternKey);

$failures = [];
foreach (static::INPUT_FRAGMENTS as $fragmentName => $fragment) {
$smallInput = str_repeat($fragment, intdiv(static::SMALL_INPUT_SIZE, strlen($fragment)));
Expand Down Expand Up @@ -211,18 +194,6 @@ protected static function findPatternFailure(string $pattern, string $subject, s
);
}

/**
* @param class-string<PatternInsightInterface> $class
* @param int|string $patternKey
* @return void
*/
protected function skipKnownUnsafePattern(string $class, int|string $patternKey): void
{
if (in_array($patternKey, static::KNOWN_UNSAFE_PATTERNS[$class] ?? [], true)) {
$this->markTestIncomplete("Pattern " . $patternKey . " of " . $class . " is known to be unsafe on long entries.");
}
}

/**
* Repeat everything after the first line of the entry until it reaches SCALED_ENTRY_SIZE,
* like a stack trace or mod list that is much longer than in the test log
Expand Down
Loading