From 2f4f3f982948b7c194b5338e0da2a4524bac0657 Mon Sep 17 00:00:00 2001 From: Michael Achenbach Date: Thu, 5 Jan 2023 17:22:02 +0100 Subject: [PATCH] [gcmole] Make gcmole test more robust to unrelated code changes. Bug: v8:13637 Change-Id: I90362d4819151465b9e476441cd662c01dd4a50a Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/4138267 Auto-Submit: Michael Achenbach Reviewed-by: Leszek Swirski Commit-Queue: Leszek Swirski Cr-Commit-Position: refs/heads/main@{#85138} --- tools/gcmole/gcmole.py | 12 +++++++++++- tools/gcmole/test-expectations.txt | 2 +- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/tools/gcmole/gcmole.py b/tools/gcmole/gcmole.py index a6e87fc8e6..c165c135fd 100755 --- a/tools/gcmole/gcmole.py +++ b/tools/gcmole/gcmole.py @@ -505,6 +505,16 @@ def check_correctness_for_arch(files, options): return errors_found +def clean_test_output(output): + """Substitute line number patterns for files except gcmole-test.cc, as + otherwise unrelated code changes require a rebaseline of test expectations. + """ + return re.sub( + r'(?::', + output) + + def has_unexpected_errors(options, errors_found, file_io): """Returns True if error state isn't as expected, False otherwise. @@ -515,7 +525,7 @@ def has_unexpected_errors(options, errors_found, file_io): return errors_found log("Test Run") - output = file_io.getvalue() + output = clean_test_output(file_io.getvalue()) if not errors_found: log("Test file should produce errors, but none were found. Output:") print(output) diff --git a/tools/gcmole/test-expectations.txt b/tools/gcmole/test-expectations.txt index fa3e4b9e28..4b92d78ee6 100644 --- a/tools/gcmole/test-expectations.txt +++ b/tools/gcmole/test-expectations.txt @@ -4,7 +4,7 @@ tools/gcmole/gcmole-test.cc:30:10: warning: Possibly stale variable due to GCs. tools/gcmole/gcmole-test.cc:28:20: note: Call might cause unexpected GC. isolate->heap()->CollectGarbage(OLD_SPACE, GarbageCollectionReason::kTesting); ^ -./src/heap/heap.h:988:21: note: GC call here. +./src/heap/heap.h::: note: GC call here. V8_EXPORT_PRIVATE bool CollectGarbage( ^ tools/gcmole/gcmole-test.cc:48:3: warning: Possible problem with evaluation order with interleaved GCs.