Code

test GNU_SOURCE and include features.h if present to clear warning about asprintf...
[nagiosplug.git] / plugins / t / check_disk.t
1 use strict;
2 use Test;
3 use vars qw($tests);
5 BEGIN {$tests = 6; plan tests => $tests}
7 my $null = '';
8 my $cmd;
9 my $str;
10 my $t;
12 $cmd = "./check_disk 100 100 /";
13 $str = `$cmd`;
14 $t += ok $?>>8,0;
15 print "Test was: $cmd\n" if ($?);
16 $t += ok $str, '/^(Disk ok - +[\.0-9]+|DISK OK - )/';
18 $cmd = "./check_disk -w 0 -c 0 /";
19 $str = `$cmd`;
20 $t += ok $?>>8,0;
21 print "Test was: $cmd\n" if ($?);
22 $t += ok $str, '/^(Disk ok - +[\.0-9]+|DISK OK - )/';
24 $cmd = "./check_disk 0 0 /";
25 $str = `$cmd`;
26 $t += ok $?>>8,2;
27 print "Test was: $cmd\n" unless ($?);
28 $t += ok $str, '/^(Only +[\.0-9]+|DISK CRITICAL - )/';
30 exit(0) if defined($Test::Harness::VERSION);
31 exit($tests - $t);