videosite-irssi: prepend config path with "videosite"
[videosite.git] / videosite-test.pl
1 #!/usr/bin/perl -w
2
3 use strict;
4 use Getopt::Long;
5 use File::Spec;
6 use File::Basename;
7 use Module::Load;
8 use Cwd qw(realpath);
9
10 my $debug = 0;
11 my %config = (
12     mode => 'download',
13     getter => 'filegetter',
14 );
15 my $success = 0;
16 my $fail = 0;
17 my $notest = 0;
18
19 push(@INC, dirname(realpath($0)));
20 load 'libvideosite';
21
22 unless(libvideosite::register_api({
23     _debug => sub { return $debug },
24 })) {
25     die("Error registering API: $libvideosite::error");
26 }
27
28 unless(libvideosite::init()) {
29     die("Could not init libvideosite: $libvideosite::error");
30 }
31
32 select(STDOUT);
33 $| = 1;
34 printf("Doing self tests:\n");
35 foreach (libvideosite::_grabbers()) {
36     my $r;
37
38     printf("  %s...", $_->{'NAME'});
39     $r = $_->_selftest();
40     if(defined($r)) {
41         if ($r == 1) {
42             printf(" OK\n");
43             $success++;
44         } else {
45             printf(" no self test\n");
46             $notest++;
47         }
48     } else {
49         $fail++;
50     }
51 }
52
53 printf("\n\n%d succeeded\n%d failed\n%d not testable\n", $success, $fail, $notest);