qt6-bb10/tests/auto/corelib/kernel
Thiago Macieira 60fc88a09c Resolve some race conditions on tst_QSharedMemory
This test runs fine almost all of the time on systems with 1
processor, which were the norm when the test was written and are still
the way that the Qt Continuous Integration system works as of
today. But it falls flatly on multi-processor systems.

The root of the problem is that QSystemSemaphore recreates the
semaphore if it disappears underneath it. However, the recreation
process is not thread-safe at all: if two threads race to recreate it,
weird things might happen. strace on Linux shows that a thread got
stuck trying to acquire the semaphore:

  <... nanosleep resumed> NULL) = 0
  stat("/tmp/qipc_systemsem_market5c9f73af73334ffe350c60ec076e5744db0ecda3", {st_mode=S_IFREG|0640, st_size=0, ...}) = 0
  stat("/tmp/qipc_systemsem_market5c9f73af73334ffe350c60ec076e5744db0ecda3", {st_mode=S_IFREG|0640, st_size=0, ...}) = 0
  semget(0x51001388, 1, IPC_CREAT|IPC_EXCL|0600) = -1 EEXIST (File exists)
  semget(0x51001388, 1, IPC_CREAT|0600) = 114786308
  semop(114786308, {{0, -1, SEM_UNDO}}, 1 <unfinished ...>

This problem does not happen if the creation and destruction of the
QSharedMemory (which uses QSystemSemaphore) does not race with other
threads or processes attaching and detaching. For the threads test
it's easy. For the processes, we use stdin and stdout as a
communication channel.

Change-Id: Ie11b135431d4abfc59234654848b67f622eb03c9
Reviewed-by: Richard J. Moore <rich@kde.org>
2013-01-14 11:35:17 +01:00
..
qcoreapplication Test: remove QSKIP in tst_QCoreApplication::argc 2012-10-16 15:29:15 +02:00
qeventdispatcher Change copyrights from Nokia to Digia 2012-09-22 19:20:11 +02:00
qeventloop Core: Remove declaration of built-in and automatic metatypes. 2013-01-04 18:39:05 +01:00
qmath Change copyrights from Nokia to Digia 2012-09-22 19:20:11 +02:00
qmetamethod Core/kernel: Make some signals private. 2012-10-25 15:56:14 +02:00
qmetaobject Change copyrights from Nokia to Digia 2012-09-22 19:20:11 +02:00
qmetaobjectbuilder Change copyrights from Nokia to Digia 2012-09-22 19:20:11 +02:00
qmetaproperty tst_QMetaProperty doesn't need QtGui 2012-11-22 14:54:31 +01:00
qmetatype Remove MSVC2012-optimization for the QMetaType-test. 2012-12-14 15:06:22 +01:00
qmimedata Change copyrights from Nokia to Digia 2012-09-22 19:20:11 +02:00
qobject Delete the QSlotObject when disconnect()ing 2012-12-17 19:50:33 +01:00
qpointer add and use qtHaveModule() function 2012-12-21 19:05:02 +01:00
qsharedmemory Resolve some race conditions on tst_QSharedMemory 2013-01-14 11:35:17 +01:00
qsignalmapper normalise signal/slot signatures [QtCore tests] 2012-10-22 03:21:01 +02:00
qsocketnotifier Test: remove QSKIP from tst_QSocketNotifier::posixSockets 2012-10-16 20:43:37 +02:00
qsystemsemaphore Fixed QSystemSemaphore autotest for "check" target 2012-11-07 14:19:00 +01:00
qtimer Change copyrights from Nokia to Digia 2012-09-22 19:20:11 +02:00
qtranslator Change copyrights from Nokia to Digia 2012-09-22 19:20:11 +02:00
qvariant Fix QVariant streaming in Qt3 compatibility mode. 2012-11-24 14:55:30 +01:00
qwineventnotifier Change copyrights from Nokia to Digia 2012-09-22 19:20:11 +02:00
kernel.pro Enabled QSystemSemaphore autotest 2012-11-08 08:26:19 +01:00