summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorlevine <levine@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1998-10-26 17:08:01 +0000
committerlevine <levine@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1998-10-26 17:08:01 +0000
commitc70afade27904767cccc4aa6c616341ba9b7158c (patch)
tree4920ff65fd059c7efa1f2ed118daf6a6c7d7ac15
parent89de8ebb1c01b79508a3a198886d1df75d33f902 (diff)
downloadATCD-c70afade27904767cccc4aa6c616341ba9b7158c.tar.gz
don't try to run if ACE_LACKS_FORK
-rw-r--r--tests/Pipe_Test.cpp37
-rw-r--r--tests/Process_Mutex_Test.cpp7
2 files changed, 29 insertions, 15 deletions
diff --git a/tests/Pipe_Test.cpp b/tests/Pipe_Test.cpp
index a8214a09489..8de9809fa02 100644
--- a/tests/Pipe_Test.cpp
+++ b/tests/Pipe_Test.cpp
@@ -4,7 +4,7 @@
//
// = LIBRARY
// tests
-//
+//
// = FILENAME
// Pipe_Test.cpp
//
@@ -13,7 +13,7 @@
//
// = AUTHOR
// Irfan Pyarali
-//
+//
// ============================================================================
#include "test_config.h"
@@ -33,10 +33,10 @@ static int child_process = 0;
static int iterations = ACE_MAX_ITERATIONS;
// Explain usage and exit.
-static void
+static void
print_usage_and_die (void)
{
- ACE_DEBUG ((LM_DEBUG,
+ ACE_DEBUG ((LM_DEBUG,
"usage: %n [-d (don't close pipes)] [-c (child process)] [-i (iterations)] \n"));
ACE_OS::exit (1);
}
@@ -47,7 +47,7 @@ parse_args (int argc, char *argv[])
{
ACE_Get_Opt get_opt (argc, argv, "dci:");
- int c;
+ int c;
while ((c = get_opt ()) != -1)
switch (c)
@@ -68,7 +68,7 @@ parse_args (int argc, char *argv[])
}
static void
-open (ACE_Pipe &pipe,
+open (ACE_Pipe &pipe,
const char *name)
{
ACE_DEBUG ((LM_DEBUG, "opening %s\n", name));
@@ -80,49 +80,56 @@ open (ACE_Pipe &pipe,
pipe.close ();
}
-int
+int
main (int argc, char *argv[])
{
+#if defined (ACE_LACKS_FORK)
+ ACE_START_TEST ("Pipe_Test");
+ ACE_ERROR ((LM_ERROR, "fork is not supported on this platform\n"));
+ ACE_END_TEST;
+#else /* ! ACE_LACKS_FORK */
parse_args (argc, argv);
if (child_process)
- {
- ACE_APPEND_LOG ("Pipe_Test-children");
+ {
+ ACE_APPEND_LOG ("Pipe_Test-children");
ACE_Pipe a, b, c, d, e;
-
+
open (a, "a");
open (b, "b");
open (c, "c");
open (d, "d");
open (e, "e");
- ACE_END_LOG;
+ ACE_END_LOG;
}
else
{
ACE_START_TEST ("Pipe_Test");
- ACE_INIT_LOG ("Pipe_Test-children");
+ ACE_INIT_LOG ("Pipe_Test-children");
ACE_Process_Options options;
if (close_pipe == 0)
options.command_line (ACE_TEXT ("Pipe_Test") ACE_PLATFORM_EXE_SUFFIX ACE_TEXT (" -c -d"));
else
options.command_line (ACE_TEXT ("Pipe_Test") ACE_PLATFORM_EXE_SUFFIX ACE_TEXT (" -c"));
-
+
for (int i = 0; i < ::iterations; i++)
{
ACE_Process server;
ACE_ASSERT (server.spawn (options) != -1);
- ACE_DEBUG ((LM_DEBUG, "Server forked with pid = %d.\n", server.getpid ()));
+ ACE_DEBUG ((LM_DEBUG, "Server forked with pid = %d.\n",
+ server.getpid ()));
// Wait for the process we just created to exit.
server.wait ();
ACE_DEBUG ((LM_DEBUG, "Server %d finished\n", server.getpid ()));
}
- ACE_END_TEST;
+ ACE_END_TEST;
}
+#endif /* ! ACE_LACKS_FORK */
return 0;
}
diff --git a/tests/Process_Mutex_Test.cpp b/tests/Process_Mutex_Test.cpp
index 3b497532af1..21c06793c04 100644
--- a/tests/Process_Mutex_Test.cpp
+++ b/tests/Process_Mutex_Test.cpp
@@ -90,6 +90,12 @@ acquire_release (void)
int
main (int argc, char *argv[])
{
+#if defined (ACE_LACKS_FORK)
+ ACE_START_TEST ("Process_Mutex_Test");
+ ACE_ERROR ((LM_ERROR, "fork is not supported on this platform\n"));
+ ACE_END_TEST;
+#else /* ! ACE_LACKS_FORK */
+
parse_args (argc, argv);
// Child process code
@@ -138,6 +144,7 @@ main (int argc, char *argv[])
ACE_END_TEST;
}
+#endif /* ! ACE_LACKS_FORK */
return 0;
}