Propose use of SYNCTHING_TEST_TIMEOUT_FACTOR

This commit is contained in:
Martchus 2018-09-06 22:04:15 +02:00
parent 9599dcee81
commit 7611ad1c8e
3 changed files with 13 additions and 4 deletions

View File

@ -505,7 +505,9 @@ void ConnectionTests::testRequestingLog()
timeout.start();
loop.exec();
QObject::disconnect(request); // ensure callback is not called after return (in error case)
CPPUNIT_ASSERT_MESSAGE("log entries returned before timeout", callbackOk);
CPPUNIT_ASSERT_MESSAGE(
argsToString("log entries returned before timeout of ", timeout.interval(), " ms (set SYNCTHING_TEST_TIMEOUT_FACTOR to increase timeout)"),
callbackOk);
}
void ConnectionTests::testRequestingQrCode()
@ -529,7 +531,9 @@ void ConnectionTests::testRequestingQrCode()
timeout.start();
loop.exec();
QObject::disconnect(request); // ensure callback is not called after return (in error case)
CPPUNIT_ASSERT_MESSAGE("QR code returned before timeout", callbackOk);
CPPUNIT_ASSERT_MESSAGE(
argsToString("QR code returned before timeout of ", timeout.interval(), " ms (set SYNCTHING_TEST_TIMEOUT_FACTOR to increase timeout)"),
callbackOk);
}
void ConnectionTests::testDisconnecting()

View File

@ -367,7 +367,8 @@ bool waitForSignalsOrFail(Action action, int timeout, const SignalInfo &failure,
argsToString("Signal(s) ", failedSignalNames(signalInfos...).data(), " has/have not emmitted before ", failure.signalName().data(), '.'));
} else if (timeoutFailed) {
CPPUNIT_FAIL(argsToString("Signal(s) ", failedSignalNames(signalInfos...).data(), " has/have not emmitted within at least ", timer.interval(),
" ms.", timeoutFactor != 1.0 ? argsToString(" (original timeout: ", timeout, " ms)") : std::string()));
" ms (set environment variable SYNCTHING_TEST_TIMEOUT_FACTOR to increase the timeout).",
timeoutFactor != 1.0 ? argsToString(" (original timeout: ", timeout, " ms)") : std::string()));
}
#endif
return !failureEmitted && !timeoutFailed;

View File

@ -36,8 +36,12 @@ void SyncthingTestInstance::start()
timeoutFactor = stringToNumber<double>(string(timeoutFactorEnv.data()));
cerr << " - Using timeout factor " << timeoutFactor << endl;
} catch (const ConversionException &) {
cerr << " - Specified SYNCTHING_TEST_TIMEOUT_FACTOR \"" << timeoutFactorEnv.data() << "\" is no valid double and hence ignored" << endl;
cerr << " - Specified SYNCTHING_TEST_TIMEOUT_FACTOR \"" << timeoutFactorEnv.data()
<< "\" is no valid double and hence ignored\n (defaulting to " << timeoutFactor << ')' << endl;
}
} else {
cerr << " - No timeout factor set, defaulting to " << timeoutFactor
<< ("\n (set environment variable SYNCTHING_TEST_TIMEOUT_FACTOR to specify a factor to run tests on a slow machine)") << endl;
}
// setup st config