From e5761061f288d9e16ba3816f4d43fdb9b6decd25 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Wed, 22 Jul 2020 14:33:04 +0200 Subject: testlib selftest: Only warn about missing test expectation if none was found Change-Id: I55e19d0a7b9b58ceeee4f25612f4a1d9ec66eb76 Reviewed-by: Friedemann Kleint --- tests/auto/testlib/selftests/tst_selftests.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'tests/auto/testlib') diff --git a/tests/auto/testlib/selftests/tst_selftests.cpp b/tests/auto/testlib/selftests/tst_selftests.cpp index e63f8a427f..0e5d947bc4 100644 --- a/tests/auto/testlib/selftests/tst_selftests.cpp +++ b/tests/auto/testlib/selftests/tst_selftests.cpp @@ -868,6 +868,7 @@ void checkTestOutput(const QString &test, const TestLogger &logger, const QByteA return true; }; + bool foundExpectionFile = false; for (int version = 0; !expectationMatched; ++version) { // Look for a test expectation file. Most tests only have a single // expectation file, while some have multiple versions that should @@ -888,12 +889,14 @@ void checkTestOutput(const QString &test, const TestLogger &logger, const QByteA } else { // No more versions found, and still no match assert(!expectationMatched); - outputMessage += "Could not find any expectation files for subtest '" + test + "'"; + if (!foundExpectionFile) + outputMessage += "Could not find any expectation files for subtest '" + test + "'"; break; } } // Found expected result + foundExpectionFile = true; QString errorMessage; auto expectedLines = splitLines(expected); if (compareOutput(logger.shortName(), test, actual, actualLines, expectedLines, &errorMessage)) { -- cgit v1.2.3