Revert "Use a variable on the stack to not have a temporary in the call"
[ACE_TAO.git] / TAO / orbsvcs / tests / Notify / performance-tests / RedGreen / run_test.pl
blob0567a2f11c2b1ad89e339a7b99155686d996b0a9
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;
9 $status = 0;
11 @test_configs = ( "reactive.conf", "lookup.conf", "listener.conf");
13 my $nm_service = PerlACE::TestTarget::create_target (1) || die "Create target 1 failed\n";
14 my $test = PerlACE::TestTarget::create_target (2) || die "Create target 2 failed\n";
15 my $nt_service = PerlACE::TestTarget::create_target (3) || die "Create target 3 failed\n";
17 $test->AddLibPath ('../../lib');
19 my $notify_ior = "notify.ior";
20 my $naming_ior = "naming.ior";
22 my $nm_service_nmiorfile = $nm_service->LocalFile ($naming_ior);
23 my $nt_service_ntiorfile = $nt_service->LocalFile ($notify_ior);
24 my $nt_service_nmiorfile = $nt_service->LocalFile ($naming_ior);
25 my $test_nmiorfile = $test->LocalFile ($naming_ior);
27 $nm_service->DeleteFile ($naming_ior);
28 $nt_service->DeleteFile ($notify_ior);
29 $nt_service->DeleteFile ($naming_ior);
30 $test->DeleteFile ($naming_ior);
32 $NM_SV = $nm_service->CreateProcess ("$ENV{TAO_ROOT}/orbsvcs/Naming_Service/tao_cosnaming", "-o $nm_service_nmiorfile");
33 $T = $test->CreateProcess ("RedGreen_Test", "-ORBInitRef NameService=file://$test_nmiorfile");
34 $NT_SV = $nt_service->CreateProcess ("$ENV{TAO_ROOT}/orbsvcs/Notify_Service/tao_cosnotification", "");
36 $nm_service_status = $NM_SV->Spawn ();
38 if ($nm_service_status != 0) {
39 print STDERR "ERROR: Naming service returned $nm_service_status\n";
40 exit 1;
43 if ($nm_service->WaitForFileTimed ($naming_ior,
44 $nm_service->ProcessStartWaitInterval() + 45) == -1) {
45 print STDERR "ERROR: cannot find file <$nm_service_nmiorfile>\n";
46 $NM_SV->Kill (); $NM_SV->TimedWait (1);
47 exit 1;
50 sleep (10);
52 if ($nm_service->GetFile ($naming_ior) == -1) {
53 print STDERR "ERROR: cannot retrieve file <$nm_service_nmiorfile>\n";
54 $NM_SV->Kill (); $NM_SV->TimedWait (1);
55 exit 1;
58 if ($test->PutFile ($naming_ior) == -1) {
59 print STDERR "ERROR: cannot set file <$test_nmiorfile>\n";
60 $NM_SV->Kill (); $NM_SV->TimedWait (1);
61 exit 1;
64 if ($nt_service->PutFile ($naming_ior) == -1) {
65 print STDERR "ERROR: cannot set file <$nt_service_nmiorfile>\n";
66 $NM_SV->Kill (); $NM_SV->TimedWait (1);
67 exit 1;
70 for $config (@test_configs) {
71 print STDERR "\nTesting Notification Service with config file = $config ....\n\n";
73 $NT_SV->Arguments("-ORBInitRef NameService=file://$nt_service_nmiorfile " .
74 "-IORoutput $nt_service_ntiorfile -ORBSvcConf $config");
76 $nt_service_status = $NT_SV->Spawn ();
78 if ($nt_service_status != 0) {
79 print STDERR "ERROR: Notify service returned $nt_service_status\n";
80 $NM_SV->Kill (); $NM_SV->TimedWait (1);
81 exit 1;
84 if ($nt_service->WaitForFileTimed ($notify_ior,
85 $nt_service->ProcessStartWaitInterval() + 45) == -1) {
86 print STDERR "ERROR: cannot find file <$nt_service_ntiorfile>\n";
87 $NT_SV->Kill (); $NT_SV->TimedWait (1);
88 $NM_SV->Kill (); $NM_SV->TimedWait (1);
89 exit 1;
92 sleep(10);
94 $test_status = $T->SpawnWaitKill ($test->ProcessStartWaitInterval() + 45);
96 if ($test_status != 0) {
97 print STDERR "ERROR: test returned $test_status\n";
98 $status = 1;
101 $NT_SV->Kill ();
104 $NT_SV->Kill ();
105 $NM_SV->Kill ();
107 $nm_service->DeleteFile ($naming_ior);
108 $nt_service->DeleteFile ($notify_ior);
109 $nt_service->DeleteFile ($naming_ior);
110 $test->DeleteFile ($naming_ior);
112 exit $status;