videosite-test: Allow selective tests by using grabber names on the command line
authorRalf Ertzinger <ralf@skytale.net>
Tue, 30 Apr 2013 18:58:47 +0000 (20:58 +0200)
committerRalf Ertzinger <ralf@skytale.net>
Tue, 30 Apr 2013 18:58:47 +0000 (20:58 +0200)
videosite-test.pl

index bfea2f2..0d9e771 100755 (executable)
@@ -32,11 +32,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");