QTest: Reset repeat counter for each call to QTest::qRun()
This fix ensures that each call to QTest::qRun() runs all tests the requested number of repetitions. This fixes an issue where QTEST_QUICKCONTROLS_MAIN would only test the first style, and skip remaining styles. The cause was that the repeat counter was not reset between QTest::qRun() calls. Subsequent calls to QTest::qRun() would therefore not run any tests. Amends: 80a14c86b2739492d7f7fbdb1cbde1da85d1341d Fixes: QTBUG-133207 Pick-to: 6.9 6.8 6.7 Change-Id: Idb164fd01ac0b8e04e5dd74c3625f2c343f742c5 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
This commit is contained in:
parent
892a020cc3
commit
07318c81a7
@ -420,7 +420,6 @@ static int eventDelay = -1;
|
|||||||
static int timeout = -1;
|
static int timeout = -1;
|
||||||
#endif
|
#endif
|
||||||
static int repetitions = 1;
|
static int repetitions = 1;
|
||||||
static bool repeatForever = false;
|
|
||||||
static bool skipBlacklisted = false;
|
static bool skipBlacklisted = false;
|
||||||
|
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
@ -604,7 +603,6 @@ Q_TESTLIB_EXPORT void qtest_qParseArgs(int argc, const char *const argv[], bool
|
|||||||
const char *logFilename = nullptr;
|
const char *logFilename = nullptr;
|
||||||
|
|
||||||
repetitions = 1;
|
repetitions = 1;
|
||||||
repeatForever = false;
|
|
||||||
|
|
||||||
QTest::testFunctions.clear();
|
QTest::testFunctions.clear();
|
||||||
QTest::testTags.clear();
|
QTest::testTags.clear();
|
||||||
@ -819,7 +817,6 @@ Q_TESTLIB_EXPORT void qtest_qParseArgs(int argc, const char *const argv[], bool
|
|||||||
exit(1);
|
exit(1);
|
||||||
} else {
|
} else {
|
||||||
repetitions = qToInt(argv[++i]);
|
repetitions = qToInt(argv[++i]);
|
||||||
repeatForever = repetitions < 0;
|
|
||||||
}
|
}
|
||||||
} else if (strcmp(argv[i], "-nocrashhandler") == 0) {
|
} else if (strcmp(argv[i], "-nocrashhandler") == 0) {
|
||||||
QTest::Internal::noCrashHandler = true;
|
QTest::Internal::noCrashHandler = true;
|
||||||
@ -1947,7 +1944,9 @@ int QTest::qRun()
|
|||||||
}
|
}
|
||||||
TestMethods test(currentTestObject, std::move(commandLineMethods));
|
TestMethods test(currentTestObject, std::move(commandLineMethods));
|
||||||
|
|
||||||
while (QTestLog::failCount() == 0 && (repeatForever || repetitions-- > 0)) {
|
int remainingRepetitions = repetitions;
|
||||||
|
const bool repeatForever = repetitions < 0;
|
||||||
|
while (QTestLog::failCount() == 0 && (repeatForever || remainingRepetitions-- > 0)) {
|
||||||
QTestTable::globalTestTable();
|
QTestTable::globalTestTable();
|
||||||
test.invokeTests(currentTestObject);
|
test.invokeTests(currentTestObject);
|
||||||
QTestTable::clearGlobalTestTable();
|
QTestTable::clearGlobalTestTable();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user