Debian Codegraph @

ci/test-03-forbidden.pl

raw
1 #!/usr/bin/perl -w
2
3 use Test::Command tests => 24;
4
5 # fping -i 0
6 my $cmd1 = Test::Command->new(cmd => "fping -i 0 -T10 -g 127.0.0.1/29");
7 $cmd1->exit_is_num(1);
8 $cmd1->stdout_is_eq("");
9 $cmd1->stderr_is_eq(<<END);
10 fping: these options are too risky for mere mortals.
11 fping: You need -i >= 1 and -p >= 10
12 END
13
14 # fping -p 9
15 my $cmd2 = Test::Command->new(cmd => "fping -c3 -p 9 127.0.0.1");
16 $cmd2->exit_is_num(1);
17 $cmd2->stdout_is_eq("");
18 $cmd2->stderr_is_eq(<<END);
19 fping: these options are too risky for mere mortals.
20 fping: You need -i >= 1 and -p >= 10
21 END
22
23 # fping -H 300
24 my $cmd5 = Test::Command->new(cmd => "fping -H 300 127.0.0.1");
25 $cmd5->exit_is_num(1);
26 $cmd5->stdout_is_eq("");
27 $cmd5->stderr_is_eq("fping: ttl 300 out of range\n");
28
29 # fping -a -u
30 my $cmd6 = Test::Command->new(cmd => "fping -a -u 127.0.0.1");
31 $cmd6->exit_is_num(1);
32 $cmd6->stdout_is_eq("");
33 $cmd6->stderr_is_eq("fping: specify only one of a, u\n");
34
35 # fping -c -l
36 my $cmd7 = Test::Command->new(cmd => "fping -c3 -l 127.0.0.1");
37 $cmd7->exit_is_num(1);
38 $cmd7->stdout_is_eq("");
39 $cmd7->stderr_is_eq("fping: specify only one of c, l\n");
40
41 # fping -b 65509
42 my $cmd8 = Test::Command->new(cmd => "fping -b 65509 127.0.0.1");
43 $cmd8->exit_is_num(1);
44 $cmd8->stdout_is_eq("");
45 $cmd8->stderr_is_eq("fping: data size 65509 not valid, must be lower than 65488\n");
46
47 # fping -B 0.9
48 my $cmd9 = Test::Command->new(cmd => "fping -B 0.9 127.0.0.1");
49 $cmd9->exit_is_num(1);
50 $cmd9->stdout_is_eq("");
51 $cmd9->stderr_is_eq("fping: backoff factor 0.9 not valid, must be between 1.0 and 5.0\n");
52
53 # fping -B 0.9
54 my $cmd10 = Test::Command->new(cmd => "fping -B 5.1 127.0.0.1");
55 $cmd10->exit_is_num(1);
56 $cmd10->stdout_is_eq("");
57 $cmd10->stderr_is_eq("fping: backoff factor 5.1 not valid, must be between 1.0 and 5.0\n");
58