blacklist a port that cannot be bound on WinRBE

pull/22363/head
Jan Tattermusch 5 years ago
parent 7be8cef10a
commit 84ae7981d2
  1. 14
      test/core/util/port_isolated_runtime_environment.cc

@ -43,7 +43,7 @@ static int get_random_port_offset() {
static int s_initial_offset = get_random_port_offset();
static gpr_atm s_pick_counter = 0;
int grpc_pick_unused_port_or_die(void) {
static int pick_unused_port_or_die(void) {
int orig_counter_val =
static_cast<int>(gpr_atm_full_fetch_add(&s_pick_counter, 1));
GPR_ASSERT(orig_counter_val < (MAX_PORT - MIN_PORT + 1));
@ -51,6 +51,18 @@ int grpc_pick_unused_port_or_die(void) {
(s_initial_offset + orig_counter_val) % (MAX_PORT - MIN_PORT + 1);
}
int grpc_pick_unused_port_or_die(void) {
retry:
int port = pick_unused_port_or_die();
// 5985 cannot be bound on Windows RBE and results in
// WSA_ERROR 10013: "An attempt was made to access a socket in a way forbidden
// by its access permissions."
if (port == 5985) {
goto retry;
}
return port;
}
void grpc_recycle_unused_port(int port) { (void)port; }
#endif /* GRPC_PORT_ISOLATED_RUNTIME */

Loading…
Cancel
Save