runtests; give each server a unique log lock file

Logs are written by several servers and all of them must be finished
writing before the test results can be determined. This means each
server must have its own lock file rather than sharing a single one,
which is how it was done up to now. Previously, the first server to
complete a test would clear the lock before the other server was done,
which caused flaky tests.

Lock files are now all found in their own directory, so counting locks
equals counting the files in that directory.  The result is that the
proxy logs are now reliably written which actually changes the expected
output for two tests.

Fixes #11231
Closes #11259
This commit is contained in:
Dan Fandrich 2023-06-05 14:50:15 -07:00
parent 7af151ded0
commit 7d62f0d9b8
11 changed files with 53 additions and 21 deletions

View file

@ -1016,8 +1016,8 @@ int main(int argc, char *argv[])
}
}
msnprintf(loglockfile, sizeof(loglockfile), "%s/%s",
logdir, SERVERLOGS_LOCK);
msnprintf(loglockfile, sizeof(loglockfile), "%s/%s/mqtt-%s.lock",
logdir, SERVERLOGS_LOCKDIR, ipv_inuse);
#ifdef WIN32
win32_init();

View file

@ -1149,8 +1149,8 @@ int main(int argc, char *argv[])
}
}
msnprintf(loglockfile, sizeof(loglockfile), "%s/%s",
logdir, SERVERLOGS_LOCK);
msnprintf(loglockfile, sizeof(loglockfile), "%s/%s/rtsp-%s.lock",
logdir, SERVERLOGS_LOCKDIR, ipv_inuse);
#ifdef WIN32
win32_init();

View file

@ -1964,6 +1964,7 @@ int main(int argc, char *argv[])
char port_str[11];
const char *location_str = port_str;
int keepalive_secs = 5;
const char *protocol_type = "HTTP";
/* a default CONNECT port is basically pointless but still ... */
size_t socket_idx;
@ -2008,6 +2009,7 @@ int main(int argc, char *argv[])
else if(!strcmp("--gopher", argv[arg])) {
arg++;
use_gopher = TRUE;
protocol_type = "GOPHER";
end_of_headers = "\r\n"; /* gopher style is much simpler */
}
else if(!strcmp("--ipv4", argv[arg])) {
@ -2109,8 +2111,9 @@ int main(int argc, char *argv[])
}
}
msnprintf(loglockfile, sizeof(loglockfile), "%s/%s",
logdir, SERVERLOGS_LOCK);
msnprintf(loglockfile, sizeof(loglockfile), "%s/%s/sws-%s%s-%s.lock",
logdir, SERVERLOGS_LOCKDIR, protocol_type,
is_proxy ? "-proxy" : "", socket_type);
#ifdef WIN32
win32_init();
@ -2227,7 +2230,7 @@ int main(int argc, char *argv[])
msnprintf(port_str, sizeof(port_str), "port %hu", port);
logmsg("Running %s %s version on %s",
use_gopher?"GOPHER":"HTTP", socket_type, location_str);
protocol_type, socket_type, location_str);
/* start accepting connections */
rc = listen(sock, 5);

View file

@ -647,8 +647,8 @@ int main(int argc, char **argv)
}
}
msnprintf(loglockfile, sizeof(loglockfile), "%s/%s",
logdir, SERVERLOGS_LOCK);
msnprintf(loglockfile, sizeof(loglockfile), "%s/%s/tftp-%s.lock",
logdir, SERVERLOGS_LOCKDIR, ipv_inuse);
#ifdef WIN32
win32_init();

View file

@ -31,8 +31,7 @@ long timediff(struct timeval newer, struct timeval older);
#define TEST_DATA_PATH "%s/data/test%ld"
#define ALTTEST_DATA_PATH "%s/test%ld"
#define SERVERLOGS_LOCK "serverlogs.lock"
#define SERVERLOGS_LOCKDIR "lock" /* within logdir */
/* global variable, where to find the 'data' dir */
extern const char *path;