File Coverage

blib/lib/PITA/Guest/Driver/Image/Test.pm
Criterion Covered Total %
statement 13 15 86.6
branch n/a
condition n/a
subroutine 5 5 100.0
pod n/a
total 18 20 90.0


line stmt bran cond sub pod time code
1             package PITA::Guest::Driver::Image::Test;
2              
3 1     1   3828 use 5.008;
  1         4  
  1         49  
4 1     1   8 use strict;
  1         2  
  1         39  
5 1     1   7 use File::Spec ();
  1         2  
  1         16  
6 1     1   7 use Probe::Perl ();
  1         2  
  1         22  
7 1     1   709 use PITA::Image 0.60 ();
  0            
  0            
8             use PITA::Guest::Driver::Image ();
9              
10             our $VERSION = '0.60';
11             our @ISA = 'PITA::Guest::Driver::Image';
12              
13             # The location of the support server
14             my $image_bin = File::Spec->rel2abs(
15             File::Spec->catfile( 't', 'bin', 'pita-imagetest' )
16             );
17             unless ( -f $image_bin ) {
18             Carp::croak("Failed to find the pita-imagetest script");
19             }
20              
21             # To allow for testing, whenever we return a support server we
22             # need to keep a reference to it.
23             use vars qw{$LAST_SUPPORT_SERVER};
24             BEGIN {
25             $LAST_SUPPORT_SERVER = undef;
26             }
27              
28             sub support_server_new {
29             my $self = shift;
30             my $server = PITA::Guest::Server::Process->new(
31             Program => [
32             Probe::Perl->find_perl_interpreter,
33             $image_bin,
34             '--injector',
35             $self->injector_dir,
36             ],
37             Hostname => $self->support_server_addr,
38             Port => $self->support_server_port,
39             Mirrors => { },
40             # http_result => $self->support_server_results,
41             # http_startup_timeout => 30,
42             # http_activity_timeout => 60,
43             # http_shutdown_timeout => 30,
44             );
45              
46             # Save the reference to the support server
47             $LAST_SUPPORT_SERVER = $server;
48              
49             return $server;
50             }
51              
52             1;