17
17
package com .google .common .util .concurrent ;
18
18
19
19
import static com .google .common .base .StandardSystemProperty .JAVA_SPECIFICATION_VERSION ;
20
+ import static com .google .common .base .StandardSystemProperty .OS_NAME ;
20
21
import static com .google .common .truth .Truth .assertThat ;
21
22
import static com .google .common .truth .Truth .assertWithMessage ;
22
23
@@ -217,6 +218,9 @@ public void testToString_allUnique() throws Exception {
217
218
}
218
219
219
220
public void testToString_oom () throws Exception {
221
+ if (isWindows ()) {
222
+ return ; // TODO: b/136041958 - Some tests in this file are slow, but I'm not sure which.
223
+ }
220
224
SettableFuture <Object > future = SettableFuture .create ();
221
225
future .set (
222
226
new Object () {
@@ -296,6 +300,9 @@ public String pendingToString() {
296
300
@ SuppressWarnings ({"DeprecatedThreadMethods" , "ThreadPriorityCheck" })
297
301
@ AndroidIncompatible // Thread.suspend
298
302
public void testToString_delayedTimeout () throws Exception {
303
+ if (isWindows ()) {
304
+ return ; // TODO: b/136041958 - Some tests in this file are slow, but I'm not sure which.
305
+ }
299
306
Integer javaVersion = Ints .tryParse (JAVA_SPECIFICATION_VERSION .value ());
300
307
// Parsing to an integer might fail because Java 8 returns "1.8" instead of "8."
301
308
// We can continue if it's 1.8, and we can continue if it's an integer in [9, 20).
@@ -385,6 +392,9 @@ public String pendingToString() {
385
392
}
386
393
387
394
public void testCompletionFinishesWithDone () {
395
+ if (isWindows ()) {
396
+ return ; // TODO: b/136041958 - Some tests in this file are slow, but I'm not sure which.
397
+ }
388
398
ExecutorService executor = Executors .newFixedThreadPool (10 );
389
399
for (int i = 0 ; i < 50000 ; i ++) {
390
400
final AbstractFuture <String > future = new AbstractFuture <String >() {};
@@ -436,6 +446,9 @@ public void run() {
436
446
*/
437
447
438
448
public void testFutureBash () {
449
+ if (isWindows ()) {
450
+ return ; // TODO: b/136041958 - Some tests in this file are slow, but I'm not sure which.
451
+ }
439
452
final CyclicBarrier barrier =
440
453
new CyclicBarrier (
441
454
6 // for the setter threads
@@ -617,6 +630,9 @@ public void run() {
617
630
618
631
// setFuture and cancel() interact in more complicated ways than the other setters.
619
632
public void testSetFutureCancelBash () {
633
+ if (isWindows ()) {
634
+ return ; // TODO: b/136041958 - Some tests in this file are slow, but I'm not sure which.
635
+ }
620
636
final int size = 50 ;
621
637
final CyclicBarrier barrier =
622
638
new CyclicBarrier (
@@ -752,6 +768,9 @@ public void run() {
752
768
// Test to ensure that when calling setFuture with a done future only setFuture or cancel can
753
769
// return true.
754
770
public void testSetFutureCancelBash_withDoneFuture () {
771
+ if (isWindows ()) {
772
+ return ; // TODO: b/136041958 - Some tests in this file are slow, but I'm not sure which.
773
+ }
755
774
final CyclicBarrier barrier =
756
775
new CyclicBarrier (
757
776
2 // for the setter threads
@@ -835,6 +854,9 @@ public void run() {
835
854
// In a previous implementation this would cause a stack overflow after ~2000 futures chained
836
855
// together. Now it should only be limited by available memory (and time)
837
856
public void testSetFuture_stackOverflow () {
857
+ if (isWindows ()) {
858
+ return ; // TODO: b/136041958 - Some tests in this file are slow, but I'm not sure which.
859
+ }
838
860
SettableFuture <String > orig = SettableFuture .create ();
839
861
SettableFuture <String > prev = orig ;
840
862
for (int i = 0 ; i < 100000 ; i ++) {
@@ -852,6 +874,9 @@ public void testSetFuture_stackOverflow() {
852
874
@ GwtIncompatible
853
875
@ AndroidIncompatible
854
876
public void testSetFutureToString_stackOverflow () {
877
+ if (isWindows ()) {
878
+ return ; // TODO: b/136041958 - Some tests in this file are slow, but I'm not sure which.
879
+ }
855
880
SettableFuture <String > orig = SettableFuture .create ();
856
881
SettableFuture <String > prev = orig ;
857
882
for (int i = 0 ; i < 100000 ; i ++) {
@@ -1325,4 +1350,8 @@ protected void interruptTask() {
1325
1350
interruptTaskWasCalled = true ;
1326
1351
}
1327
1352
}
1353
+
1354
+ private static boolean isWindows () {
1355
+ return OS_NAME .value ().startsWith ("Windows" );
1356
+ }
1328
1357
}
0 commit comments