Try again to deal with expensive tests.

BlindingCacheConcurrency is crashing on older macOS in Chromium and
Wycheproof primality tests are timing out on Windows. Just disable them
both by default and reenable only when running tests standalone.

Bug: chromium:1042657
Change-Id: Ib3151e883269d1c03154560c2c6f89467cc0113c
Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/39625
Reviewed-by: Adam Langley <agl@google.com>
diff --git a/crypto/fipsmodule/bn/bn_test.cc b/crypto/fipsmodule/bn/bn_test.cc
index 8fb2ed8..d7db77e 100644
--- a/crypto/fipsmodule/bn/bn_test.cc
+++ b/crypto/fipsmodule/bn/bn_test.cc
@@ -2311,14 +2311,10 @@
       });
 }
 
-// These tests are very slow, so only enable them on x86 to avoid timing out
-// tests in downstream consumers testing on, e.g., old Android devices.
-#if defined(OPENSSL_X86_64) || defined(OPENSSL_X86)
-#define MAYBE_WycheproofPrimality WycheproofPrimality
-#else
-#define MAYBE_WycheproofPrimality DISABLED_WycheproofPrimality
-#endif
-TEST_F(BNTest, MAYBE_WycheproofPrimality) {
+// These tests are very slow, so we disable them by default to avoid timing out
+// downstream consumers. They are enabled when running tests standalone via
+// all_tests.go.
+TEST_F(BNTest, DISABLED_WycheproofPrimality) {
   FileTestGTest(
       "third_party/wycheproof_testvectors/primality_test.txt",
       [&](FileTest *t) {
@@ -2350,14 +2346,7 @@
                                         /*do_trial_division=*/true, nullptr));
           EXPECT_EQ(result.IsValid() ? 1 : 0, is_probably_prime);
         }
-        // Running many large primality tests in a single test case is slow,
-        // so output after test to prevent Chromium from timing out.
-        // Chromium's test infrastructure assume that a test binary not
-        // producing output for too long is hanging.
-        putchar('.');
-        fflush(stdout);
       });
-  putchar('\n');
 }
 
 TEST_F(BNTest, NumBitsWord) {
diff --git a/crypto/rsa_extra/rsa_test.cc b/crypto/rsa_extra/rsa_test.cc
index 76cf50a..e9b68c9 100644
--- a/crypto/rsa_extra/rsa_test.cc
+++ b/crypto/rsa_extra/rsa_test.cc
@@ -1118,13 +1118,14 @@
   }
 }
 
-// This test might be excessively slow on slower CPUs.
+// This test might be excessively slow on slower CPUs or platforms that do not
+// expect server workloads. It is disabled by default and reenabled on some
+// platforms when running tests standalone via all_tests.go.
+//
+// Additionally, even when running disabled tests standalone, limit this to
+// x86_64. On other platforms, this test hits resource limits or is too slow.
 #if defined(OPENSSL_X86_64)
-#define MAYBE_BlindingCacheConcurrency BlindingCacheConcurrency
-#else
-#define MAYBE_BlindingCacheConcurrency DISABLED_BlindingCacheConcurrency
-#endif
-TEST(RSATest, MAYBE_BlindingCacheConcurrency) {
+TEST(RSATest, DISABLED_BlindingCacheConcurrency) {
   bssl::UniquePtr<RSA> rsa(
       RSA_private_key_from_bytes(kKey1, sizeof(kKey1) - 1));
   ASSERT_TRUE(rsa);
@@ -1158,5 +1159,6 @@
     thread.join();
   }
 }
+#endif  // X86_64
 
 #endif  // THREADS
diff --git a/util/all_tests.json b/util/all_tests.json
index 578b727..ca2db25 100644
--- a/util/all_tests.json
+++ b/util/all_tests.json
@@ -1,5 +1,6 @@
 [
 	["crypto/crypto_test"],
+	["crypto/crypto_test", "--gtest_also_run_disabled_tests", "--gtest_filter=RSATest.DISABLED_BlindingCacheConcurrency:BNTest.DISABLED_WycheproofPrimality"],
 	["crypto/urandom_test"],
 	["$OPENSSL_ia32cap=~0x4000000000000000", "crypto/urandom_test"],
 	["crypto/crypto_test", "--fork_unsafe_buffering", "--gtest_filter=RandTest.*:-RandTest.Fork"],