sub start_selenium_server {
my($self) = @_;
if($self->{selenium_rc}{start}) {
- $self->{selenium_rc}{xvnc_server_proc} = Child->new(sub {
+ my $child = Child->new(sub {
system('ssh', $self->{selenium_rc}{host}, 'vncserver',
":$self->{selenium_rc}{xvnc_display}");
}
);
- $self->{selenium_rc}{xvnc_server_proc}->start;
- $self->{selenium_rc}{selenium_server_proc} = Child->new(sub {
+ $self->{selenium_rc}{xvnc_server_proc} = $child->start;
+ $child = Child->new(sub {
system('ssh', $self->{selenium_rc}{host}, 'env',
"DISPLAY=:$self->{selenium_rc}{xvnc_display}", 'selenium-rc', '-port',
$self->{selenium_rc}{port} );
}
);
- $self->{selenium_rc}{selenium_server_proc}->start;
+ $self->{selenium_rc}{selenium_server_proc} = $child->start;
}
my $tries = 0;
while($tries < 5) {
last;
}
}
- die "timed out waiting for selenium server to start at
- http://$self->{selenium_rc}{host}:$self->{selenium_rc}{port}" if $tries == 5;
+ if($tries == 5) {
+ diag "timed out waiting for selenium server to start at
+ http://$self->{selenium_rc}{host}:$self->{selenium_rc}{port}" if $tries == 5;
+ $self->done;
+ }
}
sub stop_selenium_server {
$self->{selenium_rc}{host}, $self->{selenium_rc}{port};
get($url);
delete $self->{src};
- $self->{selenium_rc}{selenium_server_proc}->wait;
- $self->{selenium_rc}{xvnc_server_proc}->wait;
+ $self->{selenium_rc}{selenium_server_proc}->kill("KILL");
+ my $child = Child->new(sub {
+ system('ssh', $self->{selenium_rc}{host}, 'vncserver', '-kill',
+ ":$self->{selenium_rc}{xvnc_display}");
+ }
+ );
+ my $proc = $child->start;
+ $proc->wait;
}
sub start_app_server {
my($self) = @_;
- $self->{app_server_proc} = Child->new(sub { exec($self->{app_server_cmd}) } );
- $self->{app_server_proc}->start;
+ my $child = Child->new(sub { exec($self->{app_server_cmd}) } );
+ $self->{app_server_proc} = $child->start;
}
sub stop_app_server {
my($self) = @_;
- $self->{app_server_proc}->complete || $self->{app_server_proc}->kill("KILL");
+ $self->{app_server_proc}->kill("KILL");
}
sub test_directory {
return \@rows;
}
-sub DESTROY {
+sub done {
my($self) = @_;
if(exists $self->{selenium_rc}{xvnc_server_proc} and
exists $self->{selenium_rc}{selenium_server_proc}) {
- $self->{selenium_rc}{xvnc_server_proc}->complete ||
- $self->{selenium_rc}{xvnc_server_proc}->kill("KILL");
- $self->{selenium_rc}{selenium_server_proc}->complete ||
- $self->{selenium_rc}{selenium_server_proc}->kill("KILL");
+ $self->stop_selenium_server;
}
$self->stop_app_server;
}