Add a macro to enable replacing the default with a custom port picker

pull/1169/head
Yang Gao 10 years ago
parent 1bd4736527
commit 5a5032dd4c
  1. 2
      include/grpc/support/port_platform.h
  2. 5
      test/core/util/port_posix.c
  3. 4
      test/core/util/test_config.h

@ -199,7 +199,7 @@
#endif
#if defined(GPR_POSIX_SOCKET) + defined(GPR_WIN32) != 1
#error Must define exactly one of GPR_POSIX_POLLSET, GPR_WIN32
#error Must define exactly one of GPR_POSIX_SOCKET, GPR_WIN32
#endif
typedef int16_t gpr_int16;

@ -32,7 +32,8 @@
*/
#include <grpc/support/port_platform.h>
#ifdef GPR_POSIX_SOCKET
#include "test/core/util/test_config.h"
#if defined(GPR_POSIX_SOCKET) && defined(GRPC_TEST_PICK_PORT)
#include "test/core/util/port.h"
@ -155,4 +156,4 @@ int grpc_pick_unused_port_or_die(void) {
return port;
}
#endif /* GPR_POSIX_SOCKET */
#endif /* GPR_POSIX_SOCKET && GRPC_TEST_PICK_PORT */

@ -59,6 +59,10 @@ extern "C" {
gpr_time_add(gpr_now(), \
gpr_time_from_micros(GRPC_TEST_SLOWDOWN_FACTOR * 1e3 * (x)))
#ifndef GRPC_TEST_CUSTOM_PICK_PORT
#define GRPC_TEST_PICK_PORT
#endif
void grpc_test_init(int argc, char **argv);
#ifdef __cplusplus

Loading…
Cancel
Save