diff --git a/src/plugins/autotest/gtest/gtestconfiguration.cpp b/src/plugins/autotest/gtest/gtestconfiguration.cpp index ac650a504eb..d49a4450508 100644 --- a/src/plugins/autotest/gtest/gtestconfiguration.cpp +++ b/src/plugins/autotest/gtest/gtestconfiguration.cpp @@ -50,6 +50,13 @@ QStringList GTestConfiguration::argumentsForTestRunner(const TestSettings &setti arguments << QLatin1String("--gtest_shuffle") << QString::fromLatin1("--gtest_random_seed=%1").arg(settings.gtestSeed); } + if (settings.gtestThrowOnFailure) + arguments << "--gtest_throw_on_failure"; + + if (runMode() == DebuggableTestConfiguration::Debug) { + if (settings.gtestBreakOnFailure) + arguments << "--gtest_break_on_failure"; + } return arguments; } diff --git a/src/plugins/autotest/qtest/qttestconfiguration.cpp b/src/plugins/autotest/qtest/qttestconfiguration.cpp index d0dc7b378d6..53d7037a9d1 100644 --- a/src/plugins/autotest/qtest/qttestconfiguration.cpp +++ b/src/plugins/autotest/qtest/qttestconfiguration.cpp @@ -45,6 +45,12 @@ QStringList QtTestConfiguration::argumentsForTestRunner(const TestSettings &sett arguments << metricsOption; if (testCases().count()) arguments << testCases(); + + if (runMode() == DebuggableTestConfiguration::Debug) { + if (settings.qtestNoCrashHandler) + arguments << "-nocrashhandler"; + } + return arguments; } diff --git a/src/plugins/autotest/testsettings.cpp b/src/plugins/autotest/testsettings.cpp index e9938fcac89..18c38f44478 100644 --- a/src/plugins/autotest/testsettings.cpp +++ b/src/plugins/autotest/testsettings.cpp @@ -41,11 +41,14 @@ static const char omitRunConfigWarnKey[] = "OmitRCWarnings"; static const char limitResultOutputKey[] = "LimitResultOutput"; static const char autoScrollKey[] = "AutoScrollResults"; static const char alwaysParseKey[] = "AlwaysParse"; +static const char qtestNoCrashhandlerKey[] = "NoCrashhandlerOnDebug"; static const char gtestRunDisabledKey[] = "RunDisabledGTests"; static const char gtestRepeatKey[] = "RepeatGTests"; static const char gtestShuffleKey[] = "ShuffleGTests"; static const char gtestIterationsKey[] = "IterationsGTests"; static const char gtestSeedKey[] = "SeedGTests"; +static const char gtestThrowOnFailureKey[] = "ThrowOnFailure"; +static const char gtestBreakOnFailureKey[] = "BreakOnFailure"; static const int defaultTimeout = 60000; @@ -65,11 +68,14 @@ void TestSettings::toSettings(QSettings *s) const s->setValue(QLatin1String(limitResultOutputKey), limitResultOutput); s->setValue(QLatin1String(autoScrollKey), autoScroll); s->setValue(QLatin1String(alwaysParseKey), alwaysParse); + s->setValue(QLatin1String(qtestNoCrashhandlerKey), qtestNoCrashHandler); s->setValue(QLatin1String(gtestRunDisabledKey), gtestRunDisabled); s->setValue(QLatin1String(gtestRepeatKey), gtestRepeat); s->setValue(QLatin1String(gtestShuffleKey), gtestShuffle); s->setValue(QLatin1String(gtestIterationsKey), gtestIterations); s->setValue(QLatin1String(gtestSeedKey), gtestSeed); + s->setValue(QLatin1String(gtestBreakOnFailureKey), gtestBreakOnFailure); + s->setValue(QLatin1String(gtestThrowOnFailureKey), gtestThrowOnFailure); // store frameworks and their current active state for (const Core::Id &id : frameworks.keys()) s->setValue(QLatin1String(id.name()), frameworks.value(id)); @@ -104,11 +110,14 @@ void TestSettings::fromSettings(const QSettings *s) limitResultOutput = s->value(root + QLatin1String(limitResultOutputKey), true).toBool(); autoScroll = s->value(root + QLatin1String(autoScrollKey), true).toBool(); alwaysParse = s->value(root + QLatin1String(alwaysParseKey), true).toBool(); + qtestNoCrashHandler = s->value(root + QLatin1String(qtestNoCrashhandlerKey), true).toBool(); gtestRunDisabled = s->value(root + QLatin1String(gtestRunDisabledKey), false).toBool(); gtestRepeat = s->value(root + QLatin1String(gtestRepeatKey), false).toBool(); gtestShuffle = s->value(root + QLatin1String(gtestShuffleKey), false).toBool(); gtestIterations = s->value(root + QLatin1String(gtestIterationsKey), 1).toInt(); gtestSeed = s->value(root + QLatin1String(gtestSeedKey), 0).toInt(); + gtestBreakOnFailure = s->value(root + QLatin1String(gtestBreakOnFailureKey), true).toBool(); + gtestThrowOnFailure = s->value(root + QLatin1String(gtestThrowOnFailureKey), false).toBool(); // try to get settings for registered frameworks TestFrameworkManager *frameworkManager = TestFrameworkManager::instance(); const QList ®istered = frameworkManager->registeredFrameworkIds(); @@ -127,9 +136,12 @@ bool TestSettings::equals(const TestSettings &rhs) const && limitResultOutput == rhs.limitResultOutput && autoScroll == rhs.autoScroll && alwaysParse == rhs.alwaysParse + && qtestNoCrashHandler == rhs.qtestNoCrashHandler && gtestRunDisabled == rhs.gtestRunDisabled && gtestRepeat == rhs.gtestRepeat && gtestIterations == rhs.gtestIterations && gtestShuffle == rhs.gtestShuffle && gtestSeed == rhs.gtestSeed + && gtestBreakOnFailure == rhs.gtestBreakOnFailure + && gtestThrowOnFailure == rhs.gtestThrowOnFailure && frameworks == rhs.frameworks; } diff --git a/src/plugins/autotest/testsettings.h b/src/plugins/autotest/testsettings.h index 3b3f45dbc26..505b282996d 100644 --- a/src/plugins/autotest/testsettings.h +++ b/src/plugins/autotest/testsettings.h @@ -61,9 +61,12 @@ struct TestSettings bool limitResultOutput; bool autoScroll; bool alwaysParse; + bool qtestNoCrashHandler; bool gtestRunDisabled; bool gtestShuffle; bool gtestRepeat; + bool gtestThrowOnFailure; + bool gtestBreakOnFailure; QHash frameworks; }; diff --git a/src/plugins/autotest/testsettingspage.cpp b/src/plugins/autotest/testsettingspage.cpp index c316829430f..ee5a6ab46b4 100644 --- a/src/plugins/autotest/testsettingspage.cpp +++ b/src/plugins/autotest/testsettingspage.cpp @@ -64,11 +64,14 @@ void TestSettingsWidget::setSettings(const TestSettings &settings) m_ui.limitResultOutputCB->setChecked(settings.limitResultOutput); m_ui.autoScrollCB->setChecked(settings.autoScroll); m_ui.alwaysParseCB->setChecked(settings.alwaysParse); + m_ui.disableCrashhandlerCB->setChecked(settings.qtestNoCrashHandler); m_ui.runDisabledGTestsCB->setChecked(settings.gtestRunDisabled); m_ui.repeatGTestsCB->setChecked(settings.gtestRepeat); m_ui.shuffleGTestsCB->setChecked(settings.gtestShuffle); m_ui.repetitionSpin->setValue(settings.gtestIterations); m_ui.seedSpin->setValue(settings.gtestSeed); + m_ui.breakOnFailureCB->setChecked(settings.gtestBreakOnFailure); + m_ui.throwOnFailureCB->setChecked(settings.gtestThrowOnFailure); switch (settings.metrics) { case MetricsType::Walltime: @@ -101,11 +104,14 @@ TestSettings TestSettingsWidget::settings() const result.limitResultOutput = m_ui.limitResultOutputCB->isChecked(); result.autoScroll = m_ui.autoScrollCB->isChecked(); result.alwaysParse = m_ui.alwaysParseCB->isChecked(); + result.qtestNoCrashHandler = m_ui.disableCrashhandlerCB->isChecked(); result.gtestRunDisabled = m_ui.runDisabledGTestsCB->isChecked(); result.gtestRepeat = m_ui.repeatGTestsCB->isChecked(); result.gtestShuffle = m_ui.shuffleGTestsCB->isChecked(); result.gtestIterations = m_ui.repetitionSpin->value(); result.gtestSeed = m_ui.seedSpin->value(); + result.gtestBreakOnFailure = m_ui.breakOnFailureCB->isChecked(); + result.gtestThrowOnFailure = m_ui.throwOnFailureCB->isChecked(); if (m_ui.walltimeRB->isChecked()) result.metrics = MetricsType::Walltime; diff --git a/src/plugins/autotest/testsettingspage.ui b/src/plugins/autotest/testsettingspage.ui index 4508ecd7c04..349282b889c 100644 --- a/src/plugins/autotest/testsettingspage.ui +++ b/src/plugins/autotest/testsettingspage.ui @@ -6,8 +6,8 @@ 0 0 - 574 - 404 + 655 + 427 @@ -204,24 +204,18 @@ - + - Benchmark Metrics + Qt Test - + - - - - 0 - 0 - - + - Uses walltime metrics for executing benchmarks (default). + Enables interrupting tests on assertions. - Walltime + Disable crash handler while debugging true @@ -229,88 +223,119 @@ - - - - 0 - 0 - + + + Benchmark Metrics - - Uses tick counter when executing benchmarks. - - - Tick counter + + true + + + + + + 0 + 0 + + + + Uses walltime metrics for executing benchmarks (default). + + + Walltime + + + true + + + + + + + + 0 + 0 + + + + Uses tick counter when executing benchmarks. + + + Tick counter + + + + + + + + 0 + 0 + + + + Uses event counter when executing benchmarks. + + + Event counter + + + + + + + false + + + + 0 + 0 + + + + Uses Valgrind Callgrind when executing benchmarks (it must be installed). + + + Callgrind + + + + + + + false + + + + 0 + 0 + + + + Uses Perf when executing benchmarks (it must be installed). + + + Perf + + + + + + + Qt::Horizontal + + + + 40 + 0 + + + + + - - - - - 0 - 0 - - - - Uses event counter when executing benchmarks. - - - Event counter - - - - - - - false - - - - 0 - 0 - - - - Uses Valgrind Callgrind when executing benchmarks (it must be installed). - - - Callgrind - - - - - - - false - - - - 0 - 0 - - - - Uses Perf when executing benchmarks (it must be installed). - - - Perf - - - - - - - Qt::Horizontal - - - - 40 - 0 - - - - @@ -439,6 +464,29 @@ + + + + Turn assertion failures into C++ exceptions. + + + Throw on failure + + + + + + + Turn failures into debugger breakpoints. + + + Break on failure while debugging + + + true + + +