diff --git a/tests/auto/corelib/kernel/qcoreapplication/apphelper.cpp b/tests/auto/corelib/kernel/qcoreapplication/apphelper.cpp index 946116167ea..8bf44bd00d2 100644 --- a/tests/auto/corelib/kernel/qcoreapplication/apphelper.cpp +++ b/tests/auto/corelib/kernel/qcoreapplication/apphelper.cpp @@ -74,6 +74,13 @@ static int exitFromThreadedEventLoop(int argc, char **argv) // see QTBUG-130895 static int mainAppInAThread(int argc, char **argv) { +#if defined(Q_OS_APPLE) && defined(QT_GUI_LIB) + // *** Assertion failure in -[NSMenu _setMenuName:], NSMenu.m:777 + // *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'API misuse: setting the main menu on a non-main thread. Main menu contents should only be modified from the main thread.' + puts("QGuiApplication in a thread fails inside Apple libs"); + return -1; +#endif + // note: when using std::thread in MinGW, we exercise different code paths // from QThread (winpthreads vs native) auto callable = [](int argc, char **argv) { diff --git a/tests/auto/corelib/kernel/qcoreapplication/tst_qcoreapplication.cpp b/tests/auto/corelib/kernel/qcoreapplication/tst_qcoreapplication.cpp index c39c1b527d8..9b721a28d3d 100644 --- a/tests/auto/corelib/kernel/qcoreapplication/tst_qcoreapplication.cpp +++ b/tests/auto/corelib/kernel/qcoreapplication/tst_qcoreapplication.cpp @@ -1226,6 +1226,10 @@ void tst_QCoreApplication::runHelperTest() QProcess process; process.start(QFINDTESTDATA("apphelper" EXE), { QTest::currentTestFunction() }); QVERIFY2(process.waitForFinished(5000), qPrintable(process.errorString())); + if (qint8(process.exitCode()) == -1) + QSKIP("Process requested skip: " + process.readAllStandardOutput().trimmed()); + + QCOMPARE(process.readAllStandardError(), QString()); QCOMPARE(process.exitStatus(), QProcess::NormalExit); QCOMPARE(process.exitCode(), 0); diff --git a/tests/auto/corelib/kernel/qcoreapplication/tst_qcoreapplication.h b/tests/auto/corelib/kernel/qcoreapplication/tst_qcoreapplication.h index de75bdfaa18..cd1224e2cc7 100644 --- a/tests/auto/corelib/kernel/qcoreapplication/tst_qcoreapplication.h +++ b/tests/auto/corelib/kernel/qcoreapplication/tst_qcoreapplication.h @@ -52,13 +52,7 @@ private slots: void exitFromEventLoop() { runHelperTest(); } void exitFromThread() { runHelperTest(); } void exitFromThreadedEventLoop() { runHelperTest(); } -# if defined(Q_OS_APPLE) && defined(QT_GUI_LIB) - // QGuiApplication in a thread fails inside Apple libs: - // *** Assertion failure in -[NSMenu _setMenuName:], NSMenu.m:777 - // *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'API misuse: setting the main menu on a non-main thread. Main menu contents should only be modified from the main thread.' -# else void mainAppInAThread() { runHelperTest(); } -# endif #endif void testTrWithPercantegeAtTheEnd(); #if QT_CONFIG(library) diff --git a/tests/auto/widgets/kernel/qapplication/tst_qapplication.cpp b/tests/auto/widgets/kernel/qapplication/tst_qapplication.cpp index 68e22fc4108..87c9fee2e90 100644 --- a/tests/auto/widgets/kernel/qapplication/tst_qapplication.cpp +++ b/tests/auto/widgets/kernel/qapplication/tst_qapplication.cpp @@ -97,13 +97,7 @@ private slots: void exitFromEventLoop() { runHelperTest(); } void exitFromThread() { runHelperTest(); } void exitFromThreadedEventLoop() { runHelperTest(); } -# if defined(Q_OS_APPLE) - // QGuiApplication in a thread fails inside Apple libs: - // *** Assertion failure in -[NSMenu _setMenuName:], NSMenu.m:777 - // *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'API misuse: setting the main menu on a non-main thread. Main menu contents should only be modified from the main thread.' -# else void mainAppInAThread() { runHelperTest(); } -# endif #endif void thread(); void desktopSettingsAware(); @@ -1016,6 +1010,9 @@ void tst_QApplication::runHelperTest() QProcess process; process.start(QFINDTESTDATA("apphelper" EXE), { QTest::currentTestFunction() }); QVERIFY2(process.waitForFinished(5000), qPrintable(process.errorString())); + if (qint8(process.exitCode()) == -1) + QSKIP("Process requested skip: " + process.readAllStandardOutput().trimmed()); + QCOMPARE(process.readAllStandardError(), QString()); QCOMPARE(process.exitStatus(), QProcess::NormalExit); QCOMPARE(process.exitCode(), 0);