/[cwmp]/google/t/30-server.t
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /google/t/30-server.t

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 41 by dpavlin, Tue Jun 19 18:11:37 2007 UTC revision 84 by dpavlin, Fri Jun 22 18:25:24 2007 UTC
# Line 4  use warnings; Line 4  use warnings;
4    
5  my $debug = shift @ARGV;  my $debug = shift @ARGV;
6    
7  use Test::More tests => 15;  use Test::More tests => 16;
8  use Data::Dump qw/dump/;  use Data::Dump qw/dump/;
9    use Cwd qw/abs_path/;
10  use blib;  use blib;
11    
12  BEGIN {  BEGIN {
# Line 20  eval { Line 21  eval {
21          alarm 30;          alarm 30;
22  };  };
23    
24  ok( my $server = CWMP::Server->new({ debug => $debug, port => $port }), 'new' );  ok(my $abs_path = abs_path($0), "abs_path");
25    $abs_path =~ s!/[^/]*$!/!;      #!fix-vim
26    
27    my $store_path = "$abs_path/var/state.db";
28    unlink $store_path if -e $store_path;
29    
30    ok( my $server = CWMP::Server->new({
31            debug => $debug,
32            port => $port,
33            store_path => $store_path,
34    }), 'new' );
35  isa_ok( $server, 'CWMP::Server' );  isa_ok( $server, 'CWMP::Server' );
36    
37  my $pid;  my $pid;
# Line 36  if ( $pid = fork ) { Line 47  if ( $pid = fork ) {
47          die "can't fork";          die "can't fork";
48  }  }
49    
50    sleep 1;        # so server can start
51    
52  ok( my $s = Net::HTTP->new(Host => "localhost:$port"), 'client' );  ok( my $s = Net::HTTP->new(Host => "localhost:$port"), 'client' );
53  #$s->keepalive( 1 );  $s->keep_alive( 1 );
54    
55  ok( $s->write_request(  ok( $s->write_request(
56          POST => '/',          POST => '/',
# Line 137  InternetGatewayDevice.DeviceInfo.SpecVer Line 149  InternetGatewayDevice.DeviceInfo.SpecVer
149  }  }
150  ok( $s->write_chunk_eof, 'write_chunk_eof' );  ok( $s->write_chunk_eof, 'write_chunk_eof' );
151    
152  ok( kill(1,$pid), 'kill ' . $pid );  sleep 1;
153    
154    ok( kill(9,$pid), 'kill ' . $pid );
155    
156  ok( waitpid($pid,0), 'waitpid' );  ok( waitpid($pid,0), 'waitpid' );

Legend:
Removed from v.41  
changed lines
  Added in v.84

  ViewVC Help
Powered by ViewVC 1.1.26