summaryrefslogtreecommitdiffstats
path: root/tests/auto/testlib/selftests/silent_fatal
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/testlib/selftests/silent_fatal')
-rw-r--r--tests/auto/testlib/selftests/silent_fatal/CMakeLists.txt15
-rw-r--r--tests/auto/testlib/selftests/silent_fatal/tst_silent_fatal.cpp28
2 files changed, 43 insertions, 0 deletions
diff --git a/tests/auto/testlib/selftests/silent_fatal/CMakeLists.txt b/tests/auto/testlib/selftests/silent_fatal/CMakeLists.txt
new file mode 100644
index 0000000000..e4b59e399f
--- /dev/null
+++ b/tests/auto/testlib/selftests/silent_fatal/CMakeLists.txt
@@ -0,0 +1,15 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
+qt_internal_add_executable(silent_fatal
+ NO_INSTALL
+ EXCEPTIONS
+ OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
+ SOURCES
+ tst_silent_fatal.cpp
+ LIBRARIES
+ Qt::TestPrivate
+)
+
+# No coverage because this crashes, making data collection difficult, if not
+# impossible.
diff --git a/tests/auto/testlib/selftests/silent_fatal/tst_silent_fatal.cpp b/tests/auto/testlib/selftests/silent_fatal/tst_silent_fatal.cpp
new file mode 100644
index 0000000000..57aa1f702c
--- /dev/null
+++ b/tests/auto/testlib/selftests/silent_fatal/tst_silent_fatal.cpp
@@ -0,0 +1,28 @@
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+#include <QtCore/QCoreApplication>
+#include <QTest>
+#include <private/qtestlog_p.h>
+
+class tst_SilentFatal : public QObject
+{
+ Q_OBJECT
+
+private slots:
+ void fatalmessages();
+};
+void tst_SilentFatal::fatalmessages()
+{
+ qFatal("This is a fatal error message that should still appear in silent test output");
+}
+
+QTEST_MAIN_WRAPPER(tst_SilentFatal,
+ std::vector<const char*> args(argv, argv + argc);
+ args.push_back("-silent");
+ args.push_back("-nocrashhandler");
+ argc = int(args.size());
+ argv = const_cast<char**>(&args[0]);
+ QTEST_MAIN_SETUP())
+
+#include "tst_silent_fatal.moc"