diff options
author | Yash Tibrewal <yashkt@google.com> | 2018-01-29 16:36:05 -0800 |
---|---|---|
committer | Yash Tibrewal <yashkt@google.com> | 2018-01-29 16:36:05 -0800 |
commit | ac35926a2f7c41313c3d2c778ffd0695863a7e7d (patch) | |
tree | 6ef460d37976e759db2c40a73c9d0cb9459eb8b9 /test/core/http/httpscli_test.cc | |
parent | e8e2426f985c09b4e81ca997c688a824000607f2 (diff) |
Manually set roots pem env variable for httpscli_test
Diffstat (limited to 'test/core/http/httpscli_test.cc')
-rw-r--r-- | test/core/http/httpscli_test.cc | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/test/core/http/httpscli_test.cc b/test/core/http/httpscli_test.cc index 5f497fc920..92193bb442 100644 --- a/test/core/http/httpscli_test.cc +++ b/test/core/http/httpscli_test.cc @@ -21,11 +21,13 @@ #include <string.h> #include <grpc/grpc.h> +#include <grpc/grpc_security_constants.h> #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/gpr/env.h" #include "src/core/lib/iomgr/iomgr.h" #include "test/core/util/port.h" #include "test/core/util/test_config.h" @@ -154,7 +156,7 @@ int main(int argc, char** argv) { char* root; if (lslash != nullptr) { /* Hack for bazel target */ - if (lslash - me >= (unsigned)(sizeof("http") - 1) && + if ((unsigned)(lslash - me) >= (sizeof("http") - 1) && strncmp(me + (lslash - me) - sizeof("http") + 1, "http", sizeof("http") - 1) == 0) { lslash = me + (lslash - me) - sizeof("http"); @@ -176,6 +178,12 @@ int main(int argc, char** argv) { gpr_asprintf(&args[1], "%s/test/core/http/test_server.py", root); } + /* Set the environment variable for the SSL certificate file */ + char* pem_file; + gpr_asprintf(&pem_file, "%s/src/core/tsi/test_creds/ca.pem", root); + gpr_setenv(GRPC_DEFAULT_SSL_ROOTS_FILE_PATH_ENV_VAR, pem_file); + gpr_free(pem_file); + /* start the server */ args[1 + arg_shift] = const_cast<char*>("--port"); gpr_asprintf(&args[2 + arg_shift], "%d", port); |