From: Ian Jackson Date: Fri, 21 Aug 2020 10:25:06 +0000 (+0100) Subject: hsot reuse: Hash the share type X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=4babc3facf978e461345dc163569917c432805b8;p=osstest.git hsot reuse: Hash the share type 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 --- diff --git a/README b/README index a929010..1703e07 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 c852a85..701070b 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; }