]> xenbits.xensource.com Git - osstest.git/commitdiff
hsot reuse: Hash the share type
authorIan Jackson <ian.jackson@eu.citrix.com>
Fri, 21 Aug 2020 10:25:06 +0000 (11:25 +0100)
committerIan Jackson <iwj@xenproject.org>
Wed, 7 Oct 2020 16:52:05 +0000 (17:52 +0100)
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@eu.citrix.com>
README
ts-host-reuse

diff --git a/README b/README
index a929010cba60249681a7dc952d8057c48a8e3fd3..1703e07610fbd15a534218fbb8f9f45f1b7f0e84 100644 (file)
--- 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)
 
index c852a85810701eede0390ddc98ede3abb75d2ff8..701070b283d9355546271014087bc1091e634201 100755 (executable)
@@ -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;
 }