From c95d7741b74bc617d86297dbfa5cd7d1df98f8c3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Thu, 29 Jul 2021 19:31:35 +0200 Subject: [PATCH] testlib: Don't report additional 'pass' test point for blacklisted XFail MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Regression after 9906cc57ed3eed64d534f43c677bb16e08561bb6. Pick-to: 6.2 Change-Id: I5566f70c66d248426c7a41b6de1cfb92f104cc64 Reviewed-by: Oliver Wolff Reviewed-by: MÃ¥rten Nordheim Reviewed-by: Edward Welbourne --- src/testlib/qtaptestlogger.cpp | 6 +++--- tests/auto/testlib/selftests/expected_blacklisted.tap | 3 +-- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/src/testlib/qtaptestlogger.cpp b/src/testlib/qtaptestlogger.cpp index 5b5a3c4875..8f254a431f 100644 --- a/src/testlib/qtaptestlogger.cpp +++ b/src/testlib/qtaptestlogger.cpp @@ -115,7 +115,7 @@ void QTapTestLogger::outputTestLine(bool ok, int testNumber, QTestCharBuffer &di void QTapTestLogger::addIncident(IncidentTypes type, const char *description, const char *file, int line) { - if (m_wasExpectedFail && type == Pass) { + if (m_wasExpectedFail && (type == Pass || type == BlacklistedPass)) { // XFail comes with a corresponding Pass incident, but we only want // to emit a single test point for it, so skip the this pass. return; @@ -132,7 +132,7 @@ void QTapTestLogger::addIncident(IncidentTypes type, const char *description, } int testNumber = QTestLog::totalCount(); - if (type == XFail) { + if (type == XFail || type == BlacklistedXFail) { // The global test counter hasn't been updated yet for XFail testNumber += 1; } @@ -238,7 +238,7 @@ void QTapTestLogger::addIncident(IncidentTypes type, const char *description, outputString(YAML_INDENT "...\n"); } - m_wasExpectedFail = type == XFail; + m_wasExpectedFail = (type == XFail || type == BlacklistedXFail); } void QTapTestLogger::addMessage(MessageTypes type, const QString &message, diff --git a/tests/auto/testlib/selftests/expected_blacklisted.tap b/tests/auto/testlib/selftests/expected_blacklisted.tap index 2c96bec472..9d589a6552 100644 --- a/tests/auto/testlib/selftests/expected_blacklisted.tap +++ b/tests/auto/testlib/selftests/expected_blacklisted.tap @@ -15,14 +15,13 @@ not ok 4 - fail() # TODO 'false' returned FALSE. (This test should BFAIL) file: qtbase/tests/auto/testlib/selftests/blacklisted/tst_blacklisted.cpp line: 0 ... -not ok 5 - xfail() # TODO This test should BXFAIL then BPASS +not ok 6 - xfail() # TODO This test should BXFAIL then BPASS --- # This test should BXFAIL then BPASS at: tst_Blacklisted::xfail() (qtbase/tests/auto/testlib/selftests/blacklisted/tst_blacklisted.cpp:0) file: qtbase/tests/auto/testlib/selftests/blacklisted/tst_blacklisted.cpp line: 0 ... -ok 6 - xfail() # TODO ok 7 - xpass() # TODO 'true' returned TRUE unexpectedly. (This test should BXPASS) # This is a warning that should not appear in silent test output # This is an internal testlib warning that should not appear in silent test output