diff --git a/README.md b/README.md index c040b4c1..9c785da8 100644 --- a/README.md +++ b/README.md @@ -347,6 +347,13 @@ $ make -C out $ ./out/Debug/run-tests ``` +Some tests are timing sensitive. Relaxing test timeouts may be necessary +on slow or overloaded machines: + +```bash +$ env UV_TEST_TIMEOUT_MULTIPLIER=2 ./out/Debug/run-tests # 10s instead of 5s +``` + #### Run one test The list of all tests is in `test/test-list.h`. diff --git a/test/runner.c b/test/runner.c index a0f5df89..bb50b43b 100644 --- a/test/runner.c +++ b/test/runner.c @@ -20,6 +20,7 @@ */ #include +#include #include #include "runner.h" @@ -167,6 +168,7 @@ int run_test(const char* test, process_info_t processes[1024]; process_info_t *main_proc; task_entry_t* task; + int timeout_multiplier; int process_count; int result; int status; @@ -249,7 +251,22 @@ int run_test(const char* test, goto out; } - result = process_wait(main_proc, 1, task->timeout); + timeout_multiplier = 1; +#ifndef _WIN32 + do { + const char* var; + + var = getenv("UV_TEST_TIMEOUT_MULTIPLIER"); + if (var == NULL) + break; + + timeout_multiplier = atoi(var); + if (timeout_multiplier <= 0) + timeout_multiplier = 1; + } while (0); +#endif + + result = process_wait(main_proc, 1, task->timeout * timeout_multiplier); if (result == -1) { FATAL("process_wait failed"); } else if (result == -2) {