aboutsummaryrefslogtreecommitdiffhomepage
path: root/test/core/http/httpscli_test.cc
diff options
context:
space:
mode:
authorGravatar Yash Tibrewal <yashkt@google.com>2018-01-26 18:23:41 -0800
committerGravatar Yash Tibrewal <yashkt@google.com>2018-01-26 18:23:41 -0800
commite8e2426f985c09b4e81ca997c688a824000607f2 (patch)
tree5df9ea62956f16629a919d0770ed6bd92e885e87 /test/core/http/httpscli_test.cc
parent2d9e675dcaac033e201ff1c95e948e0b04b44774 (diff)
Bazel fix for httpcli_test
Diffstat (limited to 'test/core/http/httpscli_test.cc')
-rw-r--r--test/core/http/httpscli_test.cc17
1 files changed, 12 insertions, 5 deletions
diff --git a/test/core/http/httpscli_test.cc b/test/core/http/httpscli_test.cc
index adf69f1b16..5f497fc920 100644
--- a/test/core/http/httpscli_test.cc
+++ b/test/core/http/httpscli_test.cc
@@ -152,10 +152,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)));
+ if (lslash != nullptr) {
+ /* Hack for bazel target */
+ if (lslash - me >= (unsigned)(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((size_t)(lslash - me + sizeof("/../.."))));
memcpy(root, me, (size_t)(lslash - me));
- root[lslash - me] = 0;
+ memcpy(root + (lslash - me), "/../..", sizeof("/../.."));
} else {
root = gpr_strdup(".");
}
@@ -165,8 +172,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 */