summaryrefslogtreecommitdiffstats
path: root/tests/auto/corelib/kernel/qsystemsemaphore
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@digia.com>2014-07-09 14:25:26 +0200
committerFriedemann Kleint <Friedemann.Kleint@digia.com>2014-07-10 07:07:30 +0200
commit72024fd50cdead8d890886dba32fd81ac54ff3ae (patch)
tree15a8e2183babb6ba22938622fa1c4300ee054599 /tests/auto/corelib/kernel/qsystemsemaphore
parent745448d3eaa178ff1b7b75bdd577ad31e9177cd6 (diff)
Reduce repetitive invocations of QFINDTESTDATA.
Store the file names in variables instead. Task-number: QTBUG-38890 Change-Id: I65f28bb62674f14aa099e935a9d7a4e9e6e90ba9 Reviewed-by: Joerg Bornemann <joerg.bornemann@digia.com> Reviewed-by: Shawn Rutledge <shawn.rutledge@digia.com>
Diffstat (limited to 'tests/auto/corelib/kernel/qsystemsemaphore')
-rw-r--r--tests/auto/corelib/kernel/qsystemsemaphore/test/tst_qsystemsemaphore.cpp25
1 files changed, 14 insertions, 11 deletions
diff --git a/tests/auto/corelib/kernel/qsystemsemaphore/test/tst_qsystemsemaphore.cpp b/tests/auto/corelib/kernel/qsystemsemaphore/test/tst_qsystemsemaphore.cpp
index 9e33f56a34..42f2709384 100644
--- a/tests/auto/corelib/kernel/qsystemsemaphore/test/tst_qsystemsemaphore.cpp
+++ b/tests/auto/corelib/kernel/qsystemsemaphore/test/tst_qsystemsemaphore.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the test suite of the Qt Toolkit.
@@ -80,17 +80,20 @@ private slots:
#endif // QT_NO_PROCESS
private:
- QString helperBinary();
+ static QString helperBinary();
QSystemSemaphore *existingLock;
+
+ const QString m_helperBinary;
};
tst_QSystemSemaphore::tst_QSystemSemaphore()
+ : m_helperBinary(helperBinary())
{
}
void tst_QSystemSemaphore::initTestCase()
{
- QVERIFY2(!helperBinary().isEmpty(), "Could not find helper binary");
+ QVERIFY2(!m_helperBinary.isEmpty(), "Could not find helper binary");
}
void tst_QSystemSemaphore::init()
@@ -193,12 +196,12 @@ void tst_QSystemSemaphore::basicProcesses()
QProcess release;
release.setProcessChannelMode(QProcess::ForwardedChannels);
- acquire.start(helperBinary(), QStringList("acquire"));
+ acquire.start(m_helperBinary, QStringList("acquire"));
QVERIFY2(acquire.waitForStarted(), "Could not start helper binary");
acquire.waitForFinished(HELPERWAITTIME);
QVERIFY(acquire.state() == QProcess::Running);
acquire.kill();
- release.start(helperBinary(), QStringList("release"));
+ release.start(m_helperBinary, QStringList("release"));
QVERIFY2(release.waitForStarted(), "Could not start helper binary");
acquire.waitForFinished(HELPERWAITTIME);
release.waitForFinished(HELPERWAITTIME);
@@ -227,7 +230,7 @@ void tst_QSystemSemaphore::processes()
QProcess *p = new QProcess;
p->setProcessChannelMode(QProcess::ForwardedChannels);
consumers.append(p);
- p->start(helperBinary(), QStringList(scripts.at(i)));
+ p->start(m_helperBinary, QStringList(scripts.at(i)));
}
while (!consumers.isEmpty()) {
@@ -247,14 +250,14 @@ void tst_QSystemSemaphore::undo()
QStringList acquireArguments = QStringList("acquire");
QProcess acquire;
acquire.setProcessChannelMode(QProcess::ForwardedChannels);
- acquire.start(helperBinary(), acquireArguments);
+ acquire.start(m_helperBinary, acquireArguments);
QVERIFY2(acquire.waitForStarted(), "Could not start helper binary");
acquire.waitForFinished(HELPERWAITTIME);
QVERIFY(acquire.state()== QProcess::NotRunning);
// At process exit the kernel should auto undo
- acquire.start(helperBinary(), acquireArguments);
+ acquire.start(m_helperBinary, acquireArguments);
QVERIFY2(acquire.waitForStarted(), "Could not start helper binary");
acquire.waitForFinished(HELPERWAITTIME);
QVERIFY(acquire.state()== QProcess::NotRunning);
@@ -273,18 +276,18 @@ void tst_QSystemSemaphore::initialValue()
QProcess release;
release.setProcessChannelMode(QProcess::ForwardedChannels);
- acquire.start(helperBinary(), acquireArguments);
+ acquire.start(m_helperBinary, acquireArguments);
QVERIFY2(acquire.waitForStarted(), "Could not start helper binary");
acquire.waitForFinished(HELPERWAITTIME);
QVERIFY(acquire.state()== QProcess::NotRunning);
- acquire.start(helperBinary(), acquireArguments << QLatin1String("2"));
+ acquire.start(m_helperBinary, acquireArguments << QLatin1String("2"));
QVERIFY2(acquire.waitForStarted(), "Could not start helper binary");
acquire.waitForFinished(HELPERWAITTIME);
QVERIFY(acquire.state()== QProcess::Running);
acquire.kill();
- release.start(helperBinary(), releaseArguments);
+ release.start(m_helperBinary, releaseArguments);
QVERIFY2(release.waitForStarted(), "Could not start helper binary");
acquire.waitForFinished(HELPERWAITTIME);
release.waitForFinished(HELPERWAITTIME);