1 #!/usr/bin/perl -w
2 use strict;
4 my $file = '../Cache';
5 unless (-f "$file.pm") {
6 open(CACHE,">$file.pm") or die "Cannot open cache";
7 print CACHE "package Cache;
8 require Exporter;
9 \@ISA=qw(Exporter);
10 \@EXPORT=qw();
11 1;
12 ";
13 close CACHE;
14 }
16 use Helper;
17 my ($tstdir,$spath,$hostname,$httphost,$mailhost,$dnshost,$noserver,$nullhost,$quickcheck);
19 use Getopt::Long;
20 GetOptions
21 ("tstdir:s"=>\$tstdir,
22 "spath:s"=>\$spath,
23 "hostname:s"=>\$hostname,
24 "httpname:s"=>\$httphost,
25 "mailhost:s"=>\$mailhost,
26 "dnshost:s"=>\$dnshost,
27 "noserver:s"=>\$noserver,
28 "nullhost:s"=>\$nullhost,
29 "quickcheck"=>\$quickcheck);
31 $spath = "." unless ($spath);
33 unless ($quickcheck) {
35 $hostname = get_option("hostname","host for FTP/UDP tests") unless ($hostname);
36 $httphost = get_option("httphost","host for HTTP tests") unless ($httphost);
37 $mailhost = get_option("mailhost","host for SMTP/IMAP/POP tests") unless ($mailhost);
38 $dnshost = get_option("dnshost","hostname to lookup for DNS tests") unless ($dnshost);
39 $noserver = get_option("noserver","host that rejects above services") unless ($noserver);
40 # This machine should not be locatable from your network. Use IP
41 # private addresses like 10.x.x.x and pick one that does not exist
42 # on your LAN/WAN
43 $nullhost = get_option("nullhost","nonexistent IP address (e.g., 10.0.0.0)") unless ($nullhost);
44 }
46 my @dots;
47 if (@ARGV) {
48 @dots = @ARGV;
49 } else {
50 unless ($tstdir) {
51 if (-d './t') {
52 $tstdir = './t';
53 } else {
54 $tstdir = $ENV{PWD};
55 $tstdir = `/bin/pwd` unless defined($tstdir);
56 chomp $tstdir;
57 if (defined($tstdir)) {
58 $tstdir =~ s|^(.*)/([^/]+)/?$|$1/$2|;
59 if (-d "../../$2/t") {
60 $tstdir = "../../$2/t";
61 } elsif (-d "$tstdir/t") {
62 $tstdir = "$tstdir/t";
63 }
64 } else {
65 die "Could not get PWD from environment\n";
66 }
67 }
68 }
69 $tstdir = './t' unless ($tstdir);
70 opendir(DIR, $tstdir) || die "can't opendir $tstdir: $!";
71 while ($file = readdir(DIR)) {
72 push @dots, "$tstdir/$file" if ($file =~ m/^[^\.]+\.t$/);
73 }
74 closedir DIR;
75 }
76 my $prog;
77 my $test;
78 my @progs;
79 foreach $test (@dots) {
80 $prog=`basename $test .t`;
81 chomp $prog;
82 if ( -e "$prog" ){
83 push @progs, "$test";
84 }else{
85 print "No binary found for $prog\n";
86 }
87 }
89 use Test::Harness;
90 #$Test::Harness::verbose=1;
91 runtests(@progs);