Merge pull request #1844 from jrw972/monterey
[ACE_TAO.git] / ACE / tests / Bug_3974_Regression_Test.cpp
blobfe87c1b4258377089137c66a3479c7c7332e88c6
1 /**
2 * @file Bug_3974_Regression_Test.cpp
4 * Reproduces the problems reported in bug 3974
5 * http://bugzilla.dre.vanderbilt.edu/show_bug.cgi?id=3974
6 */
8 #include "test_config.h"
10 #include "ace/Dev_Poll_Reactor.h"
11 #include "ace/Select_Reactor.h"
12 #include "ace/TP_Reactor.h"
13 #include "ace/WFMO_Reactor.h"
14 #include "ace/OS_NS_errno.h"
16 bool
17 testit (ACE_Reactor_Impl *ri)
19 int ret = 0;
20 ACE_Reactor r (ri);
21 ACE_Time_Value one (1);
22 r.end_reactor_event_loop ();
23 if ((ret = r.handle_events (one)) != -1)
25 ACE_ERROR ((LM_ERROR, ACE_TEXT ("Return value %d should be -1\n"), ret));
26 return false;
28 if (errno != ESHUTDOWN)
30 ACE_ERROR ((LM_ERROR,
31 ACE_TEXT ("errno %d should be %d (ESHUTDOWN)\n"),
32 errno, ESHUTDOWN));
33 return false;
36 return true;
39 // Main function.
41 int
42 run_main (int, ACE_TCHAR *[])
44 ACE_START_TEST (ACE_TEXT ("Bug_3974_Regression_Test"));
45 int result = 0;
47 ACE_Select_Reactor r1;
48 if (!testit (&r1))
50 ACE_ERROR ((LM_ERROR, ACE_TEXT ("Select_Reactor failed\n")));
51 result = 1;
54 ACE_TP_Reactor r2;
55 if (!testit (&r2))
57 ACE_ERROR ((LM_ERROR, ACE_TEXT ("TP_Reactor failed\n")));
58 result = 1;
61 #ifdef ACE_WIN32
62 ACE_WFMO_Reactor r3;
63 if (!testit (&r3))
65 ACE_ERROR ((LM_ERROR, ACE_TEXT ("WFMO_Reactor failed\n")));
66 result = 1;
68 #endif /* ACE_WIN32 */
70 #if defined (ACE_HAS_EVENT_POLL) || defined (ACE_HAS_DEV_POLL)
71 ACE_Dev_Poll_Reactor r4;
72 if (!testit (&r4))
74 ACE_ERROR ((LM_ERROR, ACE_TEXT ("Dev_Poll_Reactor failed\n")));
75 result = 1;
77 #endif /* ACE_HAS_EVENT_POLL || ACE_HAS_DEV_POLL */
79 ACE_END_TEST;
80 return result;