summaryrefslogtreecommitdiff
path: root/orbsvcs/tests/Notify/performance-tests/scripts/Max_Throughput/Colocated_RTCORBA/run_test.pl
blob: 865a3a106cac33e1b0453176016d079598e4bfb1 (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

eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}'
     & eval 'exec perl -S $0 $argv:q'
     if 0;

# $Id$
# -*- perl -*-

use lib "$ENV{ACE_ROOT}/bin";
use PerlACE::TestTarget;

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

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

my $nm_service = PerlACE::TestTarget::create_target (1) || die "Create target 1 failed\n";
my $collocated = PerlACE::TestTarget::create_target (2) || die "Create target 2 failed\n";
$collocated->AddLibPath("$ENV{ACE_ROOT}/TAO/orbsvcs/tests/Notify/lib");
$collocated->AddLibPath("$ENV{ACE_ROOT}/TAO/orbsvcs/tests/Notify/RT_lib");

my $iorbase = "naming.ior";
my $collocated_conf = "colocated.conf";

my $collocated_conffile = $collocated->LocalFile($collocated_conf);
my $nm_service_iorfile = $nm_service->LocalFile($iorbase);
my $collocated_iorfile = $collocated->LocalFile($iorbase);
$nm_service->DeleteFile($iorbase);
$collocated->DeleteFile($iorbase);

$NM_SV = $nm_service->CreateProcess ("../../../../../../Naming_Service/Naming_Service",
                                     "-ORBdebuglevel $debug_level -o $nm_service_iorfile");

$CL = $collocated->CreateProcess ("../../../../Driver/Notify_Tests_Driver",
                                  "-ORBInitRef NameService=file://$collocated_iorfile ".
                                  "-ORBSvcConf $collocated_conffile");

$process_status = $NM_SV->Spawn ();

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

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

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

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

$process_status = $CL->SpawnWaitKill ($collocated->ProcessStartWaitInterval() + 585);

if ($process_status != 0) {
    print STDERR "ERROR: collocated returned $process_status\n";
    $status = 1;
}

$NM_SV->Kill ();

$nm_service->DeleteFile($iorbase);
$collocated->DeleteFile($iorbase);

if ($#ARGV > -1) {
    $results_directory = $ARGV[0];
    print STDERR "Saving results to $results_directory\n";

    mkdir $results_directory, 0777;

    @list=glob("*.dat");
    for $file (@list) {
        copy ("$file", "$results_directory/$file");
    }

    @list=glob("*.conf");
    for $file (@list) {
        copy ("$file", "$results_directory/$file");
    }
}

exit $status;