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_ed25519.c b/tests/test_ed25519.c
index 714a88a..ccdcebc 100644
--- a/tests/test_ed25519.c
+++ b/tests/test_ed25519.c
@@ -92,7 +92,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);
assert_non_null(session);
nc_session_free(session, NULL);
@@ -153,7 +153,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_pubkey(ctx, "endpt", "test_ed25519", "pubkey", TESTS_DIR "/data/id_ed25519.pub", &tree);