aboutsummaryrefslogtreecommitdiff
path: root/tests/server
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2020-04-18 23:41:07 +0200
committerDaniel Stenberg <daniel@haxx.se>2020-04-18 23:57:22 +0200
commit7e359bccd2420a88bccf5d174275bfaf0b819e13 (patch)
tree86bcc124bc2c2afd952de98782e0e43190d2c903 /tests/server
parentf99b007cd8cd421442ee25f6543699b4cb7eaacf (diff)
tests: move pingpong server to dynamic listening port
FTP, IMAP, POP3, SMTP and their IPv6 versions are now all on dynamic ports Test 842-845 are unfortunately a bit hard to move over to this concept right now and require "default port" still...
Diffstat (limited to 'tests/server')
-rw-r--r--tests/server/sockfilt.c19
1 files changed, 13 insertions, 6 deletions
diff --git a/tests/server/sockfilt.c b/tests/server/sockfilt.c
index 82bc7b8cf..84c72f960 100644
--- a/tests/server/sockfilt.c
+++ b/tests/server/sockfilt.c
@@ -1304,6 +1304,7 @@ int main(int argc, char *argv[])
curl_socket_t msgsock = CURL_SOCKET_BAD;
int wrotepidfile = 0;
const char *pidname = ".sockfilt.pid";
+ const char *portfile = NULL; /* none by default */
bool juggle_again;
int rc;
int error;
@@ -1331,6 +1332,11 @@ int main(int argc, char *argv[])
if(argc>arg)
pidname = argv[arg++];
}
+ else if(!strcmp("--portfile", argv[arg])) {
+ arg++;
+ if(argc > arg)
+ portfile = argv[arg++];
+ }
else if(!strcmp("--logfile", argv[arg])) {
arg++;
if(argc>arg)
@@ -1360,12 +1366,6 @@ int main(int argc, char *argv[])
if(argc>arg) {
char *endptr;
unsigned long ulnum = strtoul(argv[arg], &endptr, 10);
- if((endptr != argv[arg] + strlen(argv[arg])) ||
- ((ulnum != 0UL) && ((ulnum < 1025UL) || (ulnum > 65535UL)))) {
- fprintf(stderr, "sockfilt: invalid --port argument (%s)\n",
- argv[arg]);
- return 0;
- }
port = curlx_ultous(ulnum);
arg++;
}
@@ -1501,6 +1501,13 @@ int main(int argc, char *argv[])
write_stdout("FAIL\n", 5);
goto sockfilt_cleanup;
}
+ if(portfile) {
+ wrotepidfile = write_portfile(portfile, port);
+ if(!wrotepidfile) {
+ write_stdout("FAIL\n", 5);
+ goto sockfilt_cleanup;
+ }
+ }
do {
juggle_again = juggle(&msgsock, sock, &mode);