Mask object addresses in message assertions - #82
Open
hsbt wants to merge 1 commit into
Open
Conversation
The expected message bakes the receiver's `#inspect` into a heredoc before the block raises, so a moving GC that relocates the receiver in between makes the two addresses disagree. That is why these tests fail intermittently under MMTk. `GC.verify_compaction_references` reproduces the same failure with the default GC. ruby/ruby#18731 Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Eight tests in
test/test_error_highlight.rbfail intermittently under a moving GC. The expected message heredoc evaluates the receiver's#inspectat the call site and bakes in the object address, but the actual message is only built later, when#messageruns inside the block. A GC that relocates the receiver in that window makes the two addresses disagree. Seven of them keep a singleton on the receiver, soname_err_mesg_to_strtakes therb_any_to_sbranch and prints an address regardless of the message format.test_local_variable_getreaches the same place throughrb_inspecton aBinding.I normalize both sides in
assert_error_messagethrough a newmask_addresses, which rewrites0x\h+to0xXXXX. Doing it in the helper covers all eight sites and any future assertion of the same shape, so the individual#inspectcalls stay as they are.Forcing the relocation with
GC.verify_compaction_referencesfails all eight before the change and none after. This is a forward-port of ruby/ruby#18731, and the file stays byte-identical totest/error_highlight/test_error_highlight.rbupstream.Generated with Claude Code