aboutsummaryrefslogtreecommitdiffhomepage
path: root/test/core/echo/echo_test.c
diff options
context:
space:
mode:
authorGravatar ctiller <ctiller@google.com>2015-01-05 14:40:53 -0800
committerGravatar Craig Tiller <ctiller@google.com>2015-01-05 17:43:10 -0800
commitb3e3317ae8f4f760b8ecf73ccff11261192a795d (patch)
tree43a218380bce459bee43b9fee24cd407cf62d1b6 /test/core/echo/echo_test.c
parent156e67d417f4569b61241793156b8b17d2960dbe (diff)
Seed random numbers in each process based on pid.
This causes get_unused_port_or_die to try different port numbers in each concurrently running tests, and consequently enables some parallelism of test processes. Change on 2015/01/05 by ctiller <ctiller@google.com> ------------- Created by MOE: http://code.google.com/p/moe-java MOE_MIGRATED_REVID=83289374
Diffstat (limited to 'test/core/echo/echo_test.c')
-rw-r--r--test/core/echo/echo_test.c4
1 files changed, 4 insertions, 0 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;