tst_selftest: do not use -[no]throwon{fail,skip}

This commit partially reverts fde57300ab.
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 <thiago.macieira@intel.com>
bb10
Ivan Solovev 2025-02-05 10:13:56 +01:00
parent 7a26ba6e2b
commit 5762b152f9
1 changed files with 4 additions and 15 deletions

View File

@ -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));
}
}
}