summaryrefslogtreecommitdiff
path: root/TAO/performance-tests/Cubit/TAO/IDL_Cubit/run_test.pl
blob: 2020f15304afb0cb5df4b3a37da70a7c20fbaed9 (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
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}'
    & eval 'exec perl -S $0 $argv:q'
    if 0;

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

# The first three lines above let this script run without specifying the
# full path to perl, as long as it is in the user's PATH.
# Taken from perlrun man page.

# Do not use environment variables here since not all platforms use ACE_ROOT
use lib "../../../../../bin";
use PerlACE::Run_Test;
use English;

$status = 0;

$iorfile = PerlACE::LocalFile ("cubit.ior");
$iiop_lite_conf = PerlACE::LocalFile ("iiop_lite.conf");
$uiop_lite_conf = PerlACE::LocalFile ("uiop_lite.conf");
$server_shmiop_conf = PerlACE::LocalFile ("server_shmiop.conf");

$svnsflags = " -f $iorfile";
$clnsflags = " -f $iorfile";
$clflags = "";
$svflags = "";
$quietflag = " -q ";
$giopliteflag = 0;

###############################################################################
# Parse the arguments

for ($i = 0; $i <= $#ARGV; $i++) {
    if ($ARGV[$i] eq "-h" || $ARGV[$i] eq "-?") {
        print "run_test [-h] [-n num] [-debug] [-orblite] [-verbose]\n";
        print "\n";
        print "-h                  -- prints this information\n";
        print "-n num              -- client uses <num> iterations\n";
        print "-debug              -- sets the debug flag for both client and "
                                      . "server\n";
        print "-orblite            -- Use the lite version of the orb";
        exit;
    }
    elsif ($ARGV[$i] eq "-debug") {
        $clflags .= " -d ";
        $svflags .= " -d ";
    }
    elsif ($ARGV[$i] eq "-n") {
        $clflags .= " -n $ARGV[$i + 1] ";
        $i++;
    }
    elsif ($ARGV[$i] eq " -orblite ") {
        $giopliteflag = 1;
    }
    elsif ($ARGV[$i] eq " -verbose ") {
        $quietflag = "";
    }
    else {
        print STDERR "ERROR: Unknown Option: ".$ARGV[$i]."\n";
    }
}

$SV = new PerlACE::Process ("server");
$CL = new PerlACE::Process ("client");

###############################################################################
# run_test_helper

sub run_test_helper ()
{
    $SV->Spawn ();

    if (PerlACE::waitforfile_timed ($iorfile, 10) == -1) {
        print STDERR "ERROR: cannot find file <$iorfile>\n";
        $SV->Kill ();
        exit 1;
    }

    my $client = $CL->SpawnWaitKill (120);
    my $server = $SV->WaitKill (30);

    unlink $iorfile;

    if ($server != 0) {
        print STDERR "ERROR: server error status $server\n";
        $status = 1;
    }

    if ($client != 0) {
        print STDERR "ERROR: client error status $client\n";
        $status = 1;
    }
}

###############################################################################

if (! (-x $SV->Executable () && -x $CL->Executable)) {
    print STDERR "ERROR: server and/or client missing or not executable!\n";
    exit 1;
}

unlink $iorfile;

print STDERR "============================================================\n";
print STDERR "Running IDL_Cubit with the default ORB protocol.\n\n";

$SV->Arguments ($svflags . $svnsflags);
$CL->Arguments ($clflags . $clnsflags . $quietflag . " -x ");

if ($giopliteflag) {
    print STDERR "\nRunning IDL_Cubit with the a lite ORB protocol.\n\n";
    $SV->Arguments ($SV->Arguments () . " -ORBSvcConf $iiop_lite_conf ");
    $CL->Arguments ($CL->Arugments () . " -ORBSvcConf $iiop_lite_conf ");
}

run_test_helper ();

if ($OSNAME ne "MSWin32") {
    print STDERR "============================================================\n";
    print STDERR "Running IDL_Cubit with the UIOP protocol.\n\n";

    $SV->Arguments ($svflags . $svnsflags . " -ORBEndpoint uiop:// ");
    $CL->Arguments ($clflags . $clnsflags . $quietflag . " -x ");

    if ($giopliteflag) {
        print STDERR "\nRunning IDL_Cubit with the a UIOP lite ORB protocol.\n\n";
        $SV->Arguments ($SV->Arguments () . " -ORBSvcConf $uiop_lite_conf ");
        $CL->Arguments ($CL->Arugments () . " -ORBSvcConf $uiop_lite_conf ");
    }

    run_test_helper ();
}

print STDERR "============================================================\n";
print STDERR "Running IDL_Cubit with the SHMIOP protocol.\n\n";

$SV->Arguments ($svflags . $svnsflags
                . " -ORBEndpoint shmiop:// -ORBSvcconf $server_shmiop_conf ");
$CL->Arguments ($clflags . $clnsflags . $quietflag . " -x ");

run_test_helper ();

# Clean up SHMIOP files
PerlACE::check_n_cleanup_files ("server_shmiop_*");

exit $status;