mirror of
https://github.com/dart-lang/sdk
synced 2024-09-15 21:40:07 +00:00
[test] Avoid quadratic complexity in vm/dart/unobfuscated_static_symbols_test
This change makes this test much faster and should fix the timeouts on the slow simarm_x64 configuration. Change-Id: I6ba489d2dee3963bb070c1e86abff88420fa3ce7 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/306900 Reviewed-by: Ryan Macnak <rmacnak@google.com> Commit-Queue: Alexander Markov <alexmarkov@google.com>
This commit is contained in:
parent
e316fb84a1
commit
63d856d487
|
@ -224,27 +224,29 @@ Future<void> checkTraces(
|
|||
|
||||
void checkStaticSymbolTables(TestCase expected, List<TestCase> cases) {
|
||||
final expectedSymbolNames =
|
||||
expected.container.staticSymbols.map((o) => o.name);
|
||||
expected.container.staticSymbols.map((o) => o.name).toSet();
|
||||
|
||||
if (expected.debuggingInfoContainer != null) {
|
||||
expectSimilarStaticSymbols(expectedSymbolNames,
|
||||
expected.debuggingInfoContainer!.staticSymbols.map((o) => o.name));
|
||||
expectSimilarStaticSymbols(
|
||||
expectedSymbolNames,
|
||||
expected.debuggingInfoContainer!.staticSymbols
|
||||
.map((o) => o.name)
|
||||
.toSet());
|
||||
}
|
||||
|
||||
for (final got in cases) {
|
||||
expectSimilarStaticSymbols(
|
||||
expectedSymbolNames, got.container.staticSymbols.map((o) => o.name));
|
||||
expectSimilarStaticSymbols(expectedSymbolNames,
|
||||
got.container.staticSymbols.map((o) => o.name).toSet());
|
||||
if (got.debuggingInfoContainer != null) {
|
||||
expectSimilarStaticSymbols(expectedSymbolNames,
|
||||
got.debuggingInfoContainer!.staticSymbols.map((o) => o.name));
|
||||
got.debuggingInfoContainer!.staticSymbols.map((o) => o.name).toSet());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const kMaxPercentAllowedDifferences = 0.01;
|
||||
|
||||
void expectSimilarStaticSymbols(
|
||||
Iterable<String> expected, Iterable<String> got) {
|
||||
void expectSimilarStaticSymbols(Set<String> expected, Set<String> got) {
|
||||
final allowedDifferences =
|
||||
(expected.length * kMaxPercentAllowedDifferences).floor();
|
||||
// There are cases where we cannot assume that we have the exact same symbols
|
||||
|
|
Loading…
Reference in a new issue