[autotests] Wrap integration tests in dbus-session-run
Each test needs a dedicated dbus session as the test needs to register services (e.g. kglobalaccel) and might fail if that cannot be registered. Due to the wrapping in another command the test need to make sure that any process they start terminates before them. E.g. the activities test must stop kactivitymanagerd in cleanupTestCase, otherwise the test times out.icc-effect-5.14.5
parent
a69300f762
commit
bf7c670444
|
@ -11,7 +11,7 @@ function(integrationTest)
|
|||
cmake_parse_arguments(ARGS "" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
|
||||
add_executable(${ARGS_NAME} ${ARGS_SRCS})
|
||||
target_link_libraries(${ARGS_NAME} KWinIntegrationTestFramework kwin Qt5::Test ${ARGS_LIBS})
|
||||
add_test(kwin-${ARGS_NAME} ${ARGS_NAME})
|
||||
add_test(NAME kwin-${ARGS_NAME} COMMAND dbus-run-session ${CMAKE_CURRENT_BINARY_DIR}/${ARGS_NAME})
|
||||
endfunction()
|
||||
|
||||
integrationTest(NAME testStart SRCS start_test.cpp)
|
||||
|
|
|
@ -44,6 +44,7 @@ class ActivitiesTest : public QObject
|
|||
Q_OBJECT
|
||||
private Q_SLOTS:
|
||||
void initTestCase();
|
||||
void cleanupTestCase();
|
||||
void init();
|
||||
void cleanup();
|
||||
void testSetOnActivitiesValidates();
|
||||
|
@ -72,6 +73,11 @@ void ActivitiesTest::initTestCase()
|
|||
waylandServer()->initWorkspace();
|
||||
}
|
||||
|
||||
void ActivitiesTest::cleanupTestCase()
|
||||
{
|
||||
QProcess::execute(QStringLiteral("kactivitymanagerd"), QStringList{QStringLiteral("stop")});
|
||||
}
|
||||
|
||||
void ActivitiesTest::init()
|
||||
{
|
||||
screens()->setCurrent(0);
|
||||
|
|
Loading…
Reference in New Issue