diff --git a/test/core/echo/echo_test.c b/test/core/echo/echo_test.c index 748e8bc0ef0..16d381fb654 100644 --- a/test/core/echo/echo_test.c +++ b/test/core/echo/echo_test.c @@ -37,6 +37,7 @@ #include #include #include +#include #include #include @@ -80,6 +81,9 @@ int main(int argc, char **argv) { pid_t svr; int ret; int do_ipv6 = 1; + /* seed rng with pid, so we don't end up with the same random numbers as a + concurrently running test binary */ + srand(getpid()); if (!grpc_ipv6_loopback_available()) { gpr_log(GPR_INFO, "Can't bind to ::1. Skipping IPv6 tests."); do_ipv6 = 0; diff --git a/test/core/fling/fling_stream_test.c b/test/core/fling/fling_stream_test.c index a24240ef1d9..f6fe69824b3 100644 --- a/test/core/fling/fling_stream_test.c +++ b/test/core/fling/fling_stream_test.c @@ -37,6 +37,7 @@ #include #include #include +#include #include #include @@ -53,6 +54,9 @@ int main(int argc, char **argv) { char *args[10]; int status; pid_t svr, cli; + /* seed rng with pid, so we don't end up with the same random numbers as a + concurrently running test binary */ + srand(getpid()); /* figure out where we are */ if (lslash) { memcpy(root, me, lslash - me); diff --git a/test/core/fling/fling_test.c b/test/core/fling/fling_test.c index c6b369518cb..4607aa5f988 100644 --- a/test/core/fling/fling_test.c +++ b/test/core/fling/fling_test.c @@ -37,6 +37,7 @@ #include #include #include +#include #include #include @@ -53,6 +54,9 @@ int main(int argc, char **argv) { char *args[10]; int status; pid_t svr, cli; + /* seed rng with pid, so we don't end up with the same random numbers as a + concurrently running test binary */ + srand(getpid()); /* figure out where we are */ if (lslash) { memcpy(root, me, lslash - me); diff --git a/test/core/util/test_config.c b/test/core/util/test_config.c index 993014aa14a..fc5de9bbefb 100644 --- a/test/core/util/test_config.c +++ b/test/core/util/test_config.c @@ -33,4 +33,11 @@ #include "test/core/util/test_config.h" -void grpc_test_init(int argc, char **argv) {} +#include +#include + +void grpc_test_init(int argc, char **argv) { + /* seed rng with pid, so we don't end up with the same random numbers as a + concurrently running test binary */ + srand(getpid()); +}