fix quoting in AsyncWgetFileGetter again
[videosite.git] / videosite-test.pl
index bfea2f2..422a9fc 100755 (executable)
@@ -6,6 +6,9 @@ use File::Spec;
 use File::Basename;
 use Module::Load;
 use Cwd qw(realpath);
+use Carp;
+
+$SIG{ __DIE__ } = sub { Carp::confess( @_ ) };
 
 my $debug = 0;
 my %config = (
@@ -16,6 +19,8 @@ my $success = 0;
 my $fail = 0;
 my $notest = 0;
 
+GetOptions("d" => \$debug);
+
 push(@INC, dirname(realpath($0)));
 load 'libvideosite';
 
@@ -32,11 +37,23 @@ unless(libvideosite::init()) {
 select(STDOUT);
 $| = 1;
 printf("Doing self tests:\n");
-foreach (libvideosite::_grabbers()) {
+foreach my $g (libvideosite::_grabbers()) {
     my $r;
 
-    printf("  %s...", $_->{'NAME'});
-    $r = $_->_selftest();
+    if (@ARGV) {
+        my $found;
+
+        # If there are grabber names given on the command line check
+        # the current name against that list and skip if not present
+        $found = grep { $_ eq $g->{'NAME'} } @ARGV;
+
+        if ($found == 0) {
+            next;
+        }
+    }
+
+    printf("  %s...", $g->{'NAME'});
+    $r = $g->_selftest();
     if(defined($r)) {
         if ($r == 1) {
             printf(" OK\n");