mirror of
https://github.com/RsyncProject/rsync.git
synced 2026-10-21 05:14:15 -04:00
Allow per-test timeout overrides. Give hardlinks more time.
This commit is contained in:
1 parent
c5130bc123
commit
6e9ad2bb03
2 files changed
+18
-5
No files matched your search
+7
-1
@@ -229,8 +229,9 @@ echo " scratchbase=$scratchbase"
|
||||
[ -d "$scratchbase" ] || mkdir "$scratchbase"
|
||||
|
||||
suitedir="$srcdir/testsuite"
|
||||
TESTRUN_TIMEOUT=300
|
||||
|
||||
export scratchdir suitedir
|
||||
export scratchdir suitedir TESTRUN_TIMEOUT
|
||||
|
||||
prep_scratch() {
|
||||
[ -d "$scratchdir" ] && chmod -R u+rwX "$scratchdir" && rm -rf "$scratchdir"
|
||||
@@ -261,6 +262,11 @@ do
|
||||
|
||||
prep_scratch
|
||||
|
||||
case "$testscript" in
|
||||
*hardlinks*) TESTRUN_TIMEOUT=600 ;;
|
||||
*) TESTRUN_TIMEOUT=300 ;;
|
||||
esac
|
||||
|
||||
set +e
|
||||
"$TOOLDIR/"testrun $RUNSHFLAGS "$testscript" >"$scratchdir/test.log" 2>&1
|
||||
result=$?
|
||||
|
||||
@@ -2,18 +2,25 @@
|
||||
|
||||
#include "rsync.h"
|
||||
|
||||
#define MAX_TEST_SECONDS (5*60)
|
||||
#define DEFAULT_TIMEOUT_SECS (5*60)
|
||||
#define TIMEOUT_ENV "TESTRUN_TIMEOUT"
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
pid_t pid;
|
||||
int status, slept = 0;
|
||||
char *timeout_env;
|
||||
int status, timeout_secs, slept = 0;
|
||||
|
||||
if (argc < 2) {
|
||||
fprintf(stderr, "Usage: testrun [SHELL_OPTIONS] TESTSUITE_SCRIPT [ARGS]\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if ((timeout_env = getenv(TIMEOUT_ENV)) != NULL)
|
||||
timeout_secs = atoi(timeout_env);
|
||||
else
|
||||
timeout_secs = DEFAULT_TIMEOUT_SECS;
|
||||
|
||||
if ((pid = fork()) < 0) {
|
||||
fprintf(stderr, "TESTRUN ERROR: fork failed: %s\n", strerror(errno));
|
||||
exit(1);
|
||||
@@ -36,8 +43,8 @@
|
||||
fprintf(stderr, "TESTRUN ERROR: waitpid failed: %s\n", strerror(errno));
|
||||
exit(1);
|
||||
}
|
||||
if (slept++ > MAX_TEST_SECONDS) {
|
||||
fprintf(stderr, "TESTRUN TIMEOUT: test took over %d seconds.\n", MAX_TEST_SECONDS);
|
||||
if (slept++ > timeout_secs) {
|
||||
fprintf(stderr, "TESTRUN TIMEOUT: test took over %d seconds.\n", timeout_secs);
|
||||
if (kill(pid, SIGTERM) < 0)
|
||||
fprintf(stderr, "TESTRUN ERROR: failed to kill pid %ld: %s\n", (long)pid, strerror(errno));
|
||||
else
|
||||
|
||||
Reference in new issue
Block a user