diff options
Diffstat (limited to 'tests')
3 files changed, 21 insertions, 8 deletions
diff --git a/tests/auto/corelib/kernel/qsharedmemory/test/test.pro b/tests/auto/corelib/kernel/qsharedmemory/test/test.pro index 97ba1153df..fabd2cf7a3 100644 --- a/tests/auto/corelib/kernel/qsharedmemory/test/test.pro +++ b/tests/auto/corelib/kernel/qsharedmemory/test/test.pro @@ -3,6 +3,7 @@ CONFIG += testcase QT = core-private testlib mac:CONFIG -= app_bundle +linux:LIBS += -lrt SOURCES += tst_qsharedmemory.cpp TARGET = tst_qsharedmemory diff --git a/tests/auto/corelib/kernel/qsharedmemory/test/tst_qsharedmemory.cpp b/tests/auto/corelib/kernel/qsharedmemory/test/tst_qsharedmemory.cpp index 7182428f14..bebc23172b 100644 --- a/tests/auto/corelib/kernel/qsharedmemory/test/tst_qsharedmemory.cpp +++ b/tests/auto/corelib/kernel/qsharedmemory/test/tst_qsharedmemory.cpp @@ -174,7 +174,11 @@ void tst_QSharedMemory::cleanup() #include <private/qsharedmemory_p.h> #include <sys/types.h> #include <sys/ipc.h> +#ifndef QT_POSIX_IPC #include <sys/shm.h> +#else +#include <sys/mman.h> +#endif // QT_POSIX_IPC #include <errno.h> #endif @@ -189,7 +193,10 @@ QString tst_QSharedMemory::helperBinary() int tst_QSharedMemory::remove(const QString &key) { -#ifndef Q_OS_WIN +#ifdef Q_OS_WIN + Q_UNUSED(key); + return 0; +#else // On unix the shared memory might exists from a previously failed test // or segfault, remove it it does if (key.isEmpty()) @@ -202,6 +209,7 @@ int tst_QSharedMemory::remove(const QString &key) return -2; } +#ifndef QT_POSIX_IPC int unix_key = ftok(fileName.toLatin1().constData(), 'Q'); if (-1 == unix_key) { qDebug() << "ftok failed"; @@ -219,11 +227,15 @@ int tst_QSharedMemory::remove(const QString &key) qDebug() << "shmctl failed"; return -5; } - return QFile::remove(fileName); #else - Q_UNUSED(key); - return 0; -#endif + if (shm_unlink(QFile::encodeName(fileName).constData()) == -1) { + qDebug() << "shm_unlink failed"; + return -5; + } +#endif // QT_POSIX_IPC + + return QFile::remove(fileName); +#endif // Q_OS_WIN } /*! diff --git a/tests/auto/corelib/kernel/qsystemsemaphore/test/tst_qsystemsemaphore.cpp b/tests/auto/corelib/kernel/qsystemsemaphore/test/tst_qsystemsemaphore.cpp index 8195efed99..30deb6ff57 100644 --- a/tests/auto/corelib/kernel/qsystemsemaphore/test/tst_qsystemsemaphore.cpp +++ b/tests/auto/corelib/kernel/qsystemsemaphore/test/tst_qsystemsemaphore.cpp @@ -65,7 +65,7 @@ private slots: void processes_data(); void processes(); -#ifndef Q_OS_WIN +#if !defined(Q_OS_WIN) && !defined(QT_POSIX_IPC) void undo(); #endif void initialValue(); @@ -233,8 +233,8 @@ void tst_QSystemSemaphore::processes() } } -// This test only checks a unix behavior. -#ifndef Q_OS_WIN +// This test only checks a system v unix behavior. +#if !defined(Q_OS_WIN) && !defined(QT_POSIX_IPC) void tst_QSystemSemaphore::undo() { QSystemSemaphore sem("store", 1, QSystemSemaphore::Create); |