diff options
author | coryan <coryan@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 1997-11-20 20:20:34 +0000 |
---|---|---|
committer | coryan <coryan@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 1997-11-20 20:20:34 +0000 |
commit | ea7f042a1122bb2f6bc402e521a5ccbcb2e40b52 (patch) | |
tree | bf3a7ff1760d18d63e37b2157e5086c7d5085ce6 /tests | |
parent | b5ff88fc51d6b32e419ed512747c85ce765bc128 (diff) | |
download | ATCD-ea7f042a1122bb2f6bc402e521a5ccbcb2e40b52.tar.gz |
ChangeLogTag:Thu Nov 20 14:19:57 1997 Carlos O'Ryan <coryan@macarena.cs.wustl.edu>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/Priority_Reactor_Test.cpp | 36 | ||||
-rw-r--r-- | tests/Priority_Reactor_Test.h | 3 |
2 files changed, 36 insertions, 3 deletions
diff --git a/tests/Priority_Reactor_Test.cpp b/tests/Priority_Reactor_Test.cpp index 659da7fddde..9e2a3692a36 100644 --- a/tests/Priority_Reactor_Test.cpp +++ b/tests/Priority_Reactor_Test.cpp @@ -38,7 +38,7 @@ // The number of children to run, it can be changed using the -c // option. -static int opt_nchildren = 20; +static int opt_nchildren = 10; // The number of loops per children, it can be changed using the -l // option. @@ -48,6 +48,9 @@ static int opt_nloops = 200; // option. static int opt_priority_reactor = 1; +// Maximum time to wait for the test termination (-t) +static int opt_max_duration = 60; + // Maximum number of retries to connect, it can be changed using the // -m option. static int max_retries = 5; @@ -67,6 +70,12 @@ Read_Handler::set_countdown (int nchildren) } int +Read_Handler::get_countdown (void) +{ + return Read_Handler::waiting_; +} + +int Read_Handler::open (void *) { if (this->peer ().enable (ACE_NONBLOCK) == -1) @@ -212,7 +221,7 @@ main (int argc, char *argv[]) { ACE_START_TEST ("Priority_Reactor_Test"); - ACE_Get_Opt getopt (argc, argv, "dc:l:m:", 1); + ACE_Get_Opt getopt (argc, argv, "dc:l:m:t:", 1); for (int c; (c = getopt ()) != -1; ) switch (c) @@ -229,6 +238,18 @@ main (int argc, char *argv[]) case 'm': max_retries = atoi (getopt.optarg); break; + case 't': + opt_max_duration = atoi (getopt.optarg); + break; + case '?': + default: + ACE_ERROR_RETURN ((LM_ERROR, "Usage: Priority_Reactor_Test " + " [-d] (disable priority reactor)\n" + " [-c nchildren] (number of threads/processes)\n" + " [-l loops] (number of loops per child)\n" + " [-m maxretries] (attempts to connect)\n" + " [-t max_time] (limits test duration)\n"), -1); + ACE_NOTREACHED (break); } // Manage memory automagically. @@ -301,9 +322,18 @@ main (int argc, char *argv[]) "(%P|%t) only one thread may be run in a process on this platform\n%a", 1)); #endif /* ACE_HAS_THREADS */ + ACE_Time_Value tv (opt_max_duration); + ACE_Reactor::instance()->register_handler (&acceptor, ACE_Event_Handler::READ_MASK); - ACE_Reactor::instance()->run_event_loop (); + ACE_Reactor::instance()->run_event_loop (tv); + + if (Read_Handler::get_countdown () != 0) + { + ACE_DEBUG ((LM_DEBUG, + "(%P|%t) running out of time, " + "probably due to failed connections.")); + } ACE_DEBUG ((LM_DEBUG, "(%P|%t) waiting for the children...\n")); diff --git a/tests/Priority_Reactor_Test.h b/tests/Priority_Reactor_Test.h index d2b14870036..63878db8c47 100644 --- a/tests/Priority_Reactor_Test.h +++ b/tests/Priority_Reactor_Test.h @@ -40,6 +40,9 @@ public: // Set the number of children or writer threads we will be running, // when they are all gone we terminate the reactor loop. + static int get_countdown (void); + // Get the number of children we are still waiting for. + virtual int open (void *); virtual int handle_input (ACE_HANDLE h); // The Svc_Handler callbacks. |