24 |
ok(my $abs_path = abs_path($0), "abs_path"); |
ok(my $abs_path = abs_path($0), "abs_path"); |
25 |
$abs_path =~ s!/[^/]*$!/!; #!fix-vim |
$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({ |
ok( my $server = CWMP::Server->new({ |
31 |
debug => $debug, |
debug => $debug, |
32 |
port => $port, |
port => $port, |
33 |
store_path => "$abs_path/var/state.db", |
store_path => $store_path, |
34 |
}), 'new' ); |
}), 'new' ); |
35 |
isa_ok( $server, 'CWMP::Server' ); |
isa_ok( $server, 'CWMP::Server' ); |
36 |
|
|
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->keep_alive( 1 ); |
$s->keep_alive( 1 ); |
54 |
|
|
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' ); |