From 7d60fde9a7ca0efa7419223a77d62e429cfc44c1 Mon Sep 17 00:00:00 2001 From: Edward Welbourne Date: Tue, 15 Mar 2022 15:00:46 +0100 Subject: [PATCH] Include file and line information in TAP diagnostics blocks MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When producing a diagnostics block, include the file and line information, if we have it, to describe it. This presently only adds this information for skip, but could in principle do the same for a B?XPass. Task-number: QTBUG-96844 Change-Id: I6cc375d98e2369eba262010f9c2dfbcba931a6f1 Reviewed-by: Tor Arne Vestbø --- src/testlib/qtaptestlogger.cpp | 2 +- .../testlib/selftests/expected_counting.tap | 3 +++ .../testlib/selftests/expected_globaldata.tap | 18 ++++++++++++++++++ .../testlib/selftests/expected_subtest.tap | 3 +++ .../testlib/selftests/expected_verbose1.tap | 3 +++ .../testlib/selftests/expected_verbose2.tap | 3 +++ 6 files changed, 31 insertions(+), 1 deletion(-) diff --git a/src/testlib/qtaptestlogger.cpp b/src/testlib/qtaptestlogger.cpp index c1a74eb52c..2bedc80a92 100644 --- a/src/testlib/qtaptestlogger.cpp +++ b/src/testlib/qtaptestlogger.cpp @@ -354,7 +354,7 @@ void QTapTestLogger::addIncident(IncidentTypes type, const char *description, } } - if (!ok && file) { + if (file) { QTestCharBuffer location; QTest::qt_asprintf(&location, // The generic 'at' key is understood by most consumers. diff --git a/tests/auto/testlib/selftests/expected_counting.tap b/tests/auto/testlib/selftests/expected_counting.tap index 51795a0ccf..df395ddbc9 100644 --- a/tests/auto/testlib/selftests/expected_counting.tap +++ b/tests/auto/testlib/selftests/expected_counting.tap @@ -117,6 +117,9 @@ ok 30 - testSkipInCleanup(skip) # SKIP Skip in cleanup() messages: - severity: debug message: This test function should execute and then QSKIP in cleanup() + at: tst_Counting::testSkipInCleanup() (qtbase/tests/auto/testlib/selftests/counting/tst_counting.cpp:0) + file: qtbase/tests/auto/testlib/selftests/counting/tst_counting.cpp + line: 0 ... ok 31 - testSkipInCleanup(after) ok 32 - cleanupTestCase() diff --git a/tests/auto/testlib/selftests/expected_globaldata.tap b/tests/auto/testlib/selftests/expected_globaldata.tap index f0e71674a2..07987cf5ff 100644 --- a/tests/auto/testlib/selftests/expected_globaldata.tap +++ b/tests/auto/testlib/selftests/expected_globaldata.tap @@ -66,6 +66,9 @@ ok 7 - skipLocal(global=false:local=false) # SKIP skipping messages: - severity: debug message: init skipLocal local=false + at: tst_globaldata::skipLocal() (qtbase/tests/auto/testlib/selftests/globaldata/tst_globaldata.cpp:0) + file: qtbase/tests/auto/testlib/selftests/globaldata/tst_globaldata.cpp + line: 0 ... # debug: cleanup skipLocal local=false ok 8 - skipLocal(global=false:local=true) # SKIP skipping @@ -74,6 +77,9 @@ ok 8 - skipLocal(global=false:local=true) # SKIP skipping messages: - severity: debug message: init skipLocal local=true + at: tst_globaldata::skipLocal() (qtbase/tests/auto/testlib/selftests/globaldata/tst_globaldata.cpp:0) + file: qtbase/tests/auto/testlib/selftests/globaldata/tst_globaldata.cpp + line: 0 ... # debug: cleanup skipLocal local=true ok 9 - skipLocal(global=true:local=false) # SKIP skipping @@ -82,6 +88,9 @@ ok 9 - skipLocal(global=true:local=false) # SKIP skipping messages: - severity: debug message: init skipLocal local=false + at: tst_globaldata::skipLocal() (qtbase/tests/auto/testlib/selftests/globaldata/tst_globaldata.cpp:0) + file: qtbase/tests/auto/testlib/selftests/globaldata/tst_globaldata.cpp + line: 0 ... # debug: cleanup skipLocal local=false ok 10 - skipLocal(global=true:local=true) # SKIP skipping @@ -90,6 +99,9 @@ ok 10 - skipLocal(global=true:local=true) # SKIP skipping messages: - severity: debug message: init skipLocal local=true + at: tst_globaldata::skipLocal() (qtbase/tests/auto/testlib/selftests/globaldata/tst_globaldata.cpp:0) + file: qtbase/tests/auto/testlib/selftests/globaldata/tst_globaldata.cpp + line: 0 ... # debug: cleanup skipLocal local=true ok 11 - skipSingle(global=false:local=false) @@ -109,6 +121,9 @@ ok 12 - skipSingle(global=false:local=true) # SKIP Skipping messages: - severity: debug message: init skipSingle local=true + at: tst_globaldata::skipSingle() (qtbase/tests/auto/testlib/selftests/globaldata/tst_globaldata.cpp:0) + file: qtbase/tests/auto/testlib/selftests/globaldata/tst_globaldata.cpp + line: 0 ... # debug: cleanup skipSingle local=true ok 13 - skipSingle(global=true:local=false) # SKIP Skipping @@ -117,6 +132,9 @@ ok 13 - skipSingle(global=true:local=false) # SKIP Skipping messages: - severity: debug message: init skipSingle local=false + at: tst_globaldata::skipSingle() (qtbase/tests/auto/testlib/selftests/globaldata/tst_globaldata.cpp:0) + file: qtbase/tests/auto/testlib/selftests/globaldata/tst_globaldata.cpp + line: 0 ... # debug: cleanup skipSingle local=false ok 14 - skipSingle(global=true:local=true) diff --git a/tests/auto/testlib/selftests/expected_subtest.tap b/tests/auto/testlib/selftests/expected_subtest.tap index 6155395b88..93caf121ce 100644 --- a/tests/auto/testlib/selftests/expected_subtest.tap +++ b/tests/auto/testlib/selftests/expected_subtest.tap @@ -214,6 +214,9 @@ ok 10 - multiSkip() # SKIP This skip should be repeated ten times messages: - severity: debug message: init multiSkip (null) + at: tst_Subtest::multiSkip() (qtbase/tests/auto/testlib/selftests/subtest/tst_subtest.cpp:0) + file: qtbase/tests/auto/testlib/selftests/subtest/tst_subtest.cpp + line: 0 ... ok 10 - multiSkip() # SKIP This skip should be repeated ten times ok 10 - multiSkip() # SKIP This skip should be repeated ten times diff --git a/tests/auto/testlib/selftests/expected_verbose1.tap b/tests/auto/testlib/selftests/expected_verbose1.tap index 51795a0ccf..df395ddbc9 100644 --- a/tests/auto/testlib/selftests/expected_verbose1.tap +++ b/tests/auto/testlib/selftests/expected_verbose1.tap @@ -117,6 +117,9 @@ ok 30 - testSkipInCleanup(skip) # SKIP Skip in cleanup() messages: - severity: debug message: This test function should execute and then QSKIP in cleanup() + at: tst_Counting::testSkipInCleanup() (qtbase/tests/auto/testlib/selftests/counting/tst_counting.cpp:0) + file: qtbase/tests/auto/testlib/selftests/counting/tst_counting.cpp + line: 0 ... ok 31 - testSkipInCleanup(after) ok 32 - cleanupTestCase() diff --git a/tests/auto/testlib/selftests/expected_verbose2.tap b/tests/auto/testlib/selftests/expected_verbose2.tap index 990ac36342..f9b0c5b6fb 100644 --- a/tests/auto/testlib/selftests/expected_verbose2.tap +++ b/tests/auto/testlib/selftests/expected_verbose2.tap @@ -147,6 +147,9 @@ ok 30 - testSkipInCleanup(skip) # SKIP Skip in cleanup() messages: - severity: debug message: This test function should execute and then QSKIP in cleanup() + at: tst_Counting::testSkipInCleanup() (qtbase/tests/auto/testlib/selftests/counting/tst_counting.cpp:0) + file: qtbase/tests/auto/testlib/selftests/counting/tst_counting.cpp + line: 0 ... ok 31 - testSkipInCleanup(after) ok 32 - cleanupTestCase()