Skip to content

review: test: Fixed nondeterministic failures in ProcessingTest.testInitPropertiesWithWrongType()#6500

Merged
monperrus merged 2 commits intoINRIA:masterfrom
yonghanlin:fix/testInitPropertiesWithWrongType-nondeterminism
Nov 8, 2025
Merged

review: test: Fixed nondeterministic failures in ProcessingTest.testInitPropertiesWithWrongType()#6500
monperrus merged 2 commits intoINRIA:masterfrom
yonghanlin:fix/testInitPropertiesWithWrongType-nondeterminism

Conversation

@yonghanlin
Copy link
Contributor

@yonghanlin yonghanlin commented Oct 28, 2025

What does this PR do?

This PR draws inspiration from the earlier PR #6084, which has not seen recent activity. The fix has been re-implemented on the current codebase and updated accordingly. In particular, this PR fixes a nondeterministic test failure in ProcessingTest.testInitPropertiesWithWrongType() when running with NonDex.

Problem

The failures occur when the test applies multiple processor properties within a single ProcessorProperties initialization. In the test, aString, anObject, and anInt were set within the same ProcessorProperties instance. Depending on iteration order, the anInt property could be processed before the valid aString and anObject, causing initProperties() to throw before they were set.

Reproduce Test

To reproduce the failure, run NonDex on . module using the following commands:

mvn -pl . edu.illinois:nondex-maven-plugin:2.1.7:nondex -Dtest=spoon.test.processing.ProcessingTest#testInitPropertiesWithWrongType

The Fix

The test is restructured into two initialization phases:

  1. Apply valid properties (aString, anObject) and verify they are correctly set.
  2. Apply the invalid property (anInt="foo") separately and verify that it triggers SpoonException while leaving other properties unchanged.

@yonghanlin yonghanlin changed the title fix: Prevent nondeterministic failures behavior in ProcessingTest.testInitPropertiesWithWrongType() test: Fixed nondeterministic failures in ProcessingTest.testInitPropertiesWithWrongType() Oct 29, 2025
@yonghanlin yonghanlin changed the title test: Fixed nondeterministic failures in ProcessingTest.testInitPropertiesWithWrongType() review: test: Fixed nondeterministic failures in ProcessingTest.testInitPropertiesWithWrongType() Oct 29, 2025
@monperrus monperrus merged commit 4e80530 into INRIA:master Nov 8, 2025
13 checks passed
@monperrus
Copy link
Collaborator

Thanks a lot @yonghanlin

We like short PRs to improve tests.

Tip: avoid opening many PRs at once, it's easily overwhelming for maintainers. Prefer opening them one by one, one after the other, once the previous one has been merged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants