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