From cac7d766b1ee637fbf1b3d18d275ec8bd9c4695e Mon Sep 17 00:00:00 2001 From: David Faure Date: Sat, 29 Jul 2017 08:40:11 +0200 Subject: [PATCH] Make unittest independent from the location of the executable. Summary: This fixes the check in the unittest when doing set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin") which I intend to do globally at some point. Turns out it's comparing with its own executable location, so we can use QCoreApplication to get it generically. Test Plan: Verified to work with ctest and with "./testWaylandServerDisplay" Reviewers: graesslin, mart Reviewed By: graesslin, mart Subscribers: plasma-devel, #frameworks Tags: #plasma_on_wayland, #frameworks Differential Revision: https://phabricator.kde.org/D6974 --- src/wayland/autotests/server/CMakeLists.txt | 1 - src/wayland/autotests/server/test_display.cpp | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/src/wayland/autotests/server/CMakeLists.txt b/src/wayland/autotests/server/CMakeLists.txt index f06e93d7cf..f5a4854c0c 100644 --- a/src/wayland/autotests/server/CMakeLists.txt +++ b/src/wayland/autotests/server/CMakeLists.txt @@ -1,7 +1,6 @@ ######################################################## # Test WaylandServerDisplay ######################################################## -add_definitions(-DAUTOTEST_CURRENT_BIN_DIR="${CMAKE_CURRENT_BINARY_DIR}") set( testWaylandServerDisplay_SRCS test_display.cpp ) diff --git a/src/wayland/autotests/server/test_display.cpp b/src/wayland/autotests/server/test_display.cpp index 2a4e07e8ee..f9e2ee607c 100644 --- a/src/wayland/autotests/server/test_display.cpp +++ b/src/wayland/autotests/server/test_display.cpp @@ -143,7 +143,7 @@ void TestWaylandServerDisplay::testClientConnection() QVERIFY(connection->groupId() != 0); QVERIFY(connection->processId() != 0); QCOMPARE(connection->display(), &display); - QCOMPARE(connection->executablePath(), QStringLiteral("%1/testWaylandServerDisplay").arg(AUTOTEST_CURRENT_BIN_DIR)); + QCOMPARE(connection->executablePath(), QCoreApplication::applicationFilePath()); QCOMPARE((wl_client*)*connection, client); const ClientConnection &constRef = *connection; QCOMPARE((wl_client*)constRef, client);