Compare commits
1 Commits
24f7141c98
...
f84ed1bf6a
| Author | SHA1 | Date | |
|---|---|---|---|
|
f84ed1bf6a
|
@@ -184,6 +184,12 @@ _cleanup_dirs(void)
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
sleep_ms(int ms)
|
||||
{
|
||||
usleep(ms * MS_TO_US);
|
||||
}
|
||||
|
||||
/*
|
||||
* Read available data from fd into output_buffer with timeout.
|
||||
* Returns number of bytes read, 0 on timeout, -1 on error.
|
||||
@@ -263,7 +269,7 @@ prof_start(void)
|
||||
fcntl(fd, F_SETFL, flags | O_NONBLOCK);
|
||||
|
||||
/* Brief wait for process to initialize */
|
||||
usleep(INIT_WAIT_MS * MS_TO_US);
|
||||
sleep_ms(INIT_WAIT_MS);
|
||||
}
|
||||
|
||||
int
|
||||
@@ -279,7 +285,7 @@ init_prof_test(void **state)
|
||||
|
||||
/* Calculate port base: each build uses a different range of
|
||||
* TEST_GROUPS * PORTS_PER_GROUP ports.
|
||||
* Build 0 (local/default): BASE_PORT..+199, Full: same, Minimal: +200, etc.
|
||||
* Build 0 (local/default): 5230-5429, Full: 5230-5429, Minimal: 5430-5629, etc.
|
||||
* Build 0 and Full share the same range because build 0 is for local runs
|
||||
* or sequential run (no parallel builds), while Full/Minimal/NoEncrypt/Default
|
||||
* are used in CI where they run in parallel. */
|
||||
@@ -388,7 +394,7 @@ close_prof_test(void **state)
|
||||
/* Close pty master after brief grace — child gets SIGHUP which
|
||||
* accelerates shutdown instead of waiting for XMPP disconnect
|
||||
* timeout (~5s). */
|
||||
usleep(QUIT_GRACE_MS * MS_TO_US);
|
||||
sleep_ms(QUIT_GRACE_MS);
|
||||
close(fd);
|
||||
fd = 0;
|
||||
int exited = 0;
|
||||
@@ -397,13 +403,13 @@ close_prof_test(void **state)
|
||||
exited = 1;
|
||||
break;
|
||||
}
|
||||
usleep(SHUTDOWN_POLL_MS * MS_TO_US);
|
||||
sleep_ms(SHUTDOWN_POLL_MS);
|
||||
}
|
||||
if (!exited) {
|
||||
kill(child_pid, SIGTERM);
|
||||
for (int i = 0; i < SIGTERM_POLL_MAX; i++) {
|
||||
if (waitpid(child_pid, NULL, WNOHANG) != 0) { exited = 1; break; }
|
||||
usleep(SHUTDOWN_POLL_MS * MS_TO_US);
|
||||
sleep_ms(SHUTDOWN_POLL_MS);
|
||||
}
|
||||
if (!exited) {
|
||||
kill(child_pid, SIGKILL);
|
||||
@@ -434,7 +440,7 @@ prof_input(const char *input)
|
||||
g_string_free(inp_str, TRUE);
|
||||
|
||||
/* Small delay to let profanity process input */
|
||||
usleep(INPUT_DELAY_MS * MS_TO_US);
|
||||
sleep_ms(INPUT_DELAY_MS);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -457,7 +463,7 @@ prof_output_exact(const char *text)
|
||||
return 1;
|
||||
}
|
||||
|
||||
usleep(OUTPUT_POLL_MS * MS_TO_US);
|
||||
sleep_ms(OUTPUT_POLL_MS);
|
||||
}
|
||||
|
||||
return 0;
|
||||
@@ -493,7 +499,7 @@ prof_output_regex(const char *pattern)
|
||||
return 1;
|
||||
}
|
||||
|
||||
usleep(OUTPUT_POLL_MS * MS_TO_US);
|
||||
sleep_ms(OUTPUT_POLL_MS);
|
||||
}
|
||||
|
||||
/* Timeout reached - log diagnostic info */
|
||||
|
||||
Reference in New Issue
Block a user