diff options
author | Ethan Galstad <egalstad@users.sourceforge.net> | 2002-02-28 06:42:51 +0000 |
---|---|---|
committer | Ethan Galstad <egalstad@users.sourceforge.net> | 2002-02-28 06:42:51 +0000 |
commit | 44a321cb8a42d6c0ea2d96a1086a17f2134c89cc (patch) | |
tree | a1a4d9f7b92412a17ab08f34f04eec45433048b7 /test.pl.in | |
parent | 54fd5d7022ff2d6a59bc52b8869182f3fc77a058 (diff) | |
download | monitoring-plugins-44a321cb8a42d6c0ea2d96a1086a17f2134c89cc.tar.gz |
Initial revision
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@2 f882894a-f735-0410-b71e-b25c423dba1c
Diffstat (limited to 'test.pl.in')
-rwxr-xr-x | test.pl.in | 87 |
1 files changed, 87 insertions, 0 deletions
diff --git a/test.pl.in b/test.pl.in new file mode 100755 index 00000000..0b895a31 --- /dev/null +++ b/test.pl.in @@ -0,0 +1,87 @@ +#!/usr/bin/perl -w +use strict; + +my $file = '../Cache'; +unless (-f "$file.pm") { + open(CACHE,">$file.pm") or die "Cannot open cache"; + print CACHE "package Cache; +require Exporter; +\@ISA=qw(Exporter); +\@EXPORT=qw(); +1; +"; + close CACHE; +} + +use Helper; +my ($tstdir,$spath,$hostname,$mailhost,$noserver,$nullhost,$quickcheck); + +use Getopt::Long; +GetOptions + ("tstdir:s"=>\$tstdir, + "spath:s"=>\$spath, + "hostname:s"=>\$hostname, + "mailhost:s"=>\$mailhost, + "noserver:s"=>\$noserver, + "nullhost:s"=>\$nullhost, + "quickcheck"=>\$quickcheck); + +$spath = "." unless ($spath); + +unless ($quickcheck) { + + $hostname = get_option("hostname","host for FTP/HTTP/UDP tests") unless ($hostname); + $mailhost = get_option("mailhost","host for SMTP/IMAP/POP tests") unless ($mailhost); + $noserver = get_option("noserver","host that rejects above services") unless ($noserver); + # This machine should not be locatable from your network. Use IP + # private addresses like 10.x.x.x and pick one that does not exist + # on your LAN/WAN + $nullhost = get_option("nullhost","nonexistent IP address (e.g., 10.0.0.0)") unless ($nullhost); +} + +my @dots; +if (@ARGV) { + @dots = @ARGV; +} else { + unless ($tstdir) { + if (-d './t') { + $tstdir = './t'; + } else { + $tstdir = $ENV{PWD}; + $tstdir = `/bin/pwd` unless defined($tstdir); + chomp $tstdir; + if (defined($tstdir)) { + $tstdir =~ s|^(.*)/([^/]+)/?$|$1/$2|; + if (-d "../../$2/t") { + $tstdir = "../../$2/t"; + } elsif (-d "$tstdir/t") { + $tstdir = "$tstdir/t"; + } + } else { + die "Could not get PWD from environment\n"; + } + } + } + $tstdir = './t' unless ($tstdir); + opendir(DIR, $tstdir) || die "can't opendir $tstdir: $!"; + while ($file = readdir(DIR)) { + push @dots, "$tstdir/$file" if ($file =~ m/^[^\.]+\.t$/); + } + closedir DIR; +} +my $prog; +my $test; +my @progs; +foreach $test (@dots) { + $prog=`basename $test .t`; + chomp $prog; + if ( -e "$prog" ){ + push @progs, "$test"; + }else{ + print "No binary found for $prog\n"; + } +} + +use Test::Harness; +#$Test::Harness::verbose=1; +runtests(@progs); |