tests: run (some) servers on "any port" #5247
Makes the test servers (sws and ftpserver) for HTTP, Gopher, FTP, IMAP, POP3, SMTP listen on a currently unused port and runtests adapts to that! Removed the need and use of a fixed port number for these tests.
Test case preprocessing
In order to work correctly with flexible port number for all test cases and all protocols, runtests now preprocesses every test case before it is started and the updated test case file is stored as
Sure, just specify a number and that number will be used. But the port numbers for test servers should never be specified like that, not now and not before either. Up until now however, such mistakes were easily let through since it works for most test runs, while this PR will make them never work (well, except for one in many thousands).
The runtests script now always performs variable replacement on the entire test source file before the test gets executed, and saves the updated version in a temporary file (log/test[num]) so that all test case readers/servers can use that version (if present) and thus enjoy the powers of test case variable substitution. This is necessary to allow complete port number freedom. Test 309 is updated to work with a non-fixed port number thanks to this.
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...