From 2d86263de3a4f53013c0425a54636d14ff9114fd Mon Sep 17 00:00:00 2001 From: "Nicolas \"Pixel\" Noble" Date: Thu, 3 Mar 2016 23:25:22 +0100 Subject: Added python_wrapper.sh to take care of finding an appropriate version of python from the system. --- test/core/httpcli/httpscli_test.c | 36 ++++++++++++++++++++---------------- 1 file changed, 20 insertions(+), 16 deletions(-) (limited to 'test/core/httpcli/httpscli_test.c') diff --git a/test/core/httpcli/httpscli_test.c b/test/core/httpcli/httpscli_test.c index 7f765bc614..04c57db286 100644 --- a/test/core/httpcli/httpscli_test.c +++ b/test/core/httpcli/httpscli_test.c @@ -146,32 +146,36 @@ int main(int argc, char **argv) { char *lslash = strrchr(me, '/'); char *args[5]; int port = grpc_pick_unused_port_or_die(); + int arg_shift = 0; + /* figure out where we are */ + char *root; + if (lslash) { + root = gpr_malloc((size_t)(lslash - me + 1)); + memcpy(root, me, (size_t)(lslash - me)); + root[lslash - me] = 0; + } else { + root = gpr_strdup("."); + } GPR_ASSERT(argc <= 2); if (argc == 2) { args[0] = gpr_strdup(argv[1]); } else { - /* figure out where we are */ - char *root; - if (lslash) { - root = gpr_malloc((size_t)(lslash - me + 1)); - memcpy(root, me, (size_t)(lslash - me)); - root[lslash - me] = 0; - } else { - root = gpr_strdup("."); - } - gpr_asprintf(&args[0], "%s/../../test/core/httpcli/test_server.py", root); - gpr_free(root); + arg_shift = 1; + gpr_asprintf(&args[0], "%s/../../tools/distrib/python_wrapper.sh", root); + gpr_asprintf(&args[1], "%s/../../test/core/httpcli/test_server.py", root); } /* start the server */ - args[1] = "--port"; - gpr_asprintf(&args[2], "%d", port); - args[3] = "--ssl"; - server = gpr_subprocess_create(4, (const char **)args); + args[1 + arg_shift] = "--port"; + gpr_asprintf(&args[2 + arg_shift], "%d", port); + args[3 + arg_shift] = "--ssl"; + server = gpr_subprocess_create(4 + arg_shift, (const char **)args); GPR_ASSERT(server); gpr_free(args[0]); - gpr_free(args[2]); + if (arg_shift) gpr_free(args[1]); + gpr_free(args[2 + arg_shift]); + gpr_free(root); gpr_sleep_until(gpr_time_add(gpr_now(GPR_CLOCK_REALTIME), gpr_time_from_seconds(5, GPR_TIMESPAN))); -- cgit v1.2.3