aboutsummaryrefslogtreecommitdiffhomepage
path: root/test
diff options
context:
space:
mode:
authorGravatar Jan Tattermusch <jtattermusch@users.noreply.github.com>2016-04-27 16:31:59 -0700
committerGravatar Jan Tattermusch <jtattermusch@users.noreply.github.com>2016-04-27 16:31:59 -0700
commit165c62ff7562d3fb9f9f8afd0b431c7b5fab97e1 (patch)
tree639d059f803b10ba09d33dde2aabd8e885031318 /test
parent4c6fa9b42be2a7bb1d03f7e8a54226f048fdff36 (diff)
parentf5df6472b4028166ea1d51f15bb8ed1455fde472 (diff)
Merge pull request #6183 from nicolasnoble/msys-support
Adding support for msys.
Diffstat (limited to 'test')
-rw-r--r--test/core/util/port_windows.c9
-rw-r--r--test/core/util/test_config.c2
2 files changed, 8 insertions, 3 deletions
diff --git a/test/core/util/port_windows.c b/test/core/util/port_windows.c
index 2b6d3dd223..154d607ec7 100644
--- a/test/core/util/port_windows.c
+++ b/test/core/util/port_windows.c
@@ -51,6 +51,11 @@
#include "src/core/lib/support/env.h"
#include "test/core/util/port_server_client.h"
+#if GPR_GETPID_IN_UNISTD_H
+#include <sys/unistd.h>
+static int _getpid() { return getpid(); }
+#endif
+
#define NUM_RANDOM_PORTS_TO_PICK 100
static int *chosen_ports = NULL;
@@ -114,7 +119,7 @@ static int is_port_available(int *port, int is_tcp) {
/* Try binding to port */
addr.sin_family = AF_INET;
addr.sin_addr.s_addr = INADDR_ANY;
- addr.sin_port = htons(*port);
+ addr.sin_port = htons((u_short)*port);
if (bind(fd, (struct sockaddr *)&addr, sizeof(addr)) < 0) {
gpr_log(GPR_DEBUG, "bind(port=%d) failed: %s", *port, strerror(errno));
closesocket(fd);
@@ -127,7 +132,7 @@ static int is_port_available(int *port, int is_tcp) {
closesocket(fd);
return 0;
}
- GPR_ASSERT(alen <= sizeof(addr));
+ GPR_ASSERT(alen <= (socklen_t)sizeof(addr));
actual_port = ntohs(addr.sin_port);
GPR_ASSERT(actual_port > 0);
if (*port == 0) {
diff --git a/test/core/util/test_config.c b/test/core/util/test_config.c
index 3155a4ece6..62468a5a61 100644
--- a/test/core/util/test_config.c
+++ b/test/core/util/test_config.c
@@ -50,7 +50,7 @@ static unsigned seed(void) { return (unsigned)getpid(); }
#if GPR_GETPID_IN_PROCESS_H
#include <process.h>
-static unsigned seed(void) { return _getpid(); }
+static unsigned seed(void) { return (unsigned)_getpid(); }
#endif
#if GPR_WINDOWS_CRASH_HANDLER