Members of the KDE Community are recommended to subscribe to the kde-community mailing list at to allow them to participate in important discussions and receive other important announcements

Commit 3eb9a34f authored by David Edmundson's avatar David Edmundson Committed by Kurt Hindenburg

Re-add DBus test

Ported from KProcess::startDetached to a QProcess we can kill should the
window not exit when closed.

On the KDE CI where the window isn't quitting on close the test might
fail, but it will give us output where we can investigate.

Test Plan: Passes locally

Reviewers: #konsole, #frameworks, hindenburg

Reviewed By: #konsole, hindenburg

Subscribers: hindenburg, konsole-devel

Tags: #konsole

Differential Revision:
parent dd03c26a
......@@ -17,19 +17,12 @@ ecm_mark_nongui_executable(CharacterWidthTest)
add_test(CharacterWidthTest CharacterWidthTest)
target_link_libraries(CharacterWidthTest ${KONSOLE_TEST_LIBS})
# This test fails on kf5-qt5 SUSEQt5.9 buildbot since Oct 28, 2018
# Believed due to frameworks regession; disable to avoid sysadmins having
# to fix for every build
if (0)
add_executable(DBusTest DBusTest.cpp)
add_test(DBusTest DBusTest)
target_link_libraries(DBusTest ${KONSOLE_TEST_LIBS} Qt5::DBus)
add_executable(HistoryTest HistoryTest.cpp)
......@@ -20,13 +20,16 @@
// Own
#include "DBusTest.h"
#include "../Session.h"
#include <KProcess>
#include <QProcess>
#include <QSignalSpy>
using namespace Konsole;
/* Exec a new Konsole and grab its dbus */
void DBusTest::initTestCase()
const QString interfaceName = QStringLiteral("org.kde.konsole");
QDBusConnectionInterface *bus = nullptr;
QStringList konsoleServices;
......@@ -50,9 +53,11 @@ void DBusTest::initTestCase()
// Create a new Konsole with a separate process id
int pid = KProcess::startDetached(QStringLiteral("konsole"),
if (pid == 0) {
_process = new QProcess;
_process->start(QStringLiteral("konsole"), QStringList(QStringLiteral("--separate")));
if (!_process->waitForStarted()) {
QFAIL(QStringLiteral("Unable to exec a new Konsole").toLatin1().data());
......@@ -93,6 +98,7 @@ void DBusTest::cleanupTestCase()
// Need to take care of when user has CloseAllTabs=False otherwise
// they will get a popup dialog when we try to close this.
QSignalSpy quitSpy(_process, SIGNAL(finished(int,QProcess::ExitStatus)));
QDBusInterface iface(_interfaceName,
......@@ -103,6 +109,9 @@ void DBusTest::cleanupTestCase()
if (!instanceReply.isValid()) {
QFAIL(QStringLiteral("Unable to close Konsole: %1").arg(instanceReply.error().message()).toLatin1().data());
void DBusTest::testSessions()
......@@ -28,6 +28,8 @@
#include <unistd.h>
class QProcess;
namespace Konsole
......@@ -46,6 +48,7 @@ protected Q_SLOTS:
QString _interfaceName;
QProcess *_process = nullptr;
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment