added -s(leep) option
authorAleš Křenek <ljocha@ics.muni.cz>
Sat, 8 Sep 2007 16:44:31 +0000 (16:44 +0000)
committerAleš Křenek <ljocha@ics.muni.cz>
Sat, 8 Sep 2007 16:44:31 +0000 (16:44 +0000)
org.glite.lb.client/examples/purge_test

index c9f05c1..edd23e2 100644 (file)
@@ -1,5 +1,7 @@
 #!/usr/bin/perl 
 
+use Getopt::Std;
+
 
 
 BEGIN{
@@ -14,6 +16,8 @@ $log = "$test/glite-lb-job_log";
 $prefix = "/tmp/purge_test_$$";
 $delay = 60;
 
+getopts 's:';
+
 $ENV{PATH} .= ":$bin";
 }
 
@@ -29,14 +33,14 @@ die qq{
 Don't run it unless you are absolutely sure what you are doing.
 If you really mean it, the magic usage is:
 
-   $0 --i-want-to-purge server:port
+   $0 [-s sleep] i-want-to-purge server:port
 
 Good luck!
 
 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
        
-} unless $option eq '--i-want-to-purge';
+} unless $option eq 'i-want-to-purge';
 
 die "usage: $0 --i-want-to-purge server:port\n" unless $server;
 
@@ -53,11 +57,14 @@ sub logit {
                $id =~ s/EDG_JOBID=//;
                $ids->{$key} = $id;
 #print "$status $id | head -1\n";
+               sleep $opt_s;
                $stat = `$status $id | head -2 | tail -1`;
                chomp $stat;
                $stat =~ s/state :\s*//;
-#print "$id: ".uc($stat)." ".uc($_)."\n";
-               $failed = 1 if uc($stat) ne uc($_);
+               if (uc($stat) ne uc($_)) {
+                       $failed = 1;
+                       print STDERR "FAIL: $id: ".uc($stat)." ".uc($_)."\n";
+               }
 
                system "$log $id | grep -v '^[  ]*\$' | grep -v '^Found' >${prefix}_$_";
        }