mirror of
git://sourceware.org/git/lvm2.git
synced 2024-12-21 13:34:40 +03:00
test: configurable write timeout
Hard-coded 3 minutes is far too short when investigating problems.
This commit is contained in:
parent
448af9ff0b
commit
0ee9d59b48
@ -36,6 +36,7 @@ static int fds[2];
|
||||
|
||||
#define MAX 1024
|
||||
#define MAX_LOG_SIZE (32*1024*1024) /* Default max size of test log */
|
||||
#define WRITE_TIMEOUT (180 * 2) /* 3 minutes */
|
||||
|
||||
struct stats {
|
||||
int nfailed;
|
||||
@ -59,6 +60,7 @@ static int quiet = 0;
|
||||
static const char *results;
|
||||
static unsigned fullbuffer = 0;
|
||||
static int unlimited = 0;
|
||||
static int write_timeout = WRITE_TIMEOUT;
|
||||
|
||||
static time_t harness_start;
|
||||
|
||||
@ -433,13 +435,13 @@ static void run(int i, char *f) {
|
||||
struct timeval selectwait = { .tv_usec = 500000 }; /* 0.5s */
|
||||
|
||||
if ((fullbuffer && fullbuffer++ == 8000) ||
|
||||
(no_write > 180 * 2)) /* a 3 minute timeout */
|
||||
(write_timeout > 0 && no_write > write_timeout))
|
||||
{
|
||||
timeout:
|
||||
kill(pid, SIGINT);
|
||||
sleep(5); /* wait a bit for a reaction */
|
||||
if ((w = waitpid(pid, &st, WNOHANG)) == 0) {
|
||||
if (no_write > 180 * 2)
|
||||
if (write_timeout > 0 && no_write > write_timeout)
|
||||
/*
|
||||
* Kernel traces needed, when stuck for
|
||||
* too long in userspace without producing
|
||||
@ -533,7 +535,8 @@ int main(int argc, char **argv) {
|
||||
const char *result;
|
||||
const char *be_verbose = getenv("VERBOSE"),
|
||||
*be_interactive = getenv("INTERACTIVE"),
|
||||
*be_quiet = getenv("QUIET");;
|
||||
*be_quiet = getenv("QUIET"),
|
||||
*be_write_timeout = getenv("WRITE_TIMEOUT");
|
||||
time_t start = time(NULL);
|
||||
int i;
|
||||
FILE *list;
|
||||
@ -552,6 +555,9 @@ int main(int argc, char **argv) {
|
||||
if (be_quiet)
|
||||
quiet = atoi(be_quiet);
|
||||
|
||||
if (be_write_timeout)
|
||||
write_timeout = atoi(be_write_timeout) * 2;
|
||||
|
||||
results = getenv("LVM_TEST_RESULTS") ? : "results";
|
||||
unlimited = getenv("LVM_TEST_UNLIMITED") ? 1 : 0;
|
||||
(void) snprintf(results_list, sizeof(results_list), "%s/list", results);
|
||||
|
Loading…
Reference in New Issue
Block a user