Revert "Use a variable on the stack to not have a temporary in the call"
[ACE_TAO.git] / TAO / orbsvcs / examples / Notify / Subscribe / run_test.pl
blob499b6f1efb226cc769173c3c09ce0477b6d8ad8c
1 eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}'
2 & eval 'exec perl -S $0 $argv:q'
3 if 0;
5 # -*- perl -*-
7 use lib "$ENV{ACE_ROOT}/bin";
8 use PerlACE::TestTarget;
10 $status = 0;
11 $debug_level = '0';
13 foreach $i (@ARGV) {
14 if ($i eq '-debug') {
15 $debug_level = '10';
19 my $ns = PerlACE::TestTarget::create_target (1) || die "Create target 1 failed\n";
20 my $nfs = PerlACE::TestTarget::create_target (2) || die "Create target 2 failed\n";
21 my $sub = PerlACE::TestTarget::create_target (3) || die "Create target 3 failed\n";
23 $experiment_timeout = 60;
24 $startup_timeout = 60;
26 $nsiorfile = "naming.ior";
27 $nfsiorfile = "notify.ior";
29 my $ns_nsiorfile = $ns->LocalFile ($nsiorfile);
30 my $nfs_nsiorfile = $nfs->LocalFile ($nsiorfile);
31 my $sub_nsiorfile = $sub->LocalFile ($nsiorfile);
32 my $nfs_nfsiorfile = $nfs->LocalFile ($nfsiorfile);
33 $ns->DeleteFile ($nsiorfile);
34 $nfs->DeleteFile ($nsiorfile);
35 $sub->DeleteFile ($nsiorfile);
36 $nfs->DeleteFile ($nfsiorfile);
38 $NS = $ns->CreateProcess ("$ENV{TAO_ROOT}/orbsvcs/Naming_Service/tao_cosnaming",
39 " -o $ns_nsiorfile");
41 $NFS = $nfs->CreateProcess ("$ENV{TAO_ROOT}/orbsvcs/Notify_Service/tao_cosnotification");
42 $Notify_Args = "-ORBInitRef NameService=file://$nfs_nsiorfile -IORoutput $nfs_nfsiorfile ";
44 $SUB = $sub->CreateProcess ("Subscribe");
45 $Subscribe_Args = "-ORBInitRef NameService=file://$sub_nsiorfile -ORBDebugLevel $debug_level";
47 $NS_status = $NS->Spawn ();
48 if ($NS_status != 0) {
49 print STDERR "ERROR: Name Service returned $NS_status\n";
50 exit 1;
53 if ($ns->WaitForFileTimed ($nsiorfile,$ns->ProcessStartWaitInterval()+$startup_timeout) == -1) {
54 print STDERR "ERROR: cannot find file <$ns_nsiorfile>\n";
55 $NS->Kill (); $NS->TimedWait (1);
56 exit 1;
59 if ($ns->GetFile ($nsiorfile) == -1) {
60 print STDERR "ERROR: cannot retrieve file <$ns_nsiorfile>\n";
61 $NS->Kill (); $NS->TimedWait (1);
62 exit 1;
64 if ($nfs->PutFile ($nsiorfile) == -1) {
65 print STDERR "ERROR: cannot set file <$nfs_nsiorfile>\n";
66 $NS->Kill (); $NS->TimedWait (1);
67 exit 1;
69 if ($sub->PutFile ($nsiorfile) == -1) {
70 print STDERR "ERROR: cannot set file <$sub_nsiorfile>\n";
71 $NS->Kill (); $NS->TimedWait (1);
72 exit 1;
75 $NFS->Arguments ($Notify_Args);
76 $args = $NFS->Arguments ();
77 print STDERR "Running Notification with arguments: $args\n";
78 $NFS_status = $NFS->Spawn ();
80 if ($NFS_status != 0) {
81 print STDERR "ERROR: Notification Service returned $NFS_status\n";
82 exit 1;
85 if ($nfs->WaitForFileTimed ($nfsiorfile,$nfs->ProcessStartWaitInterval()+$startup_timeout) == -1) {
86 print STDERR "ERROR: cannot find file <$nfs_nfsiorfile>\n";
87 $NFS->Kill (); $NFS->TimedWait (1);
88 $NS->Kill (); $NS->TimedWait (1);
89 exit 1;
92 $SUB->Arguments ($Subscribe_Args);
93 $args = $SUB->Arguments ();
94 print STDERR "Running Subscribe with arguments: $args\n";
95 $SUB_status = $SUB->SpawnWaitKill ($sub->ProcessStartWaitInterval()+$experiment_timeout);
96 if ($SUB_status != 0) {
97 print STDERR "ERROR: Subscriber returned $SUB_status\n";
98 $status = 1;
101 $NFS_status = $NFS->TerminateWaitKill ($nfs->ProcessStopWaitInterval());
103 if ($NFS_status != 0) {
104 print STDERR "ERROR: Notification Service returned $NFS_status\n";
105 $status = 1;
108 $NS_status = $NS->TerminateWaitKill ($ns->ProcessStopWaitInterval());
110 if ($NS_status != 0) {
111 print STDERR "ERROR: Name Service returned $NS_status\n";
112 $status = 1;
115 $ns->DeleteFile ($nsiorfile);
116 $nfs->DeleteFile ($nsiorfile);
117 $sub->DeleteFile ($nsiorfile);
118 $nfs->DeleteFile ($nfsiorfile);
120 exit $status;