diff --git a/tests/auto/testlib/selftests/benchlibcallgrind/tst_benchlibcallgrind.cpp b/tests/auto/testlib/selftests/benchlibcallgrind/tst_benchlibcallgrind.cpp index 51fb4d358a..353a7f5018 100644 --- a/tests/auto/testlib/selftests/benchlibcallgrind/tst_benchlibcallgrind.cpp +++ b/tests/auto/testlib/selftests/benchlibcallgrind/tst_benchlibcallgrind.cpp @@ -26,9 +26,8 @@ ** ****************************************************************************/ - -#include #include +#include #if __has_include() # include @@ -82,9 +81,17 @@ void tst_BenchlibCallgrind::twoHundredMillionInstructions() int main(int argc, char *argv[]) { std::vector args(argv, argv + argc); - args.push_back("-callgrind"); - argc = args.size(); - argv = const_cast(&args[0]); + // Add the -callgrind argument unless (it's there anyway or) we're the + // recursive invocation with -callgrindchild passed. + if (std::find_if(args.begin(), args.end(), + [](const char *arg) { + return qstrcmp(arg, "-callgrindchild") == 0 + || qstrcmp(arg, "-callgrind") == 0; + }) == args.end()) { + args.push_back("-callgrind"); + argc = args.size(); + argv = const_cast(&args[0]); + } QTEST_MAIN_IMPL(tst_BenchlibCallgrind) } diff --git a/tests/auto/testlib/selftests/expected_benchlibcallgrind.csv b/tests/auto/testlib/selftests/expected_benchlibcallgrind.csv deleted file mode 100644 index 6ce2e2ced8..0000000000 --- a/tests/auto/testlib/selftests/expected_benchlibcallgrind.csv +++ /dev/null @@ -1 +0,0 @@ -"twoHundredMillionInstructions","","InstructionReads",200000158,200000158,1 diff --git a/tests/auto/testlib/selftests/expected_benchlibcallgrind.junitxml b/tests/auto/testlib/selftests/expected_benchlibcallgrind.junitxml deleted file mode 100644 index 0850e74733..0000000000 --- a/tests/auto/testlib/selftests/expected_benchlibcallgrind.junitxml +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - - - - - - diff --git a/tests/auto/testlib/selftests/expected_benchlibcallgrind.lightxml b/tests/auto/testlib/selftests/expected_benchlibcallgrind.lightxml deleted file mode 100644 index dab06896d0..0000000000 --- a/tests/auto/testlib/selftests/expected_benchlibcallgrind.lightxml +++ /dev/null @@ -1,20 +0,0 @@ - - @INSERT_QT_VERSION_HERE@ - - @INSERT_QT_VERSION_HERE@ - - - - - - - - - - - - - - - - diff --git a/tests/auto/testlib/selftests/expected_benchlibcallgrind.tap b/tests/auto/testlib/selftests/expected_benchlibcallgrind.tap deleted file mode 100644 index da30082eaf..0000000000 --- a/tests/auto/testlib/selftests/expected_benchlibcallgrind.tap +++ /dev/null @@ -1,9 +0,0 @@ -TAP version 13 -# tst_BenchlibCallgrind -ok 1 - initTestCase() -ok 2 - twoHundredMillionInstructions() # SKIP This test is only defined for gcc and x86. -ok 3 - cleanupTestCase() -1..3 -# tests 3 -# pass 2 -# fail 0 diff --git a/tests/auto/testlib/selftests/expected_benchlibcallgrind.teamcity b/tests/auto/testlib/selftests/expected_benchlibcallgrind.teamcity deleted file mode 100644 index 9499fed8ce..0000000000 --- a/tests/auto/testlib/selftests/expected_benchlibcallgrind.teamcity +++ /dev/null @@ -1,7 +0,0 @@ -##teamcity[testSuiteStarted name='tst_BenchlibCallgrind' flowId='tst_BenchlibCallgrind'] -##teamcity[testStarted name='initTestCase()' flowId='tst_BenchlibCallgrind'] -##teamcity[testFinished name='initTestCase()' flowId='tst_BenchlibCallgrind'] -##teamcity[testIgnored name='twoHundredMillionInstructions()' message='This test is only defined for gcc and x86. |[Loc: qtbase/tests/auto/testlib/selftests/benchlibcallgrind/tst_benchlibcallgrind.cpp(0)|]' flowId='tst_BenchlibCallgrind'] -##teamcity[testStarted name='cleanupTestCase()' flowId='tst_BenchlibCallgrind'] -##teamcity[testFinished name='cleanupTestCase()' flowId='tst_BenchlibCallgrind'] -##teamcity[testSuiteFinished name='tst_BenchlibCallgrind' flowId='tst_BenchlibCallgrind'] diff --git a/tests/auto/testlib/selftests/expected_benchlibcallgrind.xml b/tests/auto/testlib/selftests/expected_benchlibcallgrind.xml deleted file mode 100644 index 14ab86b45d..0000000000 --- a/tests/auto/testlib/selftests/expected_benchlibcallgrind.xml +++ /dev/null @@ -1,23 +0,0 @@ - - - - @INSERT_QT_VERSION_HERE@ - - @INSERT_QT_VERSION_HERE@ - - - - - - - - - - - - - - - - - diff --git a/tests/auto/testlib/selftests/generate_expected_output.py b/tests/auto/testlib/selftests/generate_expected_output.py index fb62e3eaf3..677b65b33b 100755 --- a/tests/auto/testlib/selftests/generate_expected_output.py +++ b/tests/auto/testlib/selftests/generate_expected_output.py @@ -325,7 +325,7 @@ def main(argv): argument_parser.add_argument('--formats', '-f', help='Comma-separated list of formats') argument_parser.add_argument('--skip-callgrind', '-s', action='store_true', - help='Skip the expensive benchlib callgrind test') + help='Skip the (no longer expensive) benchlib callgrind test') argument_parser.add_argument('subtests', help='subtests to regenerate', nargs='*', type=str) diff --git a/tests/auto/testlib/selftests/tst_selftests.cpp b/tests/auto/testlib/selftests/tst_selftests.cpp index c5ae337629..ca8fee582a 100644 --- a/tests/auto/testlib/selftests/tst_selftests.cpp +++ b/tests/auto/testlib/selftests/tst_selftests.cpp @@ -719,8 +719,11 @@ bool TestLogger::shouldIgnoreTest(const QString &test) const || test == "silent") return true; - // `crashes' will not output valid XML on platforms without a crash handler - if (test == "crashes") + // These tests produce variable output (callgrind because of #if-ery, + // crashes by virtue of platform differences in where the output cuts + // off), so only test them for one format, to avoid the need for several + // _n variants for each format. Also, crashes can produce invalid XML. + if (test == "crashes" || test == "benchlibcallgrind") return true; // this test prints out some floats in the testlog and the formatting is @@ -728,10 +731,11 @@ bool TestLogger::shouldIgnoreTest(const QString &test) const if (test == "float") return true; - // these tests are quite slow, and running them for all the loggers significantly - // increases the overall test time. They do not really relate to logging, so it - // should be safe to run them just for the stdout loggers. - if (test == "benchlibcallgrind" || test == "sleep") + // This test is quite slow, and running it for all the loggers + // significantly increases the overall test time. It does not really + // relate to logging, so it should be safe to run it just for the stdout + // loggers. + if (test == "sleep") return true; }