From a1a55d5b9301c4e7ea6f9ff1d1c5096081019a4d Mon Sep 17 00:00:00 2001 From: Giuseppe D'Angelo Date: Thu, 3 Dec 2020 00:15:53 +0100 Subject: QTestLib: add a abort-on-fail environment variable When debugging a spurious failure it's extremely useful to run the test repeadtly into a debugger until a failure appears. When that happens, one wants to immediately start debugging. In so far, this has only been possible by placing breakpoints inside Qt itself (when a failure is logged). Add another way: an env variable, similar to QT_FATAL_WARNINGS, that makes any failure fatal (terminate() gets called. Bonus: you can control the termination handler!) [ChangeLog][QtTestLib][QtTest] When the QTEST_FATAL_FAIL environment variable is set to a non-zero value, a test immediately aborts its execution. This is useful to debug intermittent failures. Change-Id: If2395f964ea482c30b8c8feab98db7fdee701cd3 Reviewed-by: Friedemann Kleint Reviewed-by: Jason McDonald --- src/testlib/doc/src/qttestlib-manual.qdoc | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/testlib/doc') diff --git a/src/testlib/doc/src/qttestlib-manual.qdoc b/src/testlib/doc/src/qttestlib-manual.qdoc index 73c010888f..9073cc7c88 100644 --- a/src/testlib/doc/src/qttestlib-manual.qdoc +++ b/src/testlib/doc/src/qttestlib-manual.qdoc @@ -374,6 +374,12 @@ \li \c QTEST_DISABLE_STACK_DUMP \br Setting this variable to a non-zero value will prevent Qt Test from printing a stacktrace in case an autotest times out or crashes. + \li \c QTEST_FATAL_FAIL \br + Setting this variable to a non-zero value will cause a failure in + an autotest to immediately abort the entire autotest. This is useful + to e.g. debug an unstable or intermittent failure in a test, by + launching the test in a debugger. Support for this variable has been + added in Qt 6.1. \endlist \section1 Creating a Benchmark -- cgit v1.2.3