From 5762b152f953483b86019a5d18ea4ab87b223d89 Mon Sep 17 00:00:00 2001 From: Ivan Solovev Date: Wed, 5 Feb 2025 10:13:56 +0100 Subject: [PATCH] tst_selftest: do not use -[no]throwon{fail,skip} This commit partially reverts fde57300ab51c7deda168f6a4515dcf7b1340618. The reason for the revert is that tst_selftest has some tests that are expected to continue the execution after a failure (see the follow-up commit for one example of such test). This patch is 6.8-only, because in 6.9 and dev the same is done by ad568b859a6f0a16dd243f1ca2cdc19571337da3, which could not be directly cherry-picked to 6.8 because it also reverts the testlib support for command-line arguments. Change-Id: Ie3fd2f755e69d05d359cdc4d1c57267ca2edb339 Reviewed-by: Thiago Macieira --- .../auto/testlib/selftests/tst_selftests.cpp | 19 ++++--------------- 1 file changed, 4 insertions(+), 15 deletions(-) diff --git a/tests/auto/testlib/selftests/tst_selftests.cpp b/tests/auto/testlib/selftests/tst_selftests.cpp index eda3d9afc7..819fbf61f4 100644 --- a/tests/auto/testlib/selftests/tst_selftests.cpp +++ b/tests/auto/testlib/selftests/tst_selftests.cpp @@ -1025,12 +1025,10 @@ TestProcessResult runTestProcess(const QString &test, const QStringList &argumen return { process.exitCode(), standardOutput, standardError }; } -enum class Throw { OnFail = 1 }; - /* Runs a single test and verifies the output against the expected results. */ -void runTest(const QString &test, const TestLoggers &requestedLoggers, Throw throwing = {}) +void runTest(const QString &test, const TestLoggers &requestedLoggers) { TestLoggers loggers; for (auto logger : requestedLoggers) { @@ -1044,10 +1042,6 @@ void runTest(const QString &test, const TestLoggers &requestedLoggers, Throw thr QStringList arguments; for (auto logger : loggers) arguments += logger.arguments(test); - if (throwing == Throw::OnFail) // don't distinguish between throwonfail/throwonskip - arguments += {"-throwonfail", "-throwonskip"}; - else - arguments += {"-nothrowonfail", "-nothrowonskip"}; CAPTURE(test); CAPTURE(arguments); @@ -1074,9 +1068,9 @@ void runTest(const QString &test, const TestLoggers &requestedLoggers, Throw thr /* Runs a single test and verifies the output against the expected result. */ -void runTest(const QString &test, const TestLogger &logger, Throw t = {}) +void runTest(const QString &test, const TestLogger &logger) { - runTest(test, TestLoggers{logger}, t); + runTest(test, TestLoggers{logger}); } // ----------------------- Catch helpers ----------------------- @@ -1219,12 +1213,7 @@ SCENARIO("Test output of the loggers is as expected") GIVEN("The " << logger << " logger") { for (QString test : tests) { AND_GIVEN("The " << test << " subtest") { - WHEN("Throwing on failure or skip") { - runTest(test, TestLogger(logger, StdoutOutput), Throw::OnFail); - } - WHEN("Returning on failure or skip") { - runTest(test, TestLogger(logger, StdoutOutput)); - } + runTest(test, TestLogger(logger, StdoutOutput)); } } }