tst_qsystemsemaphore: Use qt_test_helper functionality

Change-Id: I18a5d2d496e1442470423e0f05062cc2ae76a4e4
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
This commit is contained in:
Oliver Wolff 2018-07-25 10:00:07 +02:00
parent 8860c26260
commit 3ed22c5efe
7 changed files with 14 additions and 51 deletions

View File

@ -0,0 +1,5 @@
QT = core testlib
SOURCES += main.cpp
load(qt_test_helper)

View File

@ -1,3 +1,3 @@
TEMPLATE = subdirs
SUBDIRS = systemsemaphorehelper test
SUBDIRS = acquirerelease test.pro

View File

@ -1,17 +0,0 @@
QT = core testlib
win32: CONFIG += console
mac:CONFIG -= app_bundle
SOURCES += main.cpp
TARGET = helperbinary
CONFIG(debug_and_release) {
CONFIG(debug, debug|release) {
DESTDIR = ../debug
} else {
DESTDIR = ../release
}
} else {
DESTDIR = ..
}

View File

@ -0,0 +1,7 @@
CONFIG += testcase
QT = core testlib
SOURCES += tst_qsystemsemaphore.cpp
TARGET = tst_qsystemsemaphore
win32: CONFIG += console

View File

@ -1,17 +0,0 @@
CONFIG += testcase
QT = core testlib
win32: CONFIG += console
SOURCES += tst_qsystemsemaphore.cpp
TARGET = tst_qsystemsemaphore
CONFIG(debug_and_release) {
CONFIG(debug, debug|release) {
DESTDIR = ../debug
} else {
DESTDIR = ../release
}
} else {
DESTDIR = ..
}

View File

@ -42,7 +42,6 @@ public:
tst_QSystemSemaphore();
public Q_SLOTS:
void initTestCase();
void init();
void cleanup();
@ -65,22 +64,16 @@ private slots:
void initialValue();
private:
static QString helperBinary();
QSystemSemaphore *existingLock;
const QString m_helperBinary;
};
tst_QSystemSemaphore::tst_QSystemSemaphore()
: m_helperBinary(helperBinary())
: m_helperBinary("acquirerelease_helper")
{
}
void tst_QSystemSemaphore::initTestCase()
{
QVERIFY2(!m_helperBinary.isEmpty(), "Could not find helper binary");
}
void tst_QSystemSemaphore::init()
{
existingLock = new QSystemSemaphore(EXISTING_SHARE, 1, QSystemSemaphore::Create);
@ -294,14 +287,6 @@ void tst_QSystemSemaphore::initialValue()
#endif
}
QString tst_QSystemSemaphore::helperBinary()
{
QString binary = QStringLiteral("helperbinary");
#ifdef Q_OS_WIN
binary += QStringLiteral(".exe");
#endif
return QFINDTESTDATA(binary);
}
QTEST_MAIN(tst_QSystemSemaphore)
#include "tst_qsystemsemaphore.moc"