aboutsummaryrefslogtreecommitdiffhomepage
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/core/echo/echo_test.c4
-rw-r--r--test/core/fling/fling_stream_test.c4
-rw-r--r--test/core/fling/fling_test.c4
-rw-r--r--test/core/util/test_config.c9
4 files changed, 20 insertions, 1 deletions
diff --git a/test/core/echo/echo_test.c b/test/core/echo/echo_test.c
index 748e8bc0ef..16d381fb65 100644
--- a/test/core/echo/echo_test.c
+++ b/test/core/echo/echo_test.c
@@ -37,6 +37,7 @@
#include <stdio.h>
#include <string.h>
#include <signal.h>
+#include <stdlib.h>
#include <sys/types.h>
#include <sys/wait.h>
@@ -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 a24240ef1d..f6fe69824b 100644
--- a/test/core/fling/fling_stream_test.c
+++ b/test/core/fling/fling_stream_test.c
@@ -37,6 +37,7 @@
#include <stdio.h>
#include <string.h>
#include <signal.h>
+#include <stdlib.h>
#include <sys/types.h>
#include <sys/wait.h>
@@ -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 c6b369518c..4607aa5f98 100644
--- a/test/core/fling/fling_test.c
+++ b/test/core/fling/fling_test.c
@@ -37,6 +37,7 @@
#include <stdio.h>
#include <string.h>
#include <signal.h>
+#include <stdlib.h>
#include <sys/types.h>
#include <sys/wait.h>
@@ -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 993014aa14..fc5de9bbef 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 <stdlib.h>
+#include <unistd.h>
+
+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());
+}