Revise sample command-line yet again.
[irspy-moved-to-github.git] / bin / irspy.pl
1 #!/usr/bin/perl -w
2
3 # $Id: irspy.pl,v 1.15 2006-10-17 11:50:07 mike Exp $
4 #
5 # Run like this:
6 #       YAZ_LOG=irspy,irspy_task perl -I ../lib irspy.pl -t Quick localhost:3313/IR-Explain---1 bagel.indexdata.dk/gils z3950.loc.gov:7090/Voyager bagel.indexdata.dk:210/marc
7 # Available log-levels are as follows:
8 #       irspy -- high-level application logging
9 #       irspy_debug -- low-level debugging (not very interesting)
10 #       irspy_event -- invocations of ZOOM_event() and individual events
11 #       irspy_unhandled -- unhandled events (not very interesting)
12 #       irspy_test -- adding, queueing and running tests
13 #       irspy_task -- adding, queueing and running tasks
14
15 use strict;
16 use warnings;
17 use Getopt::Std;
18 use ZOOM::IRSpy;
19
20 my %opts;
21 if (!getopts('t:', \%opts) || @ARGV < 1) {
22     print STDERR "\
23 Usage $0: [options] <IRSpy-database> [<target> ...]
24 If no targets are specified, all targets in DB are tested.
25         -t <test>       Run the specified <test> [default: all tests]
26 ";
27     exit 1;
28 }
29
30 my($dbname, @targets) = @ARGV;
31 my $spy = new ZOOM::IRSpy($dbname, "admin", "fruitbat");
32 $spy->targets(@targets) if @targets;
33 $spy->initialise();
34 my $res = $spy->check($opts{t});
35 if ($res == 0) {
36     print "All tests were run\n";
37 } else {
38     print "$res tests were skipped\n";
39 }