summaryrefslogtreecommitdiffstats
path: root/tests/auto/testlib/selftests
diff options
context:
space:
mode:
authorEdward Welbourne <edward.welbourne@qt.io>2021-12-08 20:49:58 +0100
committerEdward Welbourne <edward.welbourne@qt.io>2021-12-09 20:54:25 +0100
commit93830d9ed3fcfe93331cc28f061db343e2224440 (patch)
tree6aca7093d3b72247d88f1ef18684dcc751211b27 /tests/auto/testlib/selftests
parente42fe5c775f982e89772eab5083b6dc641a870e3 (diff)
Fix x86 preprocessor check in testlib selftests
When deciding whether to run benchlibcallbrind, the code only tested _i386; it now tests __x86_64 as well, to match a recent change in the test itself. As there, reverse the test to reduce negations, flipping the stanzas it selects between. Also tidy up the code that tests for valgrind being present - and actually return true, to skip the test, when it claims to be skipping the test. Updated test results, now that the test can actually be run and produce sensible output. Added an _2.txt that matches the results presently seen in Coin on RHEL 8.4 (despite the fact that a local build on such a VM produces output matching the _1.txt results). Change-Id: Ibce09dca06a1eeb73e90fb1345834998683df9d8 Reviewed-by: MÃ¥rten Nordheim <marten.nordheim@qt.io>
Diffstat (limited to 'tests/auto/testlib/selftests')
-rw-r--r--tests/auto/testlib/selftests/expected_benchlibcallgrind_0.txt2
-rw-r--r--tests/auto/testlib/selftests/expected_benchlibcallgrind_1.txt8
-rw-r--r--tests/auto/testlib/selftests/expected_benchlibcallgrind_2.txt5
-rw-r--r--tests/auto/testlib/selftests/tst_selftests.cpp15
4 files changed, 20 insertions, 10 deletions
diff --git a/tests/auto/testlib/selftests/expected_benchlibcallgrind_0.txt b/tests/auto/testlib/selftests/expected_benchlibcallgrind_0.txt
index 750dcf4736..6986559bbf 100644
--- a/tests/auto/testlib/selftests/expected_benchlibcallgrind_0.txt
+++ b/tests/auto/testlib/selftests/expected_benchlibcallgrind_0.txt
@@ -1,6 +1,8 @@
********* Start testing of tst_BenchlibCallgrind *********
Config: Using QtTest library
PASS : tst_BenchlibCallgrind::initTestCase()
+FAIL! : tst_BenchlibCallgrind::failInChildProcess() Running under valgrind!
+ Loc: [qtbase/tests/auto/testlib/selftests/benchlibcallgrind/tst_benchlibcallgrind.cpp(0)]
SKIP : tst_BenchlibCallgrind::twoHundredMillionInstructions() This test is only defined for gcc and x86.
Loc: [qtbase/tests/auto/testlib/selftests/benchlibcallgrind/tst_benchlibcallgrind.cpp(0)]
PASS : tst_BenchlibCallgrind::cleanupTestCase()
diff --git a/tests/auto/testlib/selftests/expected_benchlibcallgrind_1.txt b/tests/auto/testlib/selftests/expected_benchlibcallgrind_1.txt
index 07365bb9e8..e00d0546f0 100644
--- a/tests/auto/testlib/selftests/expected_benchlibcallgrind_1.txt
+++ b/tests/auto/testlib/selftests/expected_benchlibcallgrind_1.txt
@@ -1,9 +1,11 @@
********* Start testing of tst_BenchlibCallgrind *********
-Config: Using QtTest library @INSERT_QT_VERSION_HERE@, Qt @INSERT_QT_VERSION_HERE@
+Config: Using QtTest library
PASS : tst_BenchlibCallgrind::initTestCase()
+FAIL! : tst_BenchlibCallgrind::failInChildProcess() Running under valgrind!
+ Loc: [qtbase/tests/auto/testlib/selftests/benchlibcallgrind/tst_benchlibcallgrind.cpp(0)]
PASS : tst_BenchlibCallgrind::twoHundredMillionInstructions()
RESULT : tst_BenchlibCallgrind::twoHundredMillionInstructions():
- 200,000,158 instruction reads per iteration (total: 200,000,158, iterations: 1)
+ 200,000,144 instruction reads per iteration (total: 200,000,144, iterations: 1)
PASS : tst_BenchlibCallgrind::cleanupTestCase()
-Totals: 3 passed, 0 failed, 0 skipped, 0 blacklisted
+Totals: 3 passed, 1 failed, 0 skipped, 0 blacklisted, 0ms
********* Finished testing of tst_BenchlibCallgrind *********
diff --git a/tests/auto/testlib/selftests/expected_benchlibcallgrind_2.txt b/tests/auto/testlib/selftests/expected_benchlibcallgrind_2.txt
new file mode 100644
index 0000000000..b905431d7c
--- /dev/null
+++ b/tests/auto/testlib/selftests/expected_benchlibcallgrind_2.txt
@@ -0,0 +1,5 @@
+********* Start testing of tst_BenchlibCallgrind *********
+Config: Using QtTest library
+PASS : tst_BenchlibCallgrind::initTestCase()
+FAIL! : tst_BenchlibCallgrind::failInChildProcess() Running under valgrind!
+ Loc: [qtbase/tests/auto/testlib/selftests/benchlibcallgrind/tst_benchlibcallgrind.cpp(0)]
diff --git a/tests/auto/testlib/selftests/tst_selftests.cpp b/tests/auto/testlib/selftests/tst_selftests.cpp
index ca8fee582a..5fdd5aa6d9 100644
--- a/tests/auto/testlib/selftests/tst_selftests.cpp
+++ b/tests/auto/testlib/selftests/tst_selftests.cpp
@@ -692,17 +692,18 @@ bool TestLogger::shouldIgnoreTest(const QString &test) const
#endif
if (test == "benchlibcallgrind") {
-#if !(defined(__GNUC__) && defined(__i386) && defined(Q_OS_LINUX))
- // Skip on platforms where callgrind is not available
- return true;
-#else
+#if defined(__GNUC__) && (defined(__i386) || defined(__x86_64)) && defined(Q_OS_LINUX)
// Check that it's actually available
QProcess checkProcess;
- QStringList args;
- args << "--version";
+ QStringList args{u"--version"_qs};
checkProcess.start("valgrind", args);
- if (!checkProcess.waitForFinished(-1))
+ if (!checkProcess.waitForFinished(-1)) {
WARN("Valgrind broken or not available. Not running benchlibcallgrind test!");
+ return true;
+ }
+#else
+ // Skip on platforms where callgrind is not available
+ return true;
#endif
}