3 # $Id: irspy.pl,v 1.27 2007-04-18 15:32:32 mike Exp $
6 # YAZ_LOG=irspy,irspy_test IRSPY_SAVE_XML=1 perl -I../lib irspy.pl -t Quick localhost:8018/IR-Explain---1 z3950.loc.gov:7090/Voyager bagel.indexdata.dk/gils bagel.indexdata.dk:210/marc
7 # YAZ_LOG=irspy,irspy_test sudo ./setrlimit -n 3000 -u mike -- perl -I../lib irspy.pl -t Main -a localhost:8018/IR-Explain---1
8 # YAZ_LOG=irspy,irspy_test perl -I../lib irspy.pl -t Main -a -n 100 localhost:8018/IR-Explain---1
10 # Available log-levels are as follows:
11 # irspy -- high-level application logging
12 # irspy_debug -- low-level debugging (not very interesting)
13 # irspy_event -- invocations of ZOOM_event() and individual events
14 # irspy_unhandled -- unhandled events (not very interesting)
15 # irspy_test -- adding, queueing and running tests
16 # irspy_task -- adding, queueing and running tasks
18 # I have no idea why this directory is not in Ubuntu's default Perl
19 # path, but we need it because just occasionally overload.pm:88
20 # requires Scalar::Util, which is in this directory.
22 use lib '/usr/share/perl/5.8.7';
37 if (!getopts('wt:af:n:', \%opts) || @ARGV < 1) {
39 Usage $0: [options] <IRSpy-database> [<target> ...]
40 -w Use ZOOM::IRSpy::Web subclass
41 -t <test> Run the specified <test> [default: all tests]
42 -a Test all targets (slow!)
43 -f <query> Test targets found by the specified query
44 -n <number> Number of connection to keep in active set
49 my($dbname, @targets) = @ARGV;
50 my $class = "ZOOM::IRSpy";
51 $class .= "::Web" if $opts{w};
53 my $spy = $class->new($dbname, "admin", "fruitbat", $opts{n});
55 $spy->targets(@targets);
57 $spy->find_targets($opts{f});
59 print STDERR "$0: specify -a, -f <query> or list of targets\n";
63 $spy->initialise($opts{t});
64 my $res = $spy->check();
66 print "All tests were attempted\n";
68 print "$res tests were skipped\n";
72 # Fake the HTML::Mason class that ZOOM::IRSpy::Web uses
73 package HTML::Mason::Commands;
74 BEGIN { our $m = bless {}, "HTML::Mason::Commands" }
75 sub flush_buffer { print shift(), " flushing\n" if 0 }