summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorlevine <levine@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1999-07-22 16:56:39 +0000
committerlevine <levine@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1999-07-22 16:56:39 +0000
commit825c36b1895c95d0eca963f5766e23cf8d8b4055 (patch)
tree5609ac74a64ad169fd058c2265cfaf1e0446aa0b
parent2c82096231c3f1b285a6cec5ae6c8632a541d10a (diff)
downloadATCD-825c36b1895c95d0eca963f5766e23cf8d8b4055.tar.gz
ChangeLogTag: Thu Jul 22 11:54:58 1999 David L. Levine <levine@cs.wustl.edu>
-rw-r--r--ChangeLog-99b7
-rw-r--r--tests/SV_Shared_Memory_Test.cpp34
2 files changed, 30 insertions, 11 deletions
diff --git a/ChangeLog-99b b/ChangeLog-99b
index 8cab86a4c52..b49820ca7ec 100644
--- a/ChangeLog-99b
+++ b/ChangeLog-99b
@@ -1,3 +1,10 @@
+Thu Jul 22 11:54:58 1999 David L. Levine <levine@cs.wustl.edu>
+
+ * tests/SV_Shared_Memory_Test.cpp (child): added a one
+ second sleep to give the parent a chance to create the
+ semaphore. This allows the test to succeed on LynxOS/PPC
+ (with fork ()).
+
Thu Jul 22 10:42:06 1999 Clarence M. Weaver <clarence_m_weaver@md.northgrum.com>
* ACE-INSTALL.html: added steps for running the ACE tests
diff --git a/tests/SV_Shared_Memory_Test.cpp b/tests/SV_Shared_Memory_Test.cpp
index c612e868b6f..f63a6a3766f 100644
--- a/tests/SV_Shared_Memory_Test.cpp
+++ b/tests/SV_Shared_Memory_Test.cpp
@@ -37,7 +37,8 @@ static
ACE_Malloc<ACE_SHARED_MEMORY_POOL, ACE_SV_Semaphore_Simple> &
myallocator ()
{
- static ACE_Malloc<ACE_SHARED_MEMORY_POOL, ACE_SV_Semaphore_Simple> myallocator;
+ static ACE_Malloc<ACE_SHARED_MEMORY_POOL,
+ ACE_SV_Semaphore_Simple> myallocator;
return myallocator;
}
@@ -55,35 +56,43 @@ parent (char *shm)
// This semaphore is initially created with a count of 0, i.e., it
// is "locked."
ACE_ASSERT (mutex.open (SEM_KEY_1,
- ACE_SV_Semaphore_Complex::ACE_CREATE, 0) != -1);
+ ACE_SV_Semaphore_Complex::ACE_CREATE, 0) != -1);
ACE_SV_Semaphore_Complex synch;
// This semaphore is initially created with a count of 0, i.e., it
// is "locked."
ACE_ASSERT (synch.open (SEM_KEY_2,
- ACE_SV_Semaphore_Complex::ACE_CREATE, 0) != -1);
+ ACE_SV_Semaphore_Complex::ACE_CREATE, 0) != -1);
// This for loop executes in a critical section proteced by <mutex>.
for (int i = 0; i < SHMSZ; i++)
shm[i] = SHMDATA[i];
if (mutex.release () == -1)
- ACE_ERROR ((LM_ERROR, ASYS_TEXT ("(%P) %p"), ASYS_TEXT ("parent mutex.release")));
+ ACE_ERROR ((LM_ERROR, ASYS_TEXT ("(%P) %p"),
+ ASYS_TEXT ("parent mutex.release")));
else if (synch.acquire () == -1)
- ACE_ERROR ((LM_ERROR, ASYS_TEXT ("(%P) %p"), ASYS_TEXT ("parent synch.acquire")));
+ ACE_ERROR ((LM_ERROR, ASYS_TEXT ("(%P) %p"),
+ ASYS_TEXT ("parent synch.acquire")));
if (myallocator ().remove () == -1)
- ACE_ERROR ((LM_ERROR, ASYS_TEXT ("(%P) %p\n"), ASYS_TEXT ("parent allocator.remove")));
+ ACE_ERROR ((LM_ERROR, ASYS_TEXT ("(%P) %p\n"),
+ ASYS_TEXT ("parent allocator.remove")));
if (mutex.remove () == -1)
- ACE_ERROR ((LM_ERROR, ASYS_TEXT ("(%P) %p\n"), ASYS_TEXT ("parent mutex.remove")));
+ ACE_ERROR ((LM_ERROR, ASYS_TEXT ("(%P) %p\n"),
+ ASYS_TEXT ("parent mutex.remove")));
if (synch.remove () == -1)
- ACE_ERROR ((LM_ERROR, ASYS_TEXT ("(%P) %p\n"), ASYS_TEXT ("parent synch.remove")));
+ ACE_ERROR ((LM_ERROR, ASYS_TEXT ("(%P) %p\n"),
+ ASYS_TEXT ("parent synch.remove")));
return 0;
}
static int
child (char *shm)
{
+ // Give the parent a chance to create the semaphore.
+ ACE_OS::sleep (1);
+
ACE_SV_Semaphore_Complex mutex;
// This semaphore is initially created with a count of 0, i.e., it
// is "locked."
@@ -104,7 +113,8 @@ child (char *shm)
if (errno == EAGAIN)
ACE_DEBUG ((LM_DEBUG, ASYS_TEXT ("(%P) spinning in child!\n")));
else
- ACE_ERROR_RETURN ((LM_ERROR, ASYS_TEXT ("(%P) child mutex.tryacquire")), 1);
+ ACE_ERROR_RETURN ((LM_ERROR,
+ ASYS_TEXT ("(%P) child mutex.tryacquire")), 1);
for (int i = 0; i < SHMSZ; i++)
ACE_ASSERT (SHMDATA[i] == shm[i]);
@@ -131,7 +141,8 @@ main (int, ASYS_TCHAR *[])
{
ACE_START_TEST (ASYS_TEXT ("SV_Shared_Memory_Test"));
-#if defined (ACE_HAS_SYSV_IPC) && !defined (ACE_LACKS_FORK) && !defined(ACE_LACKS_SYSV_SHMEM)
+#if defined (ACE_HAS_SYSV_IPC) && !defined (ACE_LACKS_FORK) && \
+ !defined(ACE_LACKS_SYSV_SHMEM)
char *shm = (char *) myallocator ().malloc (27);
switch (ACE_OS::fork ("SV_Shared_Memory_Test.cpp"))
@@ -148,7 +159,8 @@ main (int, ASYS_TCHAR *[])
}
#else
ACE_ERROR ((LM_INFO,
- ASYS_TEXT ("SYSV IPC, SYSV SHMEM, or fork are not supported on this platform\n")));
+ ASYS_TEXT ("SYSV IPC, SYSV SHMEM, or fork ")
+ ASYS_TEXT ("are not supported on this platform\n")));
#endif /* ACE_HAS_SYSV_IPC */
ACE_END_TEST;
return 0;