tst_qsharedmemory: Use qt_test_helper functionality

Change-Id: I70b92b8350822f6d627e5f267188bb7d1d2946d9
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
This commit is contained in:
Oliver Wolff 2018-07-25 09:45:55 +02:00
parent d1493b972b
commit 6be553a2c8
7 changed files with 16 additions and 56 deletions

View File

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

View File

@ -1,6 +1,6 @@
TEMPLATE = subdirs
qtConfig(sharedmemory) {
!winrt: SUBDIRS = sharedmemoryhelper
SUBDIRS += test
!winrt: SUBDIRS = producerconsumer
SUBDIRS += 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,8 @@
CONFIG += testcase
QT = core-private testlib
TARGET = tst_qsharedmemory
SOURCES += tst_qsharedmemory.cpp
linux: LIBS += -lrt

View File

@ -1,18 +0,0 @@
CONFIG += testcase
QT = core-private testlib
linux:LIBS += -lrt
SOURCES += tst_qsharedmemory.cpp
TARGET = tst_qsharedmemory
CONFIG(debug_and_release) {
CONFIG(debug, debug|release) {
DESTDIR = ../debug
} else {
DESTDIR = ../release
}
} else {
DESTDIR = ..
}

View File

@ -51,7 +51,6 @@ public:
public Q_SLOTS:
void init();
void initTestCase();
void cleanup();
@ -101,7 +100,6 @@ private slots:
void uniqueKey();
protected:
static QString helperBinary();
int remove(const QString &key);
QString rememberKey(const QString &key)
@ -125,7 +123,7 @@ private:
tst_QSharedMemory::tst_QSharedMemory()
: existingSharedMemory(0)
, m_helperBinary(tst_QSharedMemory::helperBinary())
, m_helperBinary("producerconsumer_helper")
{
}
@ -133,13 +131,6 @@ tst_QSharedMemory::~tst_QSharedMemory()
{
}
void tst_QSharedMemory::initTestCase()
{
#if QT_CONFIG(process)
QVERIFY2(!m_helperBinary.isEmpty(), "Could not find helper binary");
#endif
}
void tst_QSharedMemory::init()
{
existingSharedMemory = new QSharedMemory(EXISTING_SHARE);
@ -179,15 +170,6 @@ void tst_QSharedMemory::cleanup()
#include <errno.h>
#endif
QString tst_QSharedMemory::helperBinary()
{
QString binary = QStringLiteral("helperbinary");
#ifdef Q_OS_WIN
binary += QStringLiteral(".exe");
#endif
return QFINDTESTDATA(binary);
}
int tst_QSharedMemory::remove(const QString &key)
{
#ifdef Q_OS_WIN