aboutsummaryrefslogtreecommitdiffhomepage
path: root/test
diff options
context:
space:
mode:
authorGravatar Nicolas "Pixel" Noble <pixel@nobis-crew.org>2015-12-15 02:46:16 +0100
committerGravatar Nicolas "Pixel" Noble <pixel@nobis-crew.org>2015-12-15 02:46:16 +0100
commitc27a99b0994926c59a878dad0fcbad31a371c546 (patch)
treeae8847c0a550c0f9d4f6e55d3ab54b2139b76b77 /test
parentb334855aaea546686c2e494b40e4fcba15071336 (diff)
Allows http(s)cli_test's server.py override.
Diffstat (limited to 'test')
-rw-r--r--test/core/httpcli/httpcli_test.c21
-rw-r--r--test/core/httpcli/httpscli_test.c21
2 files changed, 28 insertions, 14 deletions
diff --git a/test/core/httpcli/httpcli_test.c b/test/core/httpcli/httpcli_test.c
index d47774251a..fc51cb0101 100644
--- a/test/core/httpcli/httpcli_test.c
+++ b/test/core/httpcli/httpcli_test.c
@@ -142,19 +142,26 @@ int main(int argc, char **argv) {
char *me = argv[0];
char *lslash = strrchr(me, '/');
char *args[4];
- char root[1024];
int port = grpc_pick_unused_port_or_die();
- /* figure out where we are */
- if (lslash) {
- memcpy(root, me, (size_t)(lslash - me));
- root[lslash - me] = 0;
+ GPR_ASSERT(argc <= 2);
+ if (argc == 2) {
+ args[0] = gpr_strdup(argv[1]);
} else {
- strcpy(root, ".");
+ /* figure out where we are */
+ char *root;
+ if (lslash) {
+ root = gpr_malloc(lslash - me + 1);
+ memcpy(root, me, (size_t)(lslash - me));
+ root[lslash - me] = 0;
+ } else {
+ root = strdup(".");
+ }
+ gpr_asprintf(&args[0], "%s/../../test/core/httpcli/test_server.py", root);
+ gpr_free(root);
}
/* start the server */
- gpr_asprintf(&args[0], "%s/../../test/core/httpcli/test_server.py", root);
args[1] = "--port";
gpr_asprintf(&args[2], "%d", port);
server = gpr_subprocess_create(3, (const char **)args);
diff --git a/test/core/httpcli/httpscli_test.c b/test/core/httpcli/httpscli_test.c
index b1c1913cae..4cfa9e59b0 100644
--- a/test/core/httpcli/httpscli_test.c
+++ b/test/core/httpcli/httpscli_test.c
@@ -144,19 +144,26 @@ int main(int argc, char **argv) {
char *me = argv[0];
char *lslash = strrchr(me, '/');
char *args[5];
- char root[1024];
int port = grpc_pick_unused_port_or_die();
- /* figure out where we are */
- if (lslash) {
- memcpy(root, me, (size_t)(lslash - me));
- root[lslash - me] = 0;
+ GPR_ASSERT(argc <= 2);
+ if (argc == 2) {
+ args[0] = gpr_strdup(argv[1]);
} else {
- strcpy(root, ".");
+ /* figure out where we are */
+ char *root;
+ if (lslash) {
+ root = gpr_malloc(lslash - me + 1);
+ memcpy(root, me, (size_t)(lslash - me));
+ root[lslash - me] = 0;
+ } else {
+ strcpy(root, ".");
+ }
+ gpr_asprintf(&args[0], "%s/../../test/core/httpcli/test_server.py", root);
+ gpr_free(root);
}
/* start the server */
- gpr_asprintf(&args[0], "%s/../../test/core/httpcli/test_server.py", root);
args[1] = "--port";
gpr_asprintf(&args[2], "%d", port);
args[3] = "--ssl";