Disable the tests for fork detection on Linux < 4.14. Apparently we have some on CQ. Change-Id: I915310ad9ca73f04538fa6eadc5abb4e6a6a6964 Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/94987 Reviewed-by: David Benjamin <davidben@google.com> Commit-Queue: David Benjamin <davidben@google.com> Auto-Submit: Rudolf Polzer <rpolzer@google.com>
diff --git a/crypto/rand/fork_detect_test.cc b/crypto/rand/fork_detect_test.cc index 81bcb0d..15f3fc0 100644 --- a/crypto/rand/fork_detect_test.cc +++ b/crypto/rand/fork_detect_test.cc
@@ -30,12 +30,18 @@ #include <unistd.h> #include <functional> +#include <tuple> #if defined(OPENSSL_THREADS) #include <thread> #include <vector> #endif +#if defined(OPENSSL_LINUX) +#include <stdlib.h> +#include <sys/utsname.h> +#endif + #include <gtest/gtest.h> #include <openssl/mem.h> @@ -146,6 +152,21 @@ TEST(ForkDetect, OSSupport) { uint64_t start = CRYPTO_get_fork_generation(); +#if defined(OPENSSL_LINUX) + if (start == 0) { + struct utsname u; + if (uname(&u) == 0) { + const char *dot = strchr(u.release, '.'); + if (dot != nullptr) { + auto version = std::tuple(atoi(u.release), atoi(dot + 1)); + if (version < std::tuple(4, 14)) { + GTEST_SKIP() << "Fork detection not supported on Linux " << u.release + << " which is < 4.14. Skipping test.\n"; + } + } + } + } +#endif EXPECT_NE(start, uint64_t{0}) << "Fork detection not supported, but support is configured to be " "expected on this platform in crypto/rand/internal.h. Typically this "