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

[OSSTEST PATCH 64/82] hsot reuse: Hash the share type



From: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>

We don't really want to duplicate (triplicate, actually) lots of the
runvars.  This will make the runvars table needlessly bloated.

So hash the values.

Signed-off-by: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
---
 README        |  2 +-
 ts-host-reuse | 11 +++++++----
 2 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/README b/README
index a929010c..1703e076 100644
--- a/README
+++ b/README
@@ -297,7 +297,7 @@ To run osstest in standalone mode:
      curl
      netcat
      chiark-utils-bin
-     libxml-libxml-perl libfile-fnmatch-perl
+     libxml-libxml-perl libfile-fnmatch-perl libdigest-sha-perl
      dctrl-tools
      libnet-snmp-perl (if you are going to use Masterswitch PDUs)
 
diff --git a/ts-host-reuse b/ts-host-reuse
index c852a858..701070b2 100755
--- a/ts-host-reuse
+++ b/ts-host-reuse
@@ -43,6 +43,7 @@ use DBI;
 BEGIN { unshift @INC, qw(.); }
 use Osstest;
 use POSIX;
+use Digest::SHA qw(sha224_base64);
 use Osstest::TestSupport;
 
 tsreadconfig();
@@ -64,16 +65,18 @@ sub sharetype_add ($$) {
 }
 
 sub compute_test_sharetype () {
-    $sharetype = "test-$flight";
+    my @runvartexts;
     my %done;
     foreach my $key (runvar_glob(@accessible_runvar_pats)) {
        next if runvar_is_synth($key);
        my $val = $r{$key};
        next if $done{$key}++;
-       $val =~ s{[^\"-\~]|\%}{ sprintf "%%%02x", ord $& }ge;
-       $sharetype .= "!$key=$r{$key}";
+       $val =~ s{[^\!-\~]|\%}{ sprintf "%%%02x", ord $& }ge;
+       push @runvartexts, "$key=$r{$key}";
     }
-
+    my $digest = sha224_base64("@runvartexts");
+    $sharetype = "test-$flight-$digest";
+    logm "share type $sharetype; hash is of: @runvartexts";
     return $sharetype;
 }
 
-- 
2.20.1




 


Rackspace

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