From 80e1f25f680f4c3ad1f9622204f43c2819e018f3 Mon Sep 17 00:00:00 2001 From: Edward Welbourne Date: Wed, 7 Jul 2021 17:02:05 +0200 Subject: [PATCH] Fix qdbusperformance and qprocess benchmarks The tests failed because they couldn't find the servers they needed to run. The dbus server wasn't being built, due to mis-configured CMake config; fixed dbus server CMake config. Once built, the servers werent at the paths relative to the test binaries that were given in the test source files, because the test binary was in the test/ sub-directory. The dbus test just needed a ../ on its path; the qprocess one also needed its path wrapped in QFINDTESTDATA(), and a ".exe" suffix on MS. Task-number: QTBUG-91713 Change-Id: I5ace23a5815575bbf88ea88e0b16afc7b8ba6a08 Reviewed-by: Friedemann Kleint (cherry picked from commit bf99c2b62bc3bc2dc10ba8f98bea0496b2026801) Reviewed-by: Qt Cherry-pick Bot --- .../corelib/io/qprocess/tst_bench_qprocess.cpp | 10 ++++++++-- .../dbus/qdbusperformance/server/CMakeLists.txt | 4 ++-- .../dbus/qdbusperformance/tst_qdbusperformance.cpp | 4 ++-- 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/tests/benchmarks/corelib/io/qprocess/tst_bench_qprocess.cpp b/tests/benchmarks/corelib/io/qprocess/tst_bench_qprocess.cpp index 7077ec631aa..0bc0332c6f9 100644 --- a/tests/benchmarks/corelib/io/qprocess/tst_bench_qprocess.cpp +++ b/tests/benchmarks/corelib/io/qprocess/tst_bench_qprocess.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2020 The Qt Company Ltd. +** Copyright (C) 2021 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of the test suite of the Qt Toolkit. @@ -40,10 +40,16 @@ private slots: void echoTest_performance(); }; +#ifdef Q_OS_WIN +# define EXE ".exe" +#else +# define EXE "" +#endif + void tst_QProcess::echoTest_performance() { QProcess process; - process.start("testProcessLoopback/testProcessLoopback"); + process.start(QFINDTESTDATA("../testProcessLoopback/testProcessLoopback" EXE)); QByteArray array; array.resize(1024 * 1024); diff --git a/tests/benchmarks/dbus/qdbusperformance/server/CMakeLists.txt b/tests/benchmarks/dbus/qdbusperformance/server/CMakeLists.txt index ff4612d042f..c3a5ac3c8d0 100644 --- a/tests/benchmarks/dbus/qdbusperformance/server/CMakeLists.txt +++ b/tests/benchmarks/dbus/qdbusperformance/server/CMakeLists.txt @@ -4,9 +4,9 @@ ## server Binary: ##################################################################### -qt_internal_add_benchmark(server +qt_internal_add_executable(server GUI - OUTPUT_DIRECTORY "." + OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/" SOURCES ../serverobject.h server.cpp diff --git a/tests/benchmarks/dbus/qdbusperformance/tst_qdbusperformance.cpp b/tests/benchmarks/dbus/qdbusperformance/tst_qdbusperformance.cpp index 1f76c413be2..25a22247ba4 100644 --- a/tests/benchmarks/dbus/qdbusperformance/tst_qdbusperformance.cpp +++ b/tests/benchmarks/dbus/qdbusperformance/tst_qdbusperformance.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2016 The Qt Company Ltd. +** Copyright (C) 2021 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of the test suite of the Qt Toolkit. @@ -83,7 +83,7 @@ void tst_QDBusPerformance::initTestCase() #else # define EXE "" #endif - proc.start(QFINDTESTDATA("server/server" EXE)); + proc.start(QFINDTESTDATA("../server/server" EXE)); QVERIFY2(proc.waitForStarted(), qPrintable(proc.errorString())); QVERIFY(proc.waitForReadyRead());