]> xenbits.xensource.com Git - people/iwj/osstest.git/commitdiff
wip reorg fix ether selection
authorIan Jackson <iwj@woking.cam.xci-test.com>
Wed, 17 Oct 2012 14:09:30 +0000 (15:09 +0100)
committerIan Jackson <iwj@woking.cam.xci-test.com>
Wed, 17 Oct 2012 14:09:30 +0000 (15:09 +0100)
Osstest/JobDB/Executive.pm
Osstest/JobDB/Standalone.pm
Osstest/TestSupport.pm

index 6c69cc7d678dbbaa9b5e0209383a21d621cd97aa..83bc40e29c35752ad5dff45d6b3c7e66f49a7362 100644 (file)
@@ -172,4 +172,14 @@ sub jobdb_enable_log_capture ($) { #method
     return 1;
 }
 
+sub jobdb_db_glob ($$) { #method
+    my ($mo, $str) = @_;
+    # $str must be a glob pattern; returns a glob clause
+    # [...] and ? in the glob are not supported
+    # ' and \ may not occur either
+    $str =~ s/\*/%/;
+    $str =~ s/_/\\_/g;
+    return "LIKE E'$str'";
+}
+
 1;
index b1c1d4e42e73666f44069c578bf7802a33ef9027..07bb7d7bdad058cee4b753eb32416a8d30f1849e 100644 (file)
@@ -92,4 +92,9 @@ sub jobdb_enable_log_capture ($) { #method
     return $c{CaptureLogs} || 0;
 }
 
+sub jobdb_db_glob ($) { #method
+    my ($mo,$str) = @_;
+    return "GLOB '$str'";
+}
+
 1;
index 00cc190e1bd3ccd815acd7ed0bd098bda76e8e47..bc76ac0ead1a55c28d2c133b217ec5953a467a21 100644 (file)
@@ -1081,13 +1081,15 @@ sub select_ether ($$) {
        my $prefix = get_host_property($ho, 'gen-ether-prefix-base');
        $prefix =~ m/^(\w+:\w+):(\w+):(\w+)$/ or die "$prefix ?";
        my $lhs = $1;
-       my $pv = (hex($1)<<8) | (hex($2));
+       my $pv = (hex($2)<<8) | (hex($3));
        $pv ^= $mjobdb->gen_ether_offset($ho,$flight);
        $prefix = sprintf "%s:%02x:%02x", $lhs, ($pv>>8)&0xff, $pv&0xff;
 
+       my $glob_ether = $mjobdb->jobdb_db_glob('*_ether');
+
         my $previous= $dbh_tests->selectrow_array(<<END, {}, $flight);
             SELECT max(val) FROM runvars WHERE flight=?
-                AND name LIKE E'%\\_ether'
+                AND name $glob_ether
                 AND val LIKE '$prefix:%'
 END
         if (defined $previous) {
@@ -1106,7 +1108,7 @@ END
 END
         my $chkrow= $dbh_tests->selectrow_hashref(<<END,{}, $flight);
            SELECT val, count(*) FROM runvars WHERE flight=?
-                AND name LIKE E'%\\_ether'
+                AND name $glob_ether
                 AND val LIKE '$prefix:%'
                GROUP BY val
                HAVING count(*) <> 1