summaryrefslogtreecommitdiffstats
path: root/tests/auto/corelib/io
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/corelib/io')
-rw-r--r--tests/auto/corelib/io/qlockfile/qlockfiletesthelper/qlockfile_test_helper.cpp10
-rw-r--r--tests/auto/corelib/io/qlockfile/tst_qlockfile.cpp6
2 files changed, 11 insertions, 5 deletions
diff --git a/tests/auto/corelib/io/qlockfile/qlockfiletesthelper/qlockfile_test_helper.cpp b/tests/auto/corelib/io/qlockfile/qlockfiletesthelper/qlockfile_test_helper.cpp
index f10c2a7c98..e086bf1904 100644
--- a/tests/auto/corelib/io/qlockfile/qlockfiletesthelper/qlockfile_test_helper.cpp
+++ b/tests/auto/corelib/io/qlockfile/qlockfiletesthelper/qlockfile_test_helper.cpp
@@ -31,6 +31,12 @@
#include <QLockFile>
#include <QThread>
+#ifdef Q_OS_UNIX
+# include <unistd.h>
+#else
+# include <stdlib.h>
+#endif
+
int main(int argc, char *argv[])
{
QCoreApplication app(argc, argv);
@@ -44,11 +50,11 @@ int main(int argc, char *argv[])
if (argc > 2)
option = QString::fromLocal8Bit(argv[2]);
- if (option == "-crash") {
+ if (option == "-uncleanexit") {
QLockFile lockFile(lockName);
lockFile.lock();
// exit on purpose, so that the lock remains!
- exit(0);
+ _exit(0);
} else if (option == "-busy") {
QLockFile lockFile(lockName);
lockFile.lock();
diff --git a/tests/auto/corelib/io/qlockfile/tst_qlockfile.cpp b/tests/auto/corelib/io/qlockfile/tst_qlockfile.cpp
index d2f345feb5..835c4a2778 100644
--- a/tests/auto/corelib/io/qlockfile/tst_qlockfile.cpp
+++ b/tests/auto/corelib/io/qlockfile/tst_qlockfile.cpp
@@ -262,7 +262,7 @@ void tst_QLockFile::staleLockFromCrashedProcess()
QFETCH(int, staleLockTime);
const QString fileName = dir.path() + "/staleLockFromCrashedProcess";
- int ret = QProcess::execute(m_helperApp, QStringList() << fileName << "-crash");
+ int ret = QProcess::execute(m_helperApp, QStringList() << fileName << "-uncleanexit");
QCOMPARE(ret, int(QLockFile::NoError));
QTRY_VERIFY(QFile::exists(fileName));
@@ -288,7 +288,7 @@ void tst_QLockFile::staleLockFromCrashedProcessReusedPid()
#else
const QString fileName = dir.path() + "/staleLockFromCrashedProcessReusedPid";
- int ret = QProcess::execute(m_helperApp, QStringList() << fileName << "-crash");
+ int ret = QProcess::execute(m_helperApp, QStringList() << fileName << "-uncleanexit");
QCOMPARE(ret, int(QLockFile::NoError));
QVERIFY(QFile::exists(fileName));
QVERIFY(overwritePidInLockFile(fileName, QCoreApplication::applicationPid()));
@@ -397,7 +397,7 @@ void tst_QLockFile::staleLockRace()
// Only one thread should delete it, otherwise a race will ensue
const QString fileName = dir.path() + "/sharedFile";
const QString lockName = fileName + ".lock";
- int ret = QProcess::execute(m_helperApp, QStringList() << lockName << "-crash");
+ int ret = QProcess::execute(m_helperApp, QStringList() << lockName << "-uncleanexit");
QCOMPARE(ret, int(QLockFile::NoError));
QTRY_VERIFY(QFile::exists(lockName));