tests: allocate ports to bind to via CMake
This fixes parallel test execution. Without this patch, parallel runs
were dying all the time for me (I'm using -j16 because that's what I
have even on this laptop).
This patch is the reason why I was converting the test suite to use
one CMake function call per test.
diff --git a/tests/test_tls.c b/tests/test_tls.c
index 542f7bd..b02bc30 100644
--- a/tests/test_tls.c
+++ b/tests/test_tls.c
@@ -85,7 +85,7 @@
assert_int_equal(ret, 0);
pthread_barrier_wait(&state->barrier);
- session = nc_connect_tls("127.0.0.1", 10005, NULL);
+ session = nc_connect_tls("127.0.0.1", TEST_PORT, NULL);
assert_non_null(session);
nc_session_free(session, NULL);
@@ -138,7 +138,7 @@
assert_int_equal(ret, 0);
/* create new address and port data */
- ret = nc_server_config_add_address_port(ctx, "endpt", NC_TI_OPENSSL, "127.0.0.1", 10005, &tree);
+ ret = nc_server_config_add_address_port(ctx, "endpt", NC_TI_OPENSSL, "127.0.0.1", TEST_PORT, &tree);
assert_int_equal(ret, 0);
/* create new server certificate data */