Skip to content

Commit 8643dd6

Browse files
cpovirkGoogle Java Core Libraries
authored andcommitted
Fix testPutSingleInterrupt under Android Marshmallow by working around what seems to be a long-since-fixed ART bug.
The test broke after d417c5b, going undetected at presubmit time because a tool decided to skip some of our tests to save resources. RELNOTES=n/a PiperOrigin-RevId: 825661598
1 parent c797198 commit 8643dd6

File tree

2 files changed

+26
-0
lines changed

2 files changed

+26
-0
lines changed

android/guava-tests/test/com/google/common/util/concurrent/UninterruptiblesTest.java

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,19 @@ protected void setUp() {
7878
+ "Some test probably didn't clear the interrupt state");
7979
}
8080

81+
/*
82+
* b/456222735: Initialize Truth up front. Android Marshmallow appears to sometimes clear the
83+
* interrupt bit when requesting class initialization, breaking our tests that check that the
84+
* interrupt bit is set when appropriate.
85+
*
86+
* Merely calling assert_(), while apparently enough to clear the interrupt in my experiments,
87+
* is not enough to make the test reliably pass. (Presumably it leaves more classes to be
88+
* initialized later, at which point they cause more clearing of the interrupt?) It's not
89+
* obvious that the following assertion is necessarily enough, either, but in practice, it seems
90+
* to work, at least with the current set of Truth classes that this test uses.
91+
*/
92+
assertThat(1L).isGreaterThan(0);
93+
8194
tearDownStack.addTearDown(
8295
new TearDown() {
8396
@Override

guava-tests/test/com/google/common/util/concurrent/UninterruptiblesTest.java

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,19 @@ protected void setUp() {
7878
+ "Some test probably didn't clear the interrupt state");
7979
}
8080

81+
/*
82+
* b/456222735: Initialize Truth up front. Android Marshmallow appears to sometimes clear the
83+
* interrupt bit when requesting class initialization, breaking our tests that check that the
84+
* interrupt bit is set when appropriate.
85+
*
86+
* Merely calling assert_(), while apparently enough to clear the interrupt in my experiments,
87+
* is not enough to make the test reliably pass. (Presumably it leaves more classes to be
88+
* initialized later, at which point they cause more clearing of the interrupt?) It's not
89+
* obvious that the following assertion is necessarily enough, either, but in practice, it seems
90+
* to work, at least with the current set of Truth classes that this test uses.
91+
*/
92+
assertThat(1L).isGreaterThan(0);
93+
8194
tearDownStack.addTearDown(
8295
new TearDown() {
8396
@Override

0 commit comments

Comments
 (0)