summaryrefslogtreecommitdiffstats
path: root/test.pl.in
diff options
context:
space:
mode:
Diffstat (limited to 'test.pl.in')
-rwxr-xr-xtest.pl.in87
1 files changed, 87 insertions, 0 deletions
diff --git a/test.pl.in b/test.pl.in
new file mode 100755
index 0000000..0b895a3
--- /dev/null
+++ b/test.pl.in
@@ -0,0 +1,87 @@
1#!/usr/bin/perl -w
2use strict;
3
4my $file = '../Cache';
5unless (-f "$file.pm") {
6 open(CACHE,">$file.pm") or die "Cannot open cache";
7 print CACHE "package Cache;
8require Exporter;
9\@ISA=qw(Exporter);
10\@EXPORT=qw();
111;
12";
13 close CACHE;
14}
15
16use Helper;
17my ($tstdir,$spath,$hostname,$mailhost,$noserver,$nullhost,$quickcheck);
18
19use Getopt::Long;
20GetOptions
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
31unless ($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
42my @dots;
43if (@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}
72my $prog;
73my $test;
74my @progs;
75foreach $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
85use Test::Harness;
86#$Test::Harness::verbose=1;
87runtests(@progs);