diff options
Diffstat (limited to 'test/core/http/httpcli_test.cc')
-rw-r--r-- | test/core/http/httpcli_test.cc | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/test/core/http/httpcli_test.cc b/test/core/http/httpcli_test.cc index 259e3aa463..346568fcf2 100644 --- a/test/core/http/httpcli_test.cc +++ b/test/core/http/httpcli_test.cc @@ -24,10 +24,11 @@ #include <grpc/support/alloc.h> #include <grpc/support/log.h> #include <grpc/support/string_util.h> -#include <grpc/support/subprocess.h> #include <grpc/support/sync.h> + #include "src/core/lib/iomgr/iomgr.h" #include "test/core/util/port.h" +#include "test/core/util/subprocess.h" #include "test/core/util/test_config.h" static int g_done = 0; @@ -154,10 +155,17 @@ int main(int argc, char** argv) { int arg_shift = 0; /* figure out where we are */ char* root; - if (lslash) { - root = static_cast<char*>(gpr_malloc((size_t)(lslash - me + 1))); - memcpy(root, me, (size_t)(lslash - me)); - root[lslash - me] = 0; + if (lslash != nullptr) { + /* Hack for bazel target */ + if (static_cast<unsigned>(lslash - me) >= (sizeof("http") - 1) && + strncmp(me + (lslash - me) - sizeof("http") + 1, "http", + sizeof("http") - 1) == 0) { + lslash = me + (lslash - me) - sizeof("http"); + } + root = static_cast<char*>( + gpr_malloc(static_cast<size_t>(lslash - me + sizeof("/../..")))); + memcpy(root, me, static_cast<size_t>(lslash - me)); + memcpy(root + (lslash - me), "/../..", sizeof("/../..")); } else { root = gpr_strdup("."); } @@ -167,8 +175,8 @@ int main(int argc, char** argv) { args[0] = gpr_strdup(argv[1]); } else { arg_shift = 1; - gpr_asprintf(&args[0], "%s/../../tools/distrib/python_wrapper.sh", root); - gpr_asprintf(&args[1], "%s/../../test/core/http/test_server.py", root); + gpr_asprintf(&args[0], "%s/test/core/http/python_wrapper.sh", root); + gpr_asprintf(&args[1], "%s/test/core/http/test_server.py", root); } /* start the server */ |