summaryrefslogtreecommitdiff
path: root/TAO/orbsvcs/tests/Notify/performance-tests/scripts/Paths_vs_Throughput/run_notify.pl
blob: f9b2b14509b78f2c610cbda5bf63ee1470c17a5f (plain)
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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}'
     & eval 'exec perl -S $0 $argv:q'
     if 0;

# -*- perl -*-

use lib "$ENV{ACE_ROOT}/bin";
use PerlACE::TestTarget;
use File::Copy;
use Getopt::Std;

PerlACE::check_privilege_group();

$status = 0;
$debug_level = '0';

foreach $i (@ARGV) {
    if ($i eq '-debug') {
        $debug_level = '10';
    }
}

# -n notify.conf -s high_path.conf -c other_paths.conf -o output_dir -h
getopts ("n:s:c:o:h");

if ($opt_h) {
    $opt_h = 0; #to disable fuxx.pl warning only
    print STDERR "-n notify.conf -s high_path.conf -c other_paths.conf -o output_dir -h\n";
    exit 0;
}

$nt_conf = "notify.conf";
if ($opt_n) {
    $nt_conf = $opt_n;
}

$high_path_conf = "high_path.conf";
if ($opt_s) {
    $high_path_conf = $opt_s;
}

$other_paths_conf = "other_paths.conf";
if ($opt_c) {
    $other_paths_conf = $opt_c;
}

my $nm_service = PerlACE::TestTarget::create_target (1) || die "Create target 1 failed\n";
my $nt_service = PerlACE::TestTarget::create_target (2) || die "Create target 2 failed\n";

#uncomment it when test will be fixed
#@list = glob("*.dat");
#for $file (@list) {
#    $nm_service->DeleteFile ($file);
#    $nt_service->DeleteFile ($file);
#}

my $nm_ior = "naming.ior";
my $nt_ior = "notify.ior";

my $nt_service_nt_conf = $nt_service->LocalFile($nt_conf);
my $nm_service_nm_ior  = $nm_service->LocalFile($nm_ior);
my $nt_service_nm_ior  = $nt_service->LocalFile($nm_ior);
my $nt_service_nt_ior  = $nt_service->LocalFile($nt_ior);
$nm_service->DeleteFile($nm_ior);
$nt_service->DeleteFile($nm_ior);
$nt_service->DeleteFile($nt_ior);

$NM_SV = $nm_service->CreateProcess ("$ENV{TAO_ROOT}/orbsvcs/Naming_Service/tao_cosnaming",
                                     "-ORBDebugLevel $debug_level -o $nm_service_nm_ior");

$NT_SV = $nt_service->CreateProcess ("$ENV{TAO_ROOT}/orbsvcs/Notify_Service/tao_cosnotification",
                                     "-ORBInitRef NameService=file://$nt_service_nm_ior ".
                                     "-IORoutput $nt_service_nt_ior ".
                                     "-ORBSvcConf $nt_service_nt_conf ".
                                     "-ORBDebugLevel $debug_level");

$service_status = $NM_SV->Spawn ();

if ($service_status != 0) {
    print STDERR "ERROR: naming service returned $service_status\n";
    exit 1;
}

if ($nm_service->WaitForFileTimed ($nm_ior,
                                   $nm_service->ProcessStartWaitInterval() + 105) == -1) {
    print STDERR "ERROR: cannot find file <$nm_service_nm_ior>\n";
    $NM_SV->Kill (); $NM_SV->TimedWait (1);
    exit 1;
}

if ($nm_service->GetFile ($nm_ior) == -1) {
    print STDERR "ERROR: cannot retrieve file <$nm_service_nm_ior>\n";
    $NM_SV->Kill (); $NM_SV->TimedWait (1);
    exit 1;
}

if ($nt_service->PutFile ($nm_ior) == -1) {
    print STDERR "ERROR: cannot set file <$nt_service_nm_ior>\n";
    $NM_SV->Kill (); $NM_SV->TimedWait (1);
    exit 1;
}

$service_status = $NT_SV->SpawnWaitKill ($nt_service->ProcessStartWaitInterval() + 585);

if ($service_status != 0) {
    print STDERR "ERROR: notification service returned $service_status\n";
    exit 1;
}

$nm_service->DeleteFile($nm_ior);
$nt_service->DeleteFile($nm_ior);
$nt_service->DeleteFile($nt_ior);

exit $status;