[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 <machenbach@chromium.org>
Reviewed-by: Leszek Swirski <leszeks@chromium.org>
Commit-Queue: Leszek Swirski <leszeks@chromium.org>
Cr-Commit-Position: refs/heads/main@{#85138}
This commit is contained in:
Michael Achenbach 2023-01-05 17:22:02 +01:00 committed by V8 LUCI CQ
parent 302892032c
commit 2f4f3f9829
2 changed files with 12 additions and 2 deletions

View File

@ -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'(?<!gcmole-test\.cc):\d*:\d*:',
':<number>:<number>:',
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)

View File

@ -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:<number>:<number>: 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.