📄 run_test.pl
字号:
. " -ORBUseIMR 1 $imr_initref -o $nestea_ior\"");
$result = $TAO_IMR->SpawnWaitKill (10);
if ($result != 0) {
print STDERR "ERROR: tao_imr returned $result\n";
$IMR_ACTIVATOR->Kill ();
$IMR_LOCATOR->Kill ();
return 1;
}
$N_SVR->Arguments ("-ORBUseIMR 1 -o $nestea_ior $imr_initref");
$N_SVR->Spawn ();
if (PerlACE::waitforfile_timed ($nestea_ior, 10) == -1) {
print STDERR "ERROR: cannot find $nestea_ior\n";
$N_SVR->Kill ();
$IMR_ACTIVATOR->Kill ();
$IMR_LOCATOR->Kill ();
return 1;
}
$result = $N_CLI->SpawnWaitKill (10);
if ($result != 0) {
print STDERR "ERROR: nestea client 1 returned $result\n";
$status = 1;
}
$TAO_IMR->Arguments ("$imr_initref shutdown nestea_server");
$result = $TAO_IMR->SpawnWaitKill (10);
if ($result != 0) {
print STDERR "ERROR: tao_imr 1 returned $result\n";
$status = 1;
}
my $server = $N_SVR->WaitKill (5);
if ($server != 0) {
print STDERR "ERROR: nestea server returned $server\n";
$status = 1;
}
# This should cause the activator to spawn another server.
$result = $N_CLI->SpawnWaitKill (20);
if ($result != 0) {
print STDERR "ERROR: nestea client 2 returned $result\n";
$status = 1;
}
$result = $TAO_IMR->SpawnWaitKill (10);
if ($result != 0) {
print STDERR "ERROR: tao_imr 1 returned $result\n";
$status = 1;
}
# Since the second server was started by the activator, it is not
# managed by perl, and we can't wait for it to die. So sleep a few secs.
sleep(5);
my $implrepo = $IMR_ACTIVATOR->TerminateWaitKill (5);
if ($implrepo != 0) {
print STDERR "ERROR: IMR_Activator returned $implrepo\n";
$status = 1;
}
$implrepo = $IMR_LOCATOR->TerminateWaitKill (5);
if ($implrepo != 0) {
print STDERR "ERROR: IMR_Locator returned $implrepo\n";
$status = 1;
}
return $status;
}
###############################################################################
sub persistent_ir_test
{
my $status = 0;
my $result = 0;
my $imr_initref = "-ORBInitRef ImplRepoService=file://$imr_locator_ior";
$IMR_LOCATOR->Arguments ("-d 1 -o $imr_locator_ior");
$IMR_LOCATOR->Spawn ();
if (PerlACE::waitforfile_timed ($imr_locator_ior, 10) == -1) {
print STDERR "ERROR: cannot find $implrepo_ior\n";
$IMR_LOCATOR->Kill ();
return 1;
}
$IMR_ACTIVATOR->Arguments ("-d 1 -o $imr_activator_ior -p $backing_store $imr_initref");
$IMR_ACTIVATOR->Spawn ();
if (PerlACE::waitforfile_timed ($imr_activator_ior, 30) == -1) {
print STDERR "ERROR: cannot find $imr_activator_ior\n";
$IMR_ACTIVATOR->Kill ();
$IMR_LOCATOR->Kill ();
return 1;
}
$TAO_IMR->Arguments ("$imr_initref add airplane_server -c \"" . $A_SVR->Executable () . " -ORBUseIMR 1 $refstyle $imr_initref\"");
$result = $TAO_IMR->SpawnWaitKill (10);
if ($result != 0) {
print STDERR "ERROR: tao_imr returned $result\n";
return 1;
}
$A_SVR->Arguments ("-o $airplane_ior -ORBUseIMR 1 $refstyle $imr_initref");
$A_SVR->Spawn ();
if (PerlACE::waitforfile_timed ($airplane_ior, 10) == -1) {
print STDERR "ERROR: cannot find $airplane_ior\n";
$IMR->Kill ();
$A_SVR->Kill ();
return 1;
}
$TAO_IMR->Arguments ("$imr_initref shutdown airplane_server");
$result = $A_CLI->SpawnWaitKill (10);
if ($result != 0) {
print STDERR "ERROR: airplane client returned $result\n";
$status = 1;
}
$result = $TAO_IMR->SpawnWaitKill (10);
if ($result != 0) {
print STDERR "ERROR: tao_imr shutdown returned $result\n";
$status = 1;
}
$result = $A_SVR->WaitKill (10);
if ($result != 0) {
print STDERR "ERROR: airplane server returned $result\n";
$status = 1;
}
# Should cause the activator to spawn another server.
$result = $A_CLI->SpawnWaitKill (20);
if ($result != 0) {
print STDERR "ERROR: airplane client 2 returned $result\n";
$status = 1;
}
$result = $TAO_IMR->SpawnWaitKill (10);
if ($result != 0) {
print STDERR "ERROR: tao_imr shutdown 2 returned $result\n";
$status = 1;
}
# Since the second server was started by the activator, it is not
# managed by perl, and we can't wait for it to die. So sleep a few secs.
sleep(5);
my $implrepo = $IMR_ACTIVATOR->TerminateWaitKill (5);
if ($implrepo != 0) {
print STDERR "ERROR: IMR_Activator returned $implrepo\n";
$status = 1;
}
$implrepo = $IMR_LOCATOR->TerminateWaitKill (5);
if ($implrepo != 0) {
print STDERR "ERROR: IMR_Locator returned $implrepo\n";
$status = 1;
}
# Unlink so that we can wait on them again to know the servers started.
unlink $imr_locator_ior;
unlink $imr_activator_ior;
print "Restarting Implementation Repository.\n";
$IMR_LOCATOR->Spawn ();
if (PerlACE::waitforfile_timed ($imr_locator_ior, 10) == -1) {
print STDERR "ERROR: cannot find $implrepo_ior\n";
$IMR_LOCATOR->Kill ();
return 1;
}
# Should reload the server list without having to run tao_imr again.
$IMR_ACTIVATOR->Spawn ();
if (PerlACE::waitforfile_timed ($imr_activator_ior, 30) == -1) {
print STDERR "ERROR: cannot find $imr_activator_ior\n";
$IMR_ACTIVATOR->Kill ();
$IMR_LOCATOR->Kill ();
return 1;
}
# Should cause the activator to spawn another server.
$result = $A_CLI->SpawnWaitKill (20);
if ($result != 0) {
print STDERR "ERROR: airplane client 3 returned $result\n";
$status = 1;
}
$result = $TAO_IMR->SpawnWaitKill (10);
if ($result != 0) {
print STDERR "ERROR: tao_imr shutdown 3 returned $result\n";
$status = 1;
}
# Since the second server was started by the activator, it is not
# managed by perl, and we can't wait for it to die. So sleep a few secs.
sleep(5);
my $implrepo = $IMR_ACTIVATOR->TerminateWaitKill (5);
if ($implrepo != 0) {
print STDERR "ERROR: IMR_Activator returned $implrepo\n";
$status = 1;
}
$implrepo = $IMR_LOCATOR->TerminateWaitKill (5);
if ($implrepo != 0) {
print STDERR "ERROR: IMR_Locator returned $implrepo\n";
$status = 1;
}
return $status;
}
###############################################################################
sub both_ir_test
{
my $status = 0;
my $imr_initref = "-ORBInitRef ImplRepoService=file://$imr_locator_ior";
$IMR_LOCATOR->Arguments ("-d 1 -o $imr_locator_ior $refstyle");
$IMR_LOCATOR->Spawn ();
if (PerlACE::waitforfile_timed ($imr_locator_ior, 10) == -1) {
print STDERR "ERROR: cannot find $imr_locator_ior\n";
$IMR_LOCATOR->Kill ();
return 1;
}
$IMR_ACTIVATOR->Arguments ("-o $imr_activator_ior $imr_initref $refstyle -d 1");
$IMR_ACTIVATOR->Spawn ();
if (PerlACE::waitforfile_timed ($imr_activator_ior, 10) == -1) {
print STDERR "ERROR: cannot find $imr_activator_ior\n";
$IMR_ACTIVATOR->Kill ();
$IMR_LOCATOR->Kill ();
return 1;
}
$TAO_IMR->Arguments ("$imr_initref add nestea_server -c \""
. $N_SVR->Executable ()
. " -ORBUseIMR 1 $refstyle -o $nestea_ior $imr_initref\"");
$TAO_IMR->SpawnWaitKill (10);
$TAO_IMR->Arguments ("$imr_initref add airplane_server -c \""
. $A_SVR->Executable ()
. " -ORBUseIMR 1 $refstyle -o $airplane_ior $imr_initref\"");
$TAO_IMR->SpawnWaitKill (10);
$N_SVR->Arguments (" -o $nestea_ior -ORBUseIMR 1 $refstyle $imr_initref");
$N_SVR->Spawn ();
$A_SVR->Arguments (" -o $airplane_ior -ORBUseIMR 1 $refstyle $imr_initref");
$A_SVR->Spawn ();
if (PerlACE::waitforfile_timed ($nestea_ior, 10) == -1) {
print STDERR "ERROR: cannot find $nestea_ior\n";
$IMR_ACTIVATOR->Kill ();
$IMR_LOCATOR->Kill ();
$A_SVR->Kill ();
$N_SVR->Kill ();
return 1;
}
if (PerlACE::waitforfile_timed ($airplane_ior, 10) == -1) {
print STDERR "ERROR: cannot find $airplane_ior\n";
$IMR_ACTIVATOR->Kill ();
$IMR_LOCATOR->Kill ();
$A_SVR->Kill ();
$N_SVR->Kill ();
return 1;
}
# todo : Add error checking.
$N_CLI->Spawn ();
$A_CLI->Spawn ();
$N_CLI->WaitKill (10);
$A_CLI->WaitKill (10);
$TAO_IMR->Arguments ("$imr_initref shutdown nestea_server");
$TAO_IMR->SpawnWaitKill (10);
$N_SVR->WaitKill(10);
$N_CLI->Spawn (20);
$TAO_IMR->Arguments ("$imr_initref shutdown airplane_server");
$TAO_IMR->SpawnWaitKill (10);
$A_SVR->WaitKill(10);
$A_CLI->SpawnWaitKill (20);
$N_CLI->WaitKill (10);
$TAO_IMR->Arguments ("$imr_initref shutdown nestea_server");
$TAO_IMR->SpawnWaitKill (10);
$TAO_IMR->Arguments ("$imr_initref shutdown airplane_server");
$TAO_IMR->SpawnWaitKill (10);
sleep(5);
$IMR_ACTIVATOR->Kill ();
$IMR_LOCATOR->Kill ();
}
###############################################################################
###############################################################################
# Parse the arguments
for ($i = 0; $i <= $#ARGV; $i++) {
if ($ARGV[$i] eq "-h" || $ARGV[$i] eq "-?") {
print "run_test test\n";
print "\n";
print "test -- Runs a specific test:\n";
print " airplane, airplane_ir, nt_service, ",
"nestea, nestea_ir,\n";
print " both_ir, persistent_ir\n";
exit;
}
elsif ($ARGV[$i] eq "airplane") {
exit airplane_test ();
}
elsif ($ARGV[$i] eq "airplane_ir") {
exit airplane_ir_test ();
}
elsif ($ARGV[$i] eq "nt_service_ir") {
exit nt_service_test ();
}
elsif ($ARGV[$i] eq "nestea") {
exit nestea_test ();
}
elsif ($ARGV[$i] eq "nestea_ir") {
exit nestea_ir_test ();
}
elsif ($ARGV[$i] eq "both_ir") {
exit both_ir_test ();
}
elsif ($ARGV[$i] eq "persistent_ir") {
exit persistent_ir_test ();
}
else {
print "run_test: Unknown Option: ".$ARGV[$i]."\n";
}
}
# if nothing else, run both_ir
exit both_ir_test ();
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -