qt5base-lts/tests/auto/testlib/selftests/expected_warnings.tap
Edward Welbourne 13d2e13290 Make counts of various types of test result add up correctly
Added tests for repeated skips and failures (from within void lambdas,
to simulate skips and failures from within event handlers). These
exhibit yet more ways to count more than one outcome for a test.  The
new QTest::failOnWarning() can also provoke more than one failure from
a single test, and several existing selftests exhibited various ways
for the Totals line's counts to add up to more than the number of
actual tests run.

Fixed counting so that only the first decisive incident is counted.
Tests can still report later failure or skipping, but only the first
is counted.

Added a currentTestState in qtestlog.cpp, by which it keeps track of
whether the test has resolved to a result, and clearCurrentTestState()
by which other code can reset that at the end of each test. This
brought to light various places where test-end clean-up was not being
handled - due to failure or skipping in a *_data() method or init, or
a skip in cleanup.

Fixes: QTBUG-95661
Change-Id: I5d24a37a53d3db225fa602649d8aad8f5ed6c1ad
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2022-01-13 19:47:22 +01:00

138 lines
4.3 KiB
Plaintext

TAP version 13
# tst_Warnings
ok 1 - initTestCase()
# Warning
# Warning
# Debug
# Debug
# Info
# Info
# Baba
# Baba
# Bubublabla
# Babablabla
ok 2 - testWarnings()
# Did not receive message: "Warning0"
# Did not receive message: "Warning1"
not ok 3 - testMissingWarnings()
---
# Not all expected messages were received
...
# Did not receive any message matching: "Warning\s\d"
not ok 4 - testMissingWarningsRegularExpression()
---
# Not all expected messages were received
...
# Did not receive message: "Warning0"
# Did not receive message: "Warning1"
not ok 5 - testMissingWarningsWithData(first row)
---
# Not all expected messages were received
...
# Did not receive message: "Warning0"
# Did not receive message: "Warning1"
not ok 6 - testMissingWarningsWithData(second row)
---
# Not all expected messages were received
...
# Ran out of space!
not ok 7 - testFailOnWarnings()
---
# Received a warning that resulted in a failure:
Ran out of cabbage!
at: tst_Warnings::testFailOnWarnings() (qtbase/tests/auto/testlib/selftests/warnings/tst_warnings.cpp:0)
file: qtbase/tests/auto/testlib/selftests/warnings/tst_warnings.cpp
line: 0
...
# Ran out of tortillas!
# Ran out of oil!
# nope
not ok 7 - testFailOnWarnings()
---
# Received a warning that resulted in a failure:
Ran out of biscuits!
at: tst_Warnings::testFailOnWarnings() (qtbase/tests/auto/testlib/selftests/warnings/tst_warnings.cpp:0)
file: qtbase/tests/auto/testlib/selftests/warnings/tst_warnings.cpp
line: 0
...
not ok 7 - testFailOnWarnings()
---
# Received a warning that resulted in a failure:
Running low on toothpaste!
at: tst_Warnings::testFailOnWarnings() (qtbase/tests/auto/testlib/selftests/warnings/tst_warnings.cpp:0)
file: qtbase/tests/auto/testlib/selftests/warnings/tst_warnings.cpp
line: 0
...
# Running low on flour!
# Running low on toothpaste!
# Running low on toothpaste!
# Ran out of muffins!
ok 8 - testFailOnWarningsCleared()
not ok 9 - testFailOnWarningsWithData(warning1)
---
# Received a warning that resulted in a failure:
warning1
at: tst_Warnings::testFailOnWarningsWithData() (qtbase/tests/auto/testlib/selftests/warnings/tst_warnings.cpp:0)
file: qtbase/tests/auto/testlib/selftests/warnings/tst_warnings.cpp
line: 0
...
# warning2
# warning3
# warning1
not ok 10 - testFailOnWarningsWithData(warning2)
---
# Received a warning that resulted in a failure:
warning2
at: tst_Warnings::testFailOnWarningsWithData() (qtbase/tests/auto/testlib/selftests/warnings/tst_warnings.cpp:0)
file: qtbase/tests/auto/testlib/selftests/warnings/tst_warnings.cpp
line: 0
...
# warning3
# warning1
# warning2
not ok 11 - testFailOnWarningsWithData(warning3)
---
# Received a warning that resulted in a failure:
warning3
at: tst_Warnings::testFailOnWarningsWithData() (qtbase/tests/auto/testlib/selftests/warnings/tst_warnings.cpp:0)
file: qtbase/tests/auto/testlib/selftests/warnings/tst_warnings.cpp
line: 0
...
not ok 12 - testFailOnWarningsFailInHelper()
---
# This failure message should be printed but not cause the test to abort
at: tst_Warnings::testFailOnWarningsFailInHelper() (qtbase/tests/auto/testlib/selftests/warnings/tst_warnings.cpp:0)
file: qtbase/tests/auto/testlib/selftests/warnings/tst_warnings.cpp
line: 0
...
not ok 12 - testFailOnWarningsFailInHelper()
---
# Received a warning that resulted in a failure:
Ran out of cabbage!
at: tst_Warnings::testFailOnWarningsFailInHelper() (qtbase/tests/auto/testlib/selftests/warnings/tst_warnings.cpp:0)
file: qtbase/tests/auto/testlib/selftests/warnings/tst_warnings.cpp
line: 0
...
not ok 12 - testFailOnWarningsFailInHelper()
---
# My cabbage! :(
at: tst_Warnings::testFailOnWarningsFailInHelper() (qtbase/tests/auto/testlib/selftests/warnings/tst_warnings.cpp:0)
file: qtbase/tests/auto/testlib/selftests/warnings/tst_warnings.cpp
line: 0
...
not ok 13 - testFailOnWarningsThenSkip()
---
# Received a warning that resulted in a failure:
Ran out of cabbage!
at: tst_Warnings::testFailOnWarningsThenSkip() (qtbase/tests/auto/testlib/selftests/warnings/tst_warnings.cpp:0)
file: qtbase/tests/auto/testlib/selftests/warnings/tst_warnings.cpp
line: 0
...
ok 13 - testFailOnWarningsThenSkip() # SKIP My cabbage! :(
ok 14 - testFailOnWarningsAndIgnoreWarnings()
ok 15 - cleanupTestCase()
1..15
# tests 15
# pass 5
# fail 10