qt5base-lts/tests/auto
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
..
bic/data tst_bic: Add bic data for QtConcurrent and QtPrintSupport 2013-01-14 09:18:43 +01:00
cmake Generate instances of types in the CMake tests. 2012-10-31 07:16:03 +01:00
compilerwarnings/data Change copyrights from Nokia to Digia 2012-09-22 19:20:11 +02:00
concurrent Tests: Remove declaration of built-in and automatic metatypes. 2013-01-06 11:23:45 +01:00
corelib Resolve some race conditions on tst_QSharedMemory 2013-01-14 11:35:17 +01:00
dbus DBus: Remove declaration of built-in and automatic metatypes. 2013-01-04 13:20:06 +01:00
gui Gui: Remove declaration of built-in and automatic metatypes. 2013-01-04 18:39:08 +01:00
guiapplauncher Update the documentation after moving examples. 2011-07-05 21:19:08 +02:00
network Fix incorrectly disabled autotest 2013-01-11 14:01:10 +01:00
opengl add and use qtHaveModule() function 2012-12-21 19:05:02 +01:00
other Tests: Remove declaration of built-in and automatic metatypes. 2013-01-06 11:23:45 +01:00
printsupport Tests: Remove declaration of built-in and automatic metatypes. 2013-01-06 11:23:45 +01:00
shared Auto tests: add PlatformClipboard::isAvailable() 2012-09-27 06:07:13 +02:00
sql Tests: Remove declaration of built-in and automatic metatypes. 2013-01-06 11:23:45 +01:00
testlib Tests: Remove declaration of built-in and automatic metatypes. 2013-01-06 11:23:45 +01:00
tools add and use qtHaveModule() function 2012-12-21 19:05:02 +01:00
widgets Enable tst_qwidgetsvariant test 2013-01-11 12:02:21 +01:00
xml Tests: Remove declaration of built-in and automatic metatypes. 2013-01-06 11:23:45 +01:00
auto.pro add and use qtHaveModule() function 2012-12-21 19:05:02 +01:00
network-settings.h Change copyrights from Nokia to Digia 2012-09-22 19:20:11 +02:00
qtest-config.h Auto tests: revise cursor dependant tests 2012-10-13 05:51:19 +02:00
test.pl Change copyrights from Nokia to Digia 2012-09-22 19:20:11 +02:00