1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
|
// $Id$
// ============================================================================
//
// = LIBRARY
// TAO/tests/Cubit/TAO/IDL_Cubit
//
// = FILENAME
// IDL_Cubit_Test.cpp
//
// = DESCRIPTION
// This example tests the IDL Cubit server and client
// components. The test forks and execs two processes to run both
// the cubit client and the cubit server. The client makes calls on
// the cubit server object and shutdowns the server in the end.
// No command line arguments are needed to run the test.
//
// = AUTHOR
// Nagarajan Surendran (naga@cs.wustl.edu)
//
// ============================================================================
#include "tests/test_config.h"
#include "ace/Process.h"
int
main (int, char *[])
{
ACE_START_TEST ("IDL_Cubit_Test:");
ACE_Process_Options server_options;
server_options.command_line ("./server -ORBport 0 -ORBobjrefstyle url");
ACE_Process server;
if (server.spawn (server_options) == -1)
ACE_ERROR_RETURN ((LM_DEBUG,
"%n %p.\n",
"Server fork failed"),
0);
else
ACE_DEBUG ((LM_DEBUG,
"Server forked with pid = %d.\n",
server.getpid ()));
ACE_OS::sleep (5);
// create a client that will shutdown the server after the tests.
ACE_Process_Options client_options;
client_options.command_line ("./client -ORBport 0 -ORBobjrefstyle url -x");
ACE_Process client;
if (client.spawn (client_options) == -1)
ACE_ERROR_RETURN ((LM_DEBUG,
"%p.\n",
"Client spawn failed"),
0);
else
ACE_DEBUG ((LM_DEBUG,
"Client forked with pid = %d.\n",
client.getpid ()));
if (server.wait () < 0)
ACE_DEBUG ((LM_DEBUG,"(%P|%t) Wait on server failed\n"));
if (client.wait () < 0)
ACE_DEBUG ((LM_DEBUG,"(%P|%t) Wait on client failed\n"));
ACE_END_TEST;
return 0;
}
|