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_authkeys.c b/tests/test_authkeys.c
index a7ba7b6..19f5c85 100644
--- a/tests/test_authkeys.c
+++ b/tests/test_authkeys.c
@@ -101,7 +101,7 @@
pthread_barrier_wait(&state->barrier);
/* connect */
- session = nc_connect_ssh("127.0.0.1", 10009, NULL);
+ session = nc_connect_ssh("127.0.0.1", TEST_PORT, NULL);
if (state->expect_ok) {
assert_non_null(session);
} else {
@@ -250,7 +250,7 @@
ret = nc_server_config_add_ssh_hostkey(ctx, "endpt", "hostkey", TESTS_DIR "/data/server.key", NULL, &tree);
assert_int_equal(ret, 0);
- ret = nc_server_config_add_address_port(ctx, "endpt", NC_TI_LIBSSH, "127.0.0.1", 10009, &tree);
+ ret = nc_server_config_add_address_port(ctx, "endpt", NC_TI_LIBSSH, "127.0.0.1", TEST_PORT, &tree);
assert_int_equal(ret, 0);
ret = nc_server_config_add_ssh_user_authkey(ctx, "endpt", "test", &tree);