libqtdbustest-0.2+16.04.20160216/ 0000755 0000156 0000165 00000000000 12660566713 016622 5 ustar pbuser pbgroup 0000000 0000000 libqtdbustest-0.2+16.04.20160216/cmake/ 0000755 0000156 0000165 00000000000 12660566713 017702 5 ustar pbuser pbgroup 0000000 0000000 libqtdbustest-0.2+16.04.20160216/cmake/Coverage.cmake 0000644 0000156 0000165 00000004222 12660566015 022432 0 ustar pbuser pbgroup 0000000 0000000 if (CMAKE_BUILD_TYPE MATCHES coverage)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} --coverage")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} --coverage")
set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} --coverage")
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} --coverage")
find_program(GCOVR_EXECUTABLE gcovr HINTS ${GCOVR_ROOT} "${GCOVR_ROOT}/bin")
if (NOT GCOVR_EXECUTABLE)
message(STATUS "Gcovr binary was not found, can not generate XML coverage info.")
else ()
message(STATUS "Gcovr found, can generate XML coverage info.")
add_custom_target (coverage-xml
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
COMMAND "${GCOVR_EXECUTABLE}" --exclude="test.*" --exclude="obj.*" -x -r "${CMAKE_SOURCE_DIR}"
--object-directory=${CMAKE_BINARY_DIR} -o coverage.xml)
endif()
find_program(LCOV_EXECUTABLE lcov HINTS ${LCOV_ROOT} "${GCOVR_ROOT}/bin")
find_program(GENHTML_EXECUTABLE genhtml HINTS ${GENHTML_ROOT})
if (NOT LCOV_EXECUTABLE)
message(STATUS "Lcov binary was not found, can not generate HTML coverage info.")
else ()
if(NOT GENHTML_EXECUTABLE)
message(STATUS "Genthml binary not found, can not generate HTML coverage info.")
else()
message(STATUS "Lcov and genhtml found, can generate HTML coverage info.")
add_custom_target (coverage-html
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
COMMAND "${LCOV_EXECUTABLE}" --capture --output-file "${CMAKE_BINARY_DIR}/coverage.info" --no-checksum --directory "${CMAKE_BINARY_DIR}"
COMMAND "${LCOV_EXECUTABLE}" --remove "${CMAKE_BINARY_DIR}/coverage.info" '/usr/*' --output-file "${CMAKE_BINARY_DIR}/coverage.info"
COMMAND "${LCOV_EXECUTABLE}" --remove "${CMAKE_BINARY_DIR}/coverage.info" '${CMAKE_BINARY_DIR}/*' --output-file "${CMAKE_BINARY_DIR}/coverage.info"
COMMAND "${LCOV_EXECUTABLE}" --remove "${CMAKE_BINARY_DIR}/coverage.info" '${CMAKE_SOURCE_DIR}/tests/*' --output-file "${CMAKE_BINARY_DIR}/coverage.info"
COMMAND "${GENHTML_EXECUTABLE}" --prefix "${CMAKE_BINARY_DIR}" --output-directory coveragereport --title "Code Coverage" --legend --show-details coverage.info
)
endif()
endif()
endif()
libqtdbustest-0.2+16.04.20160216/cmake/FindValgrind.cmake 0000644 0000156 0000165 00000001402 12660566015 023243 0 ustar pbuser pbgroup 0000000 0000000
option(
ENABLE_MEMCHECK_OPTION
"If set to ON, enables automatic creation of memcheck targets"
OFF
)
find_program(
VALGRIND_PROGRAM
NAMES valgrind
)
if(VALGRIND_PROGRAM)
set(VALGRIND_PROGRAM_OPTIONS
"--suppressions=${CMAKE_SOURCE_DIR}/tests/data/valgrind.suppression"
"--error-exitcode=1"
"--leak-check=full"
"--gen-suppressions=all"
"--show-leak-kinds=definite"
"--quiet"
)
endif()
find_package_handle_standard_args(
VALGRIND DEFAULT_MSG
VALGRIND_PROGRAM
)
function(add_valgrind_test NAME EXECUTABLE)
if(ENABLE_MEMCHECK_OPTION AND VALGRIND_PROGRAM)
add_test(${NAME} ${VALGRIND_PROGRAM} ${VALGRIND_PROGRAM_OPTIONS} "${CMAKE_CURRENT_BINARY_DIR}/${EXECUTABLE}")
else()
add_test(${NAME} ${EXECUTABLE})
endif()
endfunction()
libqtdbustest-0.2+16.04.20160216/cmake/COPYING-CMAKE-SCRIPTS 0000644 0000156 0000165 00000002457 12660566015 022703 0 ustar pbuser pbgroup 0000000 0000000 Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. The name of the author may not be used to endorse or promote products
derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
libqtdbustest-0.2+16.04.20160216/tests/ 0000755 0000156 0000165 00000000000 12660566713 017764 5 ustar pbuser pbgroup 0000000 0000000 libqtdbustest-0.2+16.04.20160216/tests/libqtdbustest/ 0000755 0000156 0000165 00000000000 12660566713 022655 5 ustar pbuser pbgroup 0000000 0000000 libqtdbustest-0.2+16.04.20160216/tests/libqtdbustest/TestDBusTestRunner.cpp 0000644 0000156 0000165 00000005522 12660566015 027107 0 ustar pbuser pbgroup 0000000 0000000 /*
* Copyright (C) 2013 Canonical, Ltd.
*
* This library is free software; you can redistribute it and/or modify it under
* the terms of version 3 of the GNU Lesser General Public License as published
* by the Free Software Foundation.
*
* This library is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
* details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see .
*
* Author: Pete Woods
*/
#include
#include
#include
#include
using namespace std;
using namespace testing;
using namespace QtDBusTest;
namespace {
class TestDBusTestRunner: public Test {
protected:
TestDBusTestRunner() :
dbusTestRunner(TEST_DBUS_SESSION_CONFIG_FILE,
TEST_DBUS_SYSTEM_CONFIG_FILE) {
}
virtual ~TestDBusTestRunner() {
}
DBusTestRunner dbusTestRunner;
};
TEST_F(TestDBusTestRunner, StartsSessionService) {
QSharedPointer process(
new QProcessDBusService("test.session.name",
QDBusConnection::SessionBus, "/usr/bin/python3",
QStringList() << "-m" << "dbusmock" << "test.session.name"
<< "/test/object" << "test.Interface"));
dbusTestRunner.registerService(process);
dbusTestRunner.startServices();
QProcess pgrep;
pgrep.start("ps",
QStringList() << "--no-headers" << "--pid"
<< QString::number(process->pid()) << "-o" << "args");
pgrep.waitForFinished();
pgrep.waitForReadyRead();
EXPECT_EQ(
"/usr/bin/python3 -m dbusmock test.session.name /test/object test.Interface",
QString::fromUtf8(pgrep.readAll().trimmed()).toStdString());
}
TEST_F(TestDBusTestRunner, StartsSystemService) {
QSharedPointer process(
new QProcessDBusService("test.system.name",
QDBusConnection::SystemBus, "/usr/bin/python3",
QStringList() << "-m" << "dbusmock" << "-s"
<< "test.system.name" << "/test/object"
<< "test.Interface"));
dbusTestRunner.registerService(process);
dbusTestRunner.startServices();
QProcess pgrep;
pgrep.start("ps",
QStringList() << "--no-headers" << "--pid"
<< QString::number(process->pid()) << "-o" << "args");
pgrep.waitForFinished();
pgrep.waitForReadyRead();
EXPECT_EQ(
"/usr/bin/python3 -m dbusmock -s test.system.name /test/object test.Interface",
QString::fromUtf8(pgrep.readAll().trimmed()).toStdString());
}
TEST_F(TestDBusTestRunner, SetsEnvironmentVariables) {
EXPECT_EQ(dbusTestRunner.sessionBus(), qgetenv("DBUS_SESSION_BUS_ADDRESS"));
EXPECT_EQ(dbusTestRunner.systemBus(), qgetenv("DBUS_SYSTEM_BUS_ADDRESS"));
}
} // namespace
libqtdbustest-0.2+16.04.20160216/tests/libqtdbustest/TestQProcessDBusService.cpp 0000644 0000156 0000165 00000004260 12660566015 030054 0 ustar pbuser pbgroup 0000000 0000000 /*
* Copyright (C) 2013 Canonical, Ltd.
*
* This library is free software; you can redistribute it and/or modify it under
* the terms of version 3 of the GNU Lesser General Public License as published
* by the Free Software Foundation.
*
* This library is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
* details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see .
*
* Author: Pete Woods
*/
#include
#include
#include
#include
#include
using namespace std;
using namespace testing;
using namespace QtDBusTest;
namespace {
class TestQProcessDBusService: public Test {
protected:
TestQProcessDBusService() :
dbusTestRunner(TEST_DBUS_SESSION_CONFIG_FILE,
TEST_DBUS_SYSTEM_CONFIG_FILE) {
}
virtual ~TestQProcessDBusService() {
}
DBusTestRunner dbusTestRunner;
};
TEST_F(TestQProcessDBusService, WaitsForServiceAppeared) {
QProcessDBusService process("test.name", QDBusConnection::SessionBus,
"/usr/bin/python3",
QStringList() << "-m" << "dbusmock" << "test.name" << "/test/object"
<< "test.Interface");
process.start(dbusTestRunner.sessionConnection());
QProcess pgrep;
pgrep.start("ps",
QStringList() << "--no-headers" << "--pid"
<< QString::number(process.pid()) << "-o" << "args");
pgrep.waitForFinished();
pgrep.waitForReadyRead();
EXPECT_EQ(
"/usr/bin/python3 -m dbusmock test.name /test/object test.Interface",
QString::fromUtf8(pgrep.readAll().trimmed()).toStdString());
}
TEST_F(TestQProcessDBusService, ThrowsErrorForFailToStart) {
QProcessDBusService process("test.name", QDBusConnection::SessionBus,
"/usr/bin/python3",
QStringList() << "-m" << "dbusmock" << "not.test.name"
<< "/test/object" << "test.Interface");
ASSERT_THROW(process.start(dbusTestRunner.sessionConnection()),
std::logic_error);
}
} // namespace
libqtdbustest-0.2+16.04.20160216/tests/libqtdbustest/TestSuicidalProcess.cpp 0000644 0000156 0000165 00000003014 12660566015 027306 0 ustar pbuser pbgroup 0000000 0000000 /*
* Copyright (C) 2013 Canonical, Ltd.
*
* This library is free software; you can redistribute it and/or modify it under
* the terms of version 3 of the GNU Lesser General Public License as published
* by the Free Software Foundation.
*
* This library is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
* details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see .
*
* Author: Pete Woods
*/
#include
#include
#include
using namespace std;
using namespace testing;
using namespace QtDBusTest;
namespace {
class TestSuicidalProcess: public Test {
protected:
TestSuicidalProcess() {
process.setWatchdogCommand(TEST_QTDBUSTEST_WATCHDOG_BIN);
}
virtual ~TestSuicidalProcess() {
process.kill();
process.waitForFinished();
}
SuicidalProcess process;
};
TEST_F(TestSuicidalProcess, BehavesLikeNormalQProcess) {
process.start("sleep", QStringList() << "5");
QProcess pgrep;
pgrep.start("ps",
QStringList() << "--no-headers" << "--pid"
<< QString::number(process.pid()) << "-o" << "args");
pgrep.waitForFinished();
pgrep.waitForReadyRead();
EXPECT_EQ("sleep 5",
QString::fromUtf8(pgrep.readAll().trimmed()).toStdString());
}
} // namespace
libqtdbustest-0.2+16.04.20160216/tests/main.cpp 0000644 0000156 0000165 00000002174 12660566015 021413 0 ustar pbuser pbgroup 0000000 0000000 /*
* Copyright (C) 2013 Canonical, Ltd.
*
* This library is free software; you can redistribute it and/or modify it under
* the terms of version 3 of the GNU Lesser General Public License as published
* by the Free Software Foundation.
*
* This library is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
* details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see .
*
* Author: Pete Woods
*/
#include
#include
#include
int main(int argc, char **argv) {
qputenv("LANG", "C.UTF-8");
unsetenv("LC_ALL");
// setlocale(LC_ALL, "");
// bindtextdomain(GETTEXT_PACKAGE, LOCALE_DIR);
// textdomain(GETTEXT_PACKAGE);
QCoreApplication application(argc, argv);
::testing::InitGoogleTest(&argc, argv);
return RUN_ALL_TESTS();
}
libqtdbustest-0.2+16.04.20160216/tests/data/ 0000755 0000156 0000165 00000000000 12660566713 020675 5 ustar pbuser pbgroup 0000000 0000000 libqtdbustest-0.2+16.04.20160216/tests/data/valgrind.suppression 0000644 0000156 0000165 00000001544 12660566015 025016 0 ustar pbuser pbgroup 0000000 0000000 {
Ignore pthreads
Memcheck:Leak
...
fun:pthread_create@@*
}
{
Glib memalign
Memcheck:Leak
...
fun:posix_memalign
}
{
Ignore glib mainloop
Memcheck:Leak
...
fun:g_main_context_push_thread_default
}
{
Ignore glib main context
Memcheck:Leak
...
fun:g_main_context_new
}
{
False positive leak on strings in i386
Memcheck:Leak
fun:_Znwj
fun:_ZNSs4_Rep9_S_createEjjRKSaIcE
...
fun:_ZN7testing14InitGoogleTestEPiPPc
fun:(below main)
}
{
False positive leak on strings on i386
Memcheck:Leak
fun:_Znwj
fun:_ZNSs4_Rep9_S_createEjjRKSaIcE
...
fun:__libc_csu_init
fun:(below main)
}
{
Qt apparently has some statically allocated data here
Memcheck:Leak
fun:calloc
fun:allocate_dtv
fun:_ZN7QThread5startENS_8PriorityE
obj:/usr/lib/*/libQt5Core.so.*
...
obj:*
}
libqtdbustest-0.2+16.04.20160216/tests/CMakeLists.txt 0000644 0000156 0000165 00000001546 12660566015 022525 0 ustar pbuser pbgroup 0000000 0000000
set(CMAKE_AUTOMOC OFF)
include(FindGMock)
set(CMAKE_AUTOMOC ON)
find_package("Valgrind" REQUIRED)
include_directories(${CMAKE_CURRENT_SOURCE_DIR})
include_directories(${GMOCK_INCLUDE_DIRS})
include_directories(${GTEST_INCLUDE_DIRS})
add_definitions(-DTEST_DBUS_SESSION_CONFIG_FILE="${DATA_DIR}/session.conf")
add_definitions(-DTEST_DBUS_SYSTEM_CONFIG_FILE="${DATA_DIR}/system.conf")
add_definitions(-DTEST_QTDBUSTEST_WATCHDOG_BIN="${CMAKE_BINARY_DIR}/src/watchdog/watchdog")
set(
UNIT_TESTS_SRC
main.cpp
libqtdbustest/TestDBusTestRunner.cpp
libqtdbustest/TestQProcessDBusService.cpp
libqtdbustest/TestSuicidalProcess.cpp
)
add_executable(
unit-tests
${UNIT_TESTS_SRC}
)
qt5_use_modules(
unit-tests
Core
DBus
Test
)
target_link_libraries(
unit-tests
qtdbustest
${GTEST_LIBRARIES}
${GMOCK_LIBRARIES}
)
add_valgrind_test(
unit-tests
unit-tests
)
libqtdbustest-0.2+16.04.20160216/src/ 0000755 0000156 0000165 00000000000 12660566713 017411 5 ustar pbuser pbgroup 0000000 0000000 libqtdbustest-0.2+16.04.20160216/src/libqtdbustest/ 0000755 0000156 0000165 00000000000 12660566713 022302 5 ustar pbuser pbgroup 0000000 0000000 libqtdbustest-0.2+16.04.20160216/src/libqtdbustest/DBusTestRunner.cpp 0000644 0000156 0000165 00000007466 12660566015 025705 0 ustar pbuser pbgroup 0000000 0000000 /*
* Copyright (C) 2013 Canonical, Ltd.
*
* This library is free software; you can redistribute it and/or modify it under
* the terms of version 3 of the GNU Lesser General Public License as published
* by the Free Software Foundation.
*
* This library is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
* details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see .
*
* Author: Pete Woods
*/
#include
#include
namespace QtDBusTest {
class DBusTestRunnerPrivate {
public:
DBusTestRunnerPrivate() :
m_sessionConnection("DBusTestRunner-session"), m_systemConnection(
"DBusTestRunner-system") {
}
QString m_sessionBus;
QDBusConnection m_sessionConnection;
SuicidalProcess m_sessionDBus;
QString m_systemBus;
QDBusConnection m_systemConnection;
SuicidalProcess m_systemDBus;
QList m_services;
};
DBusTestRunner::DBusTestRunner(const QString &dbusSessionConfigFile,
const QString &dbusSystemConfigFile) :
d(new DBusTestRunnerPrivate()) {
// If we are already running inside a QDBus test environment
if (qEnvironmentVariableIsSet("QDBUS_TEST_RUNNER_PARENT")) {
// session bus setup
d->m_sessionBus = QString::fromUtf8(
qgetenv("DBUS_SESSION_BUS_ADDRESS"));
d->m_sessionConnection = QDBusConnection::sessionBus();
// system bus setup
d->m_systemBus = QString::fromUtf8(qgetenv("DBUS_SYSTEM_BUS_ADDRESS"));
d->m_systemConnection = QDBusConnection::systemBus();
} else {
// session bus setup
d->m_sessionDBus.setProcessChannelMode(QProcess::MergedChannels);
d->m_sessionDBus.start("dbus-daemon",
QStringList() << "--config-file" << dbusSessionConfigFile
<< "--print-address");
Q_ASSERT(d->m_sessionDBus.waitForStarted());
d->m_sessionDBus.waitForReadyRead();
d->m_sessionBus = d->m_sessionDBus.readAll().trimmed();
qputenv("DBUS_SESSION_BUS_ADDRESS", d->m_sessionBus.toUtf8());
qputenv("DBUS_STARTER_ADDRESS", d->m_sessionBus.toUtf8());
qputenv("DBUS_STARTER_BUS_TYPE", "session");
d->m_sessionConnection = QDBusConnection::connectToBus(d->m_sessionBus,
d->m_sessionBus);
// system bus setup
d->m_systemDBus.setProcessChannelMode(QProcess::MergedChannels);
d->m_systemDBus.start("dbus-daemon",
QStringList() << "--config-file" << dbusSystemConfigFile
<< "--print-address");
Q_ASSERT(d->m_systemDBus.waitForStarted());
d->m_systemDBus.waitForReadyRead();
d->m_systemBus = d->m_systemDBus.readAll().trimmed();
qputenv("DBUS_SYSTEM_BUS_ADDRESS", d->m_systemBus.toUtf8());
d->m_systemConnection = QDBusConnection::connectToBus(d->m_systemBus,
d->m_systemBus);
}
}
DBusTestRunner::~DBusTestRunner() {
d->m_services.clear();
}
void DBusTestRunner::registerService(DBusServicePtr service) {
d->m_services.push_back(service);
}
void DBusTestRunner::startServices() {
for (DBusServicePtr service : d->m_services) {
switch (service->busType()) {
case QDBusConnection::SystemBus:
service->start(d->m_systemConnection);
break;
case QDBusConnection::SessionBus:
service->start(d->m_sessionConnection);
break;
case QDBusConnection::ActivationBus:
qWarning() << "Unknown bus type";
break;
}
}
}
const QDBusConnection & DBusTestRunner::sessionConnection() const {
return d->m_sessionConnection;
}
const QString & DBusTestRunner::sessionBus() const {
return d->m_sessionBus;
}
const QDBusConnection & DBusTestRunner::systemConnection() const {
return d->m_systemConnection;
}
const QString & DBusTestRunner::systemBus() const {
return d->m_systemBus;
}
}
libqtdbustest-0.2+16.04.20160216/src/libqtdbustest/QProcessDBusService.cpp 0000644 0000156 0000165 00000005671 12660566021 026645 0 ustar pbuser pbgroup 0000000 0000000 /*
* Copyright (C) 2013 Canonical, Ltd.
*
* This library is free software; you can redistribute it and/or modify it under
* the terms of version 3 of the GNU Lesser General Public License as published
* by the Free Software Foundation.
*
* This library is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
* details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see .
*
* Author: Pete Woods
*/
#include
#include
#include
#include
#include
#include
namespace QtDBusTest {
namespace {
int timeoutInSeconds() {
const int defaultTimeout = 15;
QByteArray timeoutString = qgetenv("QDBUS_DBUS_START_TIMEOUT");
if (!timeoutString.isEmpty()) {
bool ok;
const int timeout = timeoutString.toInt(&ok);
if (ok) {
return timeout;
}
}
return defaultTimeout;
}
} // anonymous namespace
class QProcessDBusServicePrivate {
public:
QProcessDBusServicePrivate(const QString &program,
const QStringList &arguments) :
m_program(program), m_arguments(arguments) {
}
QString m_program;
QStringList m_arguments;
SuicidalProcess m_process;
};
QProcessDBusService::QProcessDBusService(const QString &name,
QDBusConnection::BusType busType, const QString &program,
const QStringList &arguments) :
DBusService(name, busType), p(
new QProcessDBusServicePrivate(program, arguments)) {
}
QProcessDBusService::~QProcessDBusService() {
}
void QProcessDBusService::start(const QDBusConnection &connection) {
QDBusServiceWatcher watcher(name(), connection,
QDBusServiceWatcher::WatchForRegistration);
QSignalSpy spy(&watcher,
SIGNAL(serviceOwnerChanged(const QString &,const QString &,const QString &)));
QProcessEnvironment environment(QProcessEnvironment::systemEnvironment());
environment.insert("QDBUS_TEST_RUNNER_PARENT", "1");
p->m_process.setProcessEnvironment(environment);
p->m_process.setProcessChannelMode(QProcess::ForwardedChannels);
p->m_process.start(p->m_program, p->m_arguments);
if (name().isEmpty()) {
if (!p->m_process.waitForStarted()) {
QString error = "Process [" + p->m_program + "] for service ["
+ name() + "] failed to start";
throw std::logic_error(error.toStdString());
}
} else {
spy.wait(timeoutInSeconds() * 1000);
if (spy.empty()) {
QString error = "Process [" + p->m_program + "] for service ["
+ name() + "] failed to appear on bus";
throw std::logic_error(error.toStdString());
}
}
}
Q_PID QProcessDBusService::pid() const {
return p->m_process.pid();
}
const QProcess & QProcessDBusService::underlyingProcess() const {
return p->m_process;
}
}
libqtdbustest-0.2+16.04.20160216/src/libqtdbustest/config.h.in 0000644 0000156 0000165 00000001733 12660566015 024324 0 ustar pbuser pbgroup 0000000 0000000 /*
* Copyright (C) 2013 Canonical, Ltd.
*
* This library is free software; you can redistribute it and/or modify it under
* the terms of version 3 of the GNU Lesser General Public License as published
* by the Free Software Foundation.
*
* This library is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
* details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see .
*
* Author: Pete Woods
*/
#ifndef LIBQTDBUSTEST_CONFIG_H_
#define LIBQTDBUSTEST_CONFIG_H_
#define DBUS_SYSTEM_CONFIG_FILE "@DBUS_SYSTEM_CONFIG_FILE@"
#define DBUS_SESSION_CONFIG_FILE "@DBUS_SESSION_CONFIG_FILE@"
#define QTDBUSTEST_WATCHDOG_BIN "@QTDBUSTEST_WATCHDOG_BIN@"
#endif // LIBQTDBUSTEST_CONFIG_H_
libqtdbustest-0.2+16.04.20160216/src/libqtdbustest/SuicidalProcess.cpp 0000644 0000156 0000165 00000003161 12660566015 026076 0 ustar pbuser pbgroup 0000000 0000000 /*
* Copyright (C) 2013 Canonical, Ltd.
*
* This library is free software; you can redistribute it and/or modify it under
* the terms of version 3 of the GNU Lesser General Public License as published
* by the Free Software Foundation.
*
* This library is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
* details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see .
*
* Author: Pete Woods
*/
#include
#include
namespace QtDBusTest {
class SuicidalProcessPrivate {
public:
SuicidalProcessPrivate() :
m_watchdogCommand(QTDBUSTEST_WATCHDOG_BIN) {
}
~SuicidalProcessPrivate() {
}
QString m_watchdogCommand;
QProcess m_watchdog;
};
SuicidalProcess::SuicidalProcess(QObject *parent) :
QProcess(parent), d(new SuicidalProcessPrivate()) {
connect(this, SIGNAL(started()), this, SLOT(setSuicidal()));
}
SuicidalProcess::~SuicidalProcess() {
d->m_watchdog.kill();
d->m_watchdog.waitForFinished();
terminate();
waitForFinished();
}
void SuicidalProcess::setSuicidal() {
d->m_watchdog.start(d->m_watchdogCommand,
QStringList() << QString::number(QCoreApplication::applicationPid())
<< QString::number(pid()));
}
void SuicidalProcess::setWatchdogCommand(const QString &watchdogCommand) {
d->m_watchdogCommand = watchdogCommand;
}
} /* namespace QtDBusTest */
libqtdbustest-0.2+16.04.20160216/src/libqtdbustest/QProcessDBusService.h 0000644 0000156 0000165 00000002656 12660566015 026315 0 ustar pbuser pbgroup 0000000 0000000 /*
* Copyright (C) 2013 Canonical, Ltd.
*
* This library is free software; you can redistribute it and/or modify it under
* the terms of version 3 of the GNU Lesser General Public License as published
* by the Free Software Foundation.
*
* This library is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
* details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see .
*
* Author: Pete Woods
*/
#ifndef QTDBUSTEST_QPROCESSDBUSSERVICE_H_
#define QTDBUSTEST_QPROCESSDBUSSERVICE_H_
#include
#include
#include
#include
namespace QtDBusTest {
class QProcessDBusServicePrivate;
class Q_DECL_EXPORT QProcessDBusService: public DBusService {
public:
explicit QProcessDBusService(const QString &name,
QDBusConnection::BusType busType, const QString &program,
const QStringList &arguments);
virtual ~QProcessDBusService();
virtual void start(const QDBusConnection &connection);
virtual Q_PID pid() const;
virtual const QProcess & underlyingProcess() const;
private:
QScopedPointer p;
};
}
#endif /* QTDBUSTEST_QPROCESSDBUSSERVICE_H_ */
libqtdbustest-0.2+16.04.20160216/src/libqtdbustest/SuicidalProcess.h 0000644 0000156 0000165 00000002336 12660566015 025546 0 ustar pbuser pbgroup 0000000 0000000 /*
* Copyright (C) 2013 Canonical, Ltd.
*
* This library is free software; you can redistribute it and/or modify it under
* the terms of version 3 of the GNU Lesser General Public License as published
* by the Free Software Foundation.
*
* This library is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
* details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see .
*
* Author: Pete Woods
*/
#ifndef SUICIDALPROCESS_H_
#define SUICIDALPROCESS_H_
#include
#include
namespace QtDBusTest {
class SuicidalProcessPrivate;
class Q_DECL_EXPORT SuicidalProcess: public QProcess {
Q_OBJECT
public:
explicit SuicidalProcess(QObject *parent = 0);
virtual ~SuicidalProcess();
void setWatchdogCommand(const QString &watchdogCommand);
protected Q_SLOTS:
virtual void setSuicidal();
private:
QScopedPointer d;
};
} /* namespace QtDBusTest */
#endif /* SUICIDALPROCESS_H_ */
libqtdbustest-0.2+16.04.20160216/src/libqtdbustest/libqtdbustest.pc.in 0000644 0000156 0000165 00000000455 12660566015 026123 0 ustar pbuser pbgroup 0000000 0000000 libdir=@CMAKE_INSTALL_FULL_LIBDIR@
includedir=@CMAKE_INSTALL_FULL_INCLUDEDIR@
Cflags: -I${includedir}/libqtdbustest-@API_VERSION@
Requires: Qt5Core
Libs: -L${libdir} -lqtdbustest
Name: libqtdbustest
Description: A library to facilitate testing DBus services written in Qt/C++
Version: @ABI_VERSION@
libqtdbustest-0.2+16.04.20160216/src/libqtdbustest/DBusService.cpp 0000644 0000156 0000165 00000002417 12660566015 025163 0 ustar pbuser pbgroup 0000000 0000000 /*
* Copyright (C) 2013 Canonical, Ltd.
*
* This library is free software; you can redistribute it and/or modify it under
* the terms of version 3 of the GNU Lesser General Public License as published
* by the Free Software Foundation.
*
* This library is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
* details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see .
*
* Author: Pete Woods
*/
#include
namespace QtDBusTest {
class DBusServicePrivate {
public:
DBusServicePrivate(const QString &name, QDBusConnection::BusType busType) :
m_name(name), m_busType(busType) {
}
QString m_name;
QDBusConnection::BusType m_busType;
};
DBusService::DBusService(const QString &name, QDBusConnection::BusType busType) :
d(new DBusServicePrivate(name, busType)) {
}
DBusService::~DBusService() {
}
const QString & DBusService::name() const {
return d->m_name;
}
QDBusConnection::BusType DBusService::busType() const {
return d->m_busType;
}
}
libqtdbustest-0.2+16.04.20160216/src/libqtdbustest/DBusService.h 0000644 0000156 0000165 00000002522 12660566015 024625 0 ustar pbuser pbgroup 0000000 0000000 /*
* Copyright (C) 2013 Canonical, Ltd.
*
* This library is free software; you can redistribute it and/or modify it under
* the terms of version 3 of the GNU Lesser General Public License as published
* by the Free Software Foundation.
*
* This library is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
* details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see .
*
* Author: Pete Woods
*/
#ifndef QTDBUSTEST_DBUSSERVICE_H_
#define QTDBUSTEST_DBUSSERVICE_H_
#include
#include
#include
namespace QtDBusTest {
class DBusService;
class DBusServicePrivate;
typedef QSharedPointer DBusServicePtr;
class Q_DECL_EXPORT DBusService {
public:
DBusService(const QString &name, QDBusConnection::BusType busType);
virtual ~DBusService();
virtual const QString & name() const;
virtual QDBusConnection::BusType busType() const;
virtual void start(const QDBusConnection &connection) = 0;
private:
QScopedPointer d;
};
}
#endif /* QTDBUSTEST_DBUSSERVICE_H_ */
libqtdbustest-0.2+16.04.20160216/src/libqtdbustest/CMakeLists.txt 0000644 0000156 0000165 00000001664 12660566015 025044 0 ustar pbuser pbgroup 0000000 0000000
set(
QTDBUSTEST_SRC
DBusTestRunner.cpp
DBusService.cpp
QProcessDBusService.cpp
SuicidalProcess.cpp
)
set(
QTDBUSTEST_PUBLIC_HEADERS
"${CMAKE_CURRENT_BINARY_DIR}/config.h"
DBusTestRunner.h
DBusService.h
QProcessDBusService.h
SuicidalProcess.h
)
add_library(
qtdbustest
SHARED
${QTDBUSTEST_SRC}
)
qt5_use_modules(
qtdbustest
Core
DBus
Test
)
set_target_properties(
qtdbustest
PROPERTIES
VERSION ${API_VERSION}.0.0
SOVERSION ${ABI_VERSION}
PUBLIC_HEADER "${QTDBUSTEST_PUBLIC_HEADERS}"
)
install(
TARGETS qtdbustest
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
PUBLIC_HEADER DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/libqtdbustest-${API_VERSION}/libqtdbustest"
)
# Package config
set(LIBQTDBUSTEST_PC "${CMAKE_CURRENT_BINARY_DIR}/libqtdbustest-${API_VERSION}.pc")
configure_file("libqtdbustest.pc.in" "${LIBQTDBUSTEST_PC}" @ONLY)
install(
FILES "${LIBQTDBUSTEST_PC}"
DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig"
)
libqtdbustest-0.2+16.04.20160216/src/libqtdbustest/DBusTestRunner.h 0000644 0000156 0000165 00000003071 12660566015 025336 0 ustar pbuser pbgroup 0000000 0000000 /*
* Copyright (C) 2013 Canonical, Ltd.
*
* This library is free software; you can redistribute it and/or modify it under
* the terms of version 3 of the GNU Lesser General Public License as published
* by the Free Software Foundation.
*
* This library is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
* details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see .
*
* Author: Pete Woods
*/
#include
#include
#include
#include
#include
#ifndef QTDBUSTEST_DBUSTESTRUNNER_H_
#define QTDBUSTEST_DBUSTESTRUNNER_H_
namespace QtDBusTest {
class DBusTestRunnerPrivate;
class Q_DECL_EXPORT DBusTestRunner {
public:
explicit DBusTestRunner(const QString &dbusSessionConfigFile =
DBUS_SESSION_CONFIG_FILE, const QString &dbusSystemConfigFile =
DBUS_SYSTEM_CONFIG_FILE);
virtual ~DBusTestRunner();
virtual void startServices();
virtual const QDBusConnection & sessionConnection() const;
virtual const QString & sessionBus() const;
virtual const QDBusConnection & systemConnection() const;
virtual const QString & systemBus() const;
virtual void registerService(DBusServicePtr service);
private:
QScopedPointer d;
};
}
#endif // QTDBUSTEST_DBUSTESTRUNNER_H_
libqtdbustest-0.2+16.04.20160216/src/CMakeLists.txt 0000644 0000156 0000165 00000000231 12660566015 022140 0 ustar pbuser pbgroup 0000000 0000000 include(GenerateExportHeader)
add_compiler_export_flags()
add_subdirectory(watchdog)
add_subdirectory(libqtdbustest)
add_subdirectory(qdbus-test-runner) libqtdbustest-0.2+16.04.20160216/src/qdbus-test-runner/ 0000755 0000156 0000165 00000000000 12660566713 023013 5 ustar pbuser pbgroup 0000000 0000000 libqtdbustest-0.2+16.04.20160216/src/qdbus-test-runner/qdbus-simple-test-runner.cpp 0000644 0000156 0000165 00000003776 12660566015 030420 0 ustar pbuser pbgroup 0000000 0000000 /*
* Copyright (C) 2013 Canonical, Ltd.
*
* This library is free software; you can redistribute it and/or modify it under
* the terms of version 3 of the GNU Lesser General Public License as published
* by the Free Software Foundation.
*
* This library is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
* details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see .
*
* Author: Pete Woods
*/
#include
#include
#include
#include
using namespace QtDBusTest;
static void exitQt(int sig) {
Q_UNUSED(sig);
QCoreApplication::exit(0);
}
class ExitListener: public QObject {
Q_OBJECT
public Q_SLOTS:
void finished(int exitCode, QProcess::ExitStatus exitStatus) {
if (exitStatus == QProcess::CrashExit && exitCode == 0) {
exitCode = 1;
}
QCoreApplication::exit(exitCode);
}
};
int main(int argc, char **argv) {
QCoreApplication application(argc, argv);
signal(SIGINT, &exitQt);
signal(SIGTERM, &exitQt);
DBusTestRunner runner;
if (argc < 2) {
qWarning() << "Usage:" << argv[0] << "COMMAND ";
return 1;
}
QString command(QString::fromUtf8(argv[1]));
QStringList arguments;
for (int i(2); i < argc; ++i) {
arguments << QString::fromUtf8(argv[i]);
}
QSharedPointer service(
new QProcessDBusService("", QDBusConnection::SessionBus, command,
arguments));
runner.registerService(service);
runner.startServices();
ExitListener listener;
QObject::connect(&service->underlyingProcess(),
SIGNAL(finished(int, QProcess::ExitStatus)), &listener,
SLOT(finished(int, QProcess::ExitStatus)));
return application.exec();
}
#include "qdbus-simple-test-runner.moc"
libqtdbustest-0.2+16.04.20160216/src/qdbus-test-runner/CMakeLists.txt 0000644 0000156 0000165 00000000410 12660566015 025541 0 ustar pbuser pbgroup 0000000 0000000
add_executable(
qdbus-simple-test-runner
qdbus-simple-test-runner.cpp
)
target_link_libraries(
qdbus-simple-test-runner
qtdbustest
)
qt5_use_modules(
qdbus-simple-test-runner
Core
)
install(
TARGETS qdbus-simple-test-runner
RUNTIME DESTINATION "bin"
)
libqtdbustest-0.2+16.04.20160216/src/watchdog/ 0000755 0000156 0000165 00000000000 12660566713 021211 5 ustar pbuser pbgroup 0000000 0000000 libqtdbustest-0.2+16.04.20160216/src/watchdog/main.cpp 0000644 0000156 0000165 00000002372 12660566015 022640 0 ustar pbuser pbgroup 0000000 0000000 /*
* Copyright (C) 2013 Canonical, Ltd.
*
* This library is free software; you can redistribute it and/or modify it under
* the terms of version 3 of the GNU Lesser General Public License as published
* by the Free Software Foundation.
*
* This library is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
* details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see .
*
* Author: Pete Woods
*/
#include
#include
#include
#include
using namespace QtDBusTest;
static void exitQt(int sig) {
Q_UNUSED(sig);
QCoreApplication::exit(0);
}
int main(int argc, char **argv) {
QCoreApplication application(argc, argv);
signal(SIGINT, &exitQt);
signal(SIGTERM, &exitQt);
if (argc != 3) {
qWarning() << "Usage: " << argv[0] << "PARENT_PID TARGET_ID";
exit(1);
}
Watchdog watchdog(QString::fromUtf8(argv[1]).toLongLong(),
QString::fromUtf8(argv[2]).toLongLong());
return application.exec();
}
libqtdbustest-0.2+16.04.20160216/src/watchdog/Watchdog.cpp 0000644 0000156 0000165 00000002347 12660566015 023456 0 ustar pbuser pbgroup 0000000 0000000 /*
* Copyright (C) 2013 Canonical, Ltd.
*
* This library is free software; you can redistribute it and/or modify it under
* the terms of version 3 of the GNU Lesser General Public License as published
* by the Free Software Foundation.
*
* This library is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
* details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see .
*
* Author: Pete Woods
*/
#include
#include
#include
#include
namespace QtDBusTest {
Watchdog::Watchdog(Q_PID parentPid, Q_PID childPid) :
m_parentPid(parentPid), m_childPid(childPid) {
m_timer.setInterval(1000);
connect(&m_timer, SIGNAL(timeout()), this, SLOT(timeout()));
m_timer.start();
}
Watchdog::~Watchdog() {
}
void Watchdog::timeout() {
// if the parent process is dead
if (kill(m_parentPid, 0) != 0) {
kill(m_childPid, SIGKILL);
QCoreApplication::exit(0);
}
}
} /* namespace QtDBusTest */
libqtdbustest-0.2+16.04.20160216/src/watchdog/CMakeLists.txt 0000644 0000156 0000165 00000000275 12660566015 023750 0 ustar pbuser pbgroup 0000000 0000000
add_executable(
watchdog
Watchdog.cpp
main.cpp
)
qt5_use_modules(
watchdog
Core
)
install(
TARGETS watchdog
RUNTIME DESTINATION "${CMAKE_INSTALL_FULL_LIBEXECDIR}/libqtdbustest"
)
libqtdbustest-0.2+16.04.20160216/src/watchdog/Watchdog.h 0000644 0000156 0000165 00000002213 12660566015 023113 0 ustar pbuser pbgroup 0000000 0000000 /*
* Copyright (C) 2013 Canonical, Ltd.
*
* This library is free software; you can redistribute it and/or modify it under
* the terms of version 3 of the GNU Lesser General Public License as published
* by the Free Software Foundation.
*
* This library is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
* details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see .
*
* Author: Pete Woods
*/
#ifndef LIBQTDBUSTEST_WATHDOG_H_
#define LIBQTDBUSTEST_WATHDOG_H_
#include
#include
#include
namespace QtDBusTest {
class Q_DECL_EXPORT Watchdog: public QObject {
Q_OBJECT
public:
Watchdog(Q_PID parentPid, Q_PID childPid);
virtual ~Watchdog();
protected Q_SLOTS:
void timeout();
protected:
Q_PID m_parentPid;
Q_PID m_childPid;
QTimer m_timer;
};
} /* namespace QtDBusTest */
#endif /* LIBQTDBUSTEST_WATHDOG_H_ */
libqtdbustest-0.2+16.04.20160216/COPYING 0000644 0000156 0000165 00000016727 12660566015 017665 0 ustar pbuser pbgroup 0000000 0000000 GNU LESSER GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc.
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
This version of the GNU Lesser General Public License incorporates
the terms and conditions of version 3 of the GNU General Public
License, supplemented by the additional permissions listed below.
0. Additional Definitions.
As used herein, "this License" refers to version 3 of the GNU Lesser
General Public License, and the "GNU GPL" refers to version 3 of the GNU
General Public License.
"The Library" refers to a covered work governed by this License,
other than an Application or a Combined Work as defined below.
An "Application" is any work that makes use of an interface provided
by the Library, but which is not otherwise based on the Library.
Defining a subclass of a class defined by the Library is deemed a mode
of using an interface provided by the Library.
A "Combined Work" is a work produced by combining or linking an
Application with the Library. The particular version of the Library
with which the Combined Work was made is also called the "Linked
Version".
The "Minimal Corresponding Source" for a Combined Work means the
Corresponding Source for the Combined Work, excluding any source code
for portions of the Combined Work that, considered in isolation, are
based on the Application, and not on the Linked Version.
The "Corresponding Application Code" for a Combined Work means the
object code and/or source code for the Application, including any data
and utility programs needed for reproducing the Combined Work from the
Application, but excluding the System Libraries of the Combined Work.
1. Exception to Section 3 of the GNU GPL.
You may convey a covered work under sections 3 and 4 of this License
without being bound by section 3 of the GNU GPL.
2. Conveying Modified Versions.
If you modify a copy of the Library, and, in your modifications, a
facility refers to a function or data to be supplied by an Application
that uses the facility (other than as an argument passed when the
facility is invoked), then you may convey a copy of the modified
version:
a) under this License, provided that you make a good faith effort to
ensure that, in the event an Application does not supply the
function or data, the facility still operates, and performs
whatever part of its purpose remains meaningful, or
b) under the GNU GPL, with none of the additional permissions of
this License applicable to that copy.
3. Object Code Incorporating Material from Library Header Files.
The object code form of an Application may incorporate material from
a header file that is part of the Library. You may convey such object
code under terms of your choice, provided that, if the incorporated
material is not limited to numerical parameters, data structure
layouts and accessors, or small macros, inline functions and templates
(ten or fewer lines in length), you do both of the following:
a) Give prominent notice with each copy of the object code that the
Library is used in it and that the Library and its use are
covered by this License.
b) Accompany the object code with a copy of the GNU GPL and this license
document.
4. Combined Works.
You may convey a Combined Work under terms of your choice that,
taken together, effectively do not restrict modification of the
portions of the Library contained in the Combined Work and reverse
engineering for debugging such modifications, if you also do each of
the following:
a) Give prominent notice with each copy of the Combined Work that
the Library is used in it and that the Library and its use are
covered by this License.
b) Accompany the Combined Work with a copy of the GNU GPL and this license
document.
c) For a Combined Work that displays copyright notices during
execution, include the copyright notice for the Library among
these notices, as well as a reference directing the user to the
copies of the GNU GPL and this license document.
d) Do one of the following:
0) Convey the Minimal Corresponding Source under the terms of this
License, and the Corresponding Application Code in a form
suitable for, and under terms that permit, the user to
recombine or relink the Application with a modified version of
the Linked Version to produce a modified Combined Work, in the
manner specified by section 6 of the GNU GPL for conveying
Corresponding Source.
1) Use a suitable shared library mechanism for linking with the
Library. A suitable mechanism is one that (a) uses at run time
a copy of the Library already present on the user's computer
system, and (b) will operate properly with a modified version
of the Library that is interface-compatible with the Linked
Version.
e) Provide Installation Information, but only if you would otherwise
be required to provide such information under section 6 of the
GNU GPL, and only to the extent that such information is
necessary to install and execute a modified version of the
Combined Work produced by recombining or relinking the
Application with a modified version of the Linked Version. (If
you use option 4d0, the Installation Information must accompany
the Minimal Corresponding Source and Corresponding Application
Code. If you use option 4d1, you must provide the Installation
Information in the manner specified by section 6 of the GNU GPL
for conveying Corresponding Source.)
5. Combined Libraries.
You may place library facilities that are a work based on the
Library side by side in a single library together with other library
facilities that are not Applications and are not covered by this
License, and convey such a combined library under terms of your
choice, if you do both of the following:
a) Accompany the combined library with a copy of the same work based
on the Library, uncombined with any other library facilities,
conveyed under the terms of this License.
b) Give prominent notice with the combined library that part of it
is a work based on the Library, and explaining where to find the
accompanying uncombined form of the same work.
6. Revised Versions of the GNU Lesser General Public License.
The Free Software Foundation may publish revised and/or new versions
of the GNU Lesser General Public License from time to time. Such new
versions will be similar in spirit to the present version, but may
differ in detail to address new problems or concerns.
Each version is given a distinguishing version number. If the
Library as you received it specifies that a certain numbered version
of the GNU Lesser General Public License "or any later version"
applies to it, you have the option of following the terms and
conditions either of that published version or of any later version
published by the Free Software Foundation. If the Library as you
received it does not specify a version number of the GNU Lesser
General Public License, you may choose any version of the GNU Lesser
General Public License ever published by the Free Software Foundation.
If the Library as you received it specifies that a proxy can decide
whether future versions of the GNU Lesser General Public License shall
apply, that proxy's public statement of acceptance of any version is
permanent authorization for you to choose that version for the
Library.
libqtdbustest-0.2+16.04.20160216/data/ 0000755 0000156 0000165 00000000000 12660566713 017533 5 ustar pbuser pbgroup 0000000 0000000 libqtdbustest-0.2+16.04.20160216/data/system.conf 0000644 0000156 0000165 00000001232 12660566015 021717 0 ustar pbuser pbgroup 0000000 0000000
system
unix:tmpdir=/tmp
libqtdbustest-0.2+16.04.20160216/data/CMakeLists.txt 0000644 0000156 0000165 00000000145 12660566015 022266 0 ustar pbuser pbgroup 0000000 0000000
install(
FILES
session.conf
system.conf
DESTINATION
"${CMAKE_INSTALL_DATADIR}/libqtdbustest/"
) libqtdbustest-0.2+16.04.20160216/data/session.conf 0000644 0000156 0000165 00000003155 12660566015 022064 0 ustar pbuser pbgroup 0000000 0000000
session
unix:tmpdir=/tmp
60000
1000000000
1000000000
1000000000
120000
240000
100000
10000
100000
10000
50000
50000
50000
300000
libqtdbustest-0.2+16.04.20160216/build.sh 0000755 0000156 0000165 00000002674 12660566015 020264 0 ustar pbuser pbgroup 0000000 0000000 #! /bin/bash
set -e
ECLIPSE=false
CLEAN=false
SOURCEDIR="$PWD"
BRANCHNAME=`basename $SOURCEDIR`
BUILDDIR="$SOURCEDIR/../$BRANCHNAME-build"
usage() {
echo "usage: $0 [OPTIONS] [BUILD_TYPE]\n" >&2
echo "Script to build libqtdbustest. If BUILD_TYPE is not specified, it defaults to \"Debug\".\n" >&2
echo "OPTIONS:" >&2
echo " -e, --eclipse Generate Eclipse projects" >&2
echo " -c, --clean Clean the build tree before building" >&2
echo >&2
exit 1
}
ARGS=`getopt -n$0 -u -a --longoptions="eclipse,clean,help" -o "sch" -- "$@"`
[ $? -ne 0 ] && usage
eval set -- "$ARGS"
while [ $# -gt 0 ]
do
case "$1" in
-e|--eclipse) ECLIPSE=true;;
-c|--clean) CLEAN=true;;
-h|--help) usage;;
--) shift;break;;
esac
shift
done
[ $# -gt 1 ] && usage
BUILD_TYPE="Debug"
[ $# -eq 1 ] && BUILD_TYPE="$1"
if [ -f "/usr/bin/ninja" ] ; then
if $ECLIPSE; then
GENERATOR="Eclipse CDT4 - Ninja"
else
GENERATOR="Ninja"
fi
BUILD_COMMAND="ninja"
else
if $ECLIPSE; then
GENERATOR="Eclipse CDT4 - Unix Makefiles"
else
GENERATOR="Unix Makefiles"
fi
BUILD_COMMAND="make"
fi
echo "Using $BUILD_COMMAND to build"
if $CLEAN; then
rm -rf $BUILDDIR
fi
mkdir -p $BUILDDIR
(
cd $BUILDDIR
cmake "$SOURCEDIR" -G "$GENERATOR" \
-DCMAKE_BUILD_TYPE=$BUILD_TYPE \
-DENABLE_MEMCHECK_OPTION=YES \
-DCMAKE_INSTALL_PREFIX="$SOURCEDIR/../$BRANCHNAME-install"
$BUILD_COMMAND
)
libqtdbustest-0.2+16.04.20160216/CMakeLists.txt 0000644 0000156 0000165 00000003765 12660566015 021370 0 ustar pbuser pbgroup 0000000 0000000 project(libqtdbustest CXX)
cmake_minimum_required(VERSION 2.8.9)
set(API_VERSION 1)
set(ABI_VERSION 1)
set(GETTEXT_PACKAGE libqtdbustest)
set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake" "${CMAKE_MODULE_PATH}")
find_package(PkgConfig REQUIRED)
find_package(Qt5Core REQUIRED)
include_directories(${Qt5Core_INCLUDE_DIRS})
find_package(Qt5DBus COMPONENTS Qt5DBusMacros REQUIRED)
include_directories(${Qt5DBus_INCLUDE_DIRS})
find_package(Qt5Test REQUIRED)
include_directories(${Qt5Test_INCLUDE_DIRS})
set(CMAKE_AUTOMOC ON)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(DATA_DIR "${CMAKE_SOURCE_DIR}/data")
set(SOURCE_DIR "${CMAKE_SOURCE_DIR}/src")
set(SOURCE_BINARY_DIR "${CMAKE_BINARY_DIR}/src")
include_directories(${SOURCE_DIR})
include_directories(${SOURCE_BINARY_DIR})
include(GNUInstallDirs)
include(Coverage)
# Workaround for libexecdir on debian
if (EXISTS "/etc/debian_version")
set(CMAKE_INSTALL_LIBEXECDIR ${CMAKE_INSTALL_LIBDIR})
set(CMAKE_INSTALL_FULL_LIBEXECDIR "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBEXECDIR}")
endif()
set(LOCALE_DIR "${CMAKE_INSTALL_FULL_DATADIR}/locale")
set(DBUS_SYSTEM_CONFIG_FILE "${CMAKE_INSTALL_FULL_DATADIR}/libqtdbustest/system.conf")
set(DBUS_SESSION_CONFIG_FILE "${CMAKE_INSTALL_FULL_DATADIR}/libqtdbustest/session.conf")
set(QTDBUSTEST_WATCHDOG_BIN "${CMAKE_INSTALL_FULL_LIBEXECDIR}/libqtdbustest/watchdog")
add_definitions(
-std=c++11
-fno-permissive
-pedantic
-Wall
-Wextra
)
#set(DOXYFILE_SOURCE_DIR "include")
#set(DOXYFILE_EXTRA_SOURCES "doc")
#include(UseDoxygen)
#if(DOXYGEN_FOUND AND BUILD_DOXYGEN)
# install(
# DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/doc/html
# DESTINATION ${CMAKE_INSTALL_PREFIX}/share/doc/libusermetrics-doc/
# )
#endif()
configure_file(
"${SOURCE_DIR}/libqtdbustest/config.h.in"
"${SOURCE_BINARY_DIR}/libqtdbustest/config.h"
)
#add_subdirectory("po")
add_subdirectory("src")
add_subdirectory("data")
enable_testing()
add_subdirectory(tests)
ADD_CUSTOM_TARGET(
check
${CMAKE_CTEST_COMMAND} --force-new-ctest-process --output-on-failure
)