[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [OSSTEST PATCH 03/11] truncation: Support globs, and multiple patterns



Rename the variable to truncate_testids.  It contains glob patterns as
for Tcl `string match', space-separated.

Adjust the two places which set it: cs-bisection-step (which needs to
quote any special characters) and mg-repro-setup (which does not
really process the value, but ought to be able to cope with
space-separated lists.

Signed-off-by: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
---
 cs-bisection-step |  4 +++-
 mg-repro-setup    |  2 +-
 sg-run-job        | 15 +++++++++------
 3 files changed, 13 insertions(+), 8 deletions(-)

diff --git a/cs-bisection-step b/cs-bisection-step
index 162e068..76f5010 100755
--- a/cs-bisection-step
+++ b/cs-bisection-step
@@ -1312,7 +1312,9 @@ END
             $hostspec =~ m/=/;
             $addvar->execute($popflight, $job, $`, $'); # '
         }
-       $addvar->execute($popflight, $job, 'truncate_testid', $testid);
+        my $testid_glob = $testid;
+        $testid_glob =~ s/[]\\*?[]/\\$&/g;
+       $addvar->execute($popflight, $job, 'truncate_testids', $testid_glob);
     });
 }
 
diff --git a/mg-repro-setup b/mg-repro-setup
index 5a64b1a..bb429b4 100755
--- a/mg-repro-setup
+++ b/mg-repro-setup
@@ -186,7 +186,7 @@ fi
 
 progress "setting up flight ..."
 
-adjrunvar truncate_testid $testid
+adjrunvar truncate_testids "$testid"
 
 ./cs-adjust-flight $flight                                             \
        copy-jobs $example_flight $job                                  \
diff --git a/sg-run-job b/sg-run-job
index 104c880..cc24b73 100755
--- a/sg-run-job
+++ b/sg-run-job
@@ -41,14 +41,14 @@ proc per-host-finish {} {
 
 proc run-job {job} {
     global jobinfo builds flight ok truncate need_xen_hosts anyfailed
-    global nested_layers_hosts truncate_at
+    global nested_layers_hosts truncate_globs
 
     set ok 1
     set truncate 0
     set anyfailed 0
     jobdb::prepare $job
 
-    set truncate_at [jobdb::read-runvar $flight $job truncate_testid]
+    set truncate_globs [jobdb::read-runvar $flight $job truncate_testids]
 
     set nh [need-hosts/$jobinfo(recipe)]
     if {![string compare $nh BUILD]} {
@@ -244,7 +244,7 @@ proc spawn-ts {iffail testid args} {
 }
 
 proc reap-ts {reap} {
-    global truncate truncate_at
+    global truncate truncate_globs
 
     switch -exact [lindex $reap 0] {
         imm { return [lindex $reap 1] }
@@ -266,9 +266,12 @@ proc reap-ts {reap} {
 
     eval jobdb::step-set-status [lrange $details 0 2] $result
     jobdb::logputs stdout "finished $detstr $result $emsg"
-    if {![string compare $testid $truncate_at]} {
-        jobdb::logputs stdout "truncating job now as instructed"
-        set truncate 1
+    foreach truncate_glob [split $truncate_globs] {
+        if {[string match $truncate_glob $testid]} {
+            jobdb::logputs stdout "truncating job now as instructed"
+            set truncate 1
+            break
+        }
     }
     return [expr {![string compare $result pass]}]
 }
-- 
2.1.4


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
https://lists.xen.org/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.