Add a macro to enable replacing the default with a custom port picker
diff --git a/include/grpc/support/port_platform.h b/include/grpc/support/port_platform.h
index 9b639cf..41185db 100644
--- a/include/grpc/support/port_platform.h
+++ b/include/grpc/support/port_platform.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;
diff --git a/test/core/util/port_posix.c b/test/core/util/port_posix.c
index 36f13e1..7467c2f 100644
--- a/test/core/util/port_posix.c
+++ b/test/core/util/port_posix.c
@@ -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"
 
@@ -125,7 +126,7 @@
     } else {
       port = 0;
     }
-    
+
     if (!is_port_available(&port, is_tcp)) {
       continue;
     }
@@ -155,4 +156,4 @@
   return port;
 }
 
-#endif /* GPR_POSIX_SOCKET */
+#endif /* GPR_POSIX_SOCKET && GRPC_TEST_PICK_PORT */
diff --git a/test/core/util/test_config.h b/test/core/util/test_config.h
index 668a069..0b3c543 100644
--- a/test/core/util/test_config.h
+++ b/test/core/util/test_config.h
@@ -59,6 +59,10 @@
   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