Debian Codegraph @

ci/test-01-basics.pl

raw
1 #!/usr/bin/perl -w
2
3 use Test::Command tests => 9;
4 use Test::More;
5
6 # ping 127.0.0.1
7 {
8 my $cmd = Test::Command->new(cmd => "fping 127.0.0.1");
9 $cmd->exit_is_num(0);
10 $cmd->stdout_is_eq("127.0.0.1 is alive\n");
11 $cmd->stderr_is_eq("");
12 }
13
14 # ping ::1
15 SKIP: {
16 #system("/sbin/ifconfig >&2");
17 if($ENV{SKIP_IPV6}) {
18 skip 'Skip IPv6 tests', 3;
19 }
20 my $cmd = Test::Command->new(cmd => "fping ::1");
21 $cmd->exit_is_num(0);
22 $cmd->stdout_is_eq("::1 is alive\n");
23 $cmd->stderr_is_eq("");
24 }
25
26 # ping 3 times 127.0.0.1
27 {
28 my $cmd = Test::Command->new(cmd => "fping -p 100 -C3 127.0.0.1");
29 $cmd->exit_is_num(0);
30 $cmd->stdout_like(qr{127\.0\.0\.1 : \[0\], 64 bytes, \d\.\d+ ms \(\d\.\d+ avg, 0% loss\)
31 127\.0\.0\.1 : \[1\], 64 bytes, \d\.\d+ ms \(\d\.\d+ avg, 0% loss\)
32 127\.0\.0\.1 : \[2\], 64 bytes, \d\.\d+ ms \(\d\.\d+ avg, 0% loss\)
33 });
34 $cmd->stderr_like(qr{127\.0\.0\.1 : \d\.\d+ \d\.\d+ \d\.\d+\n});
35 }