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

[OSSTEST PATCH 63/82] test host reuse: Switch to principled sharing scope runvar scheme



From: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>

* When selecthost is passed an @host ident, indicating prep work,
  engage restricted runvar access.  If no call to sharing_for_build
  was made, this means it can access only the runvars in
  the default value of @accessible_runvar_pats.

* Make the sharetype for host reuse be based on the values of
  precisely those same runvars, rather than using an adhoc scheme.

The set of covered runvars is bigger now as a result of testing...

Signed-off-by: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
---
 Osstest/TestSupport.pm | 23 ++++++++++++++++++++++-
 ts-host-reuse          | 20 ++++++++------------
 2 files changed, 30 insertions(+), 13 deletions(-)

diff --git a/Osstest/TestSupport.pm b/Osstest/TestSupport.pm
index 752c36c5..28381f05 100644
--- a/Osstest/TestSupport.pm
+++ b/Osstest/TestSupport.pm
@@ -162,7 +162,22 @@ our $logm_prefix= '';
 
 # When runvar_access_restrict is called, it will limit reading
 # of non-synth runvars to ones which match these glob patterns.
-our @accessible_runvar_pats = qw(test-host-setup-runvars-will-appear-here);
+# The initial list is the runvars whih affect how a test host is
+# set up, and for test jobs it isn't modified.  synth runvars
+# which are read-modify-write by host setup must be listed too.
+our @accessible_runvar_pats =
+  qw(
+      *_dmrestrict *buildjob
+      arch console di_version dom0_mem enable_xsm freebsd_distpath
+      linux_boot_append os suite toolstack xen_boot_append xenable_xsm
+      host                           *_host 
+      host_console                   *_host_console
+      host_hostflagadjust            *_host_hostflagadjust
+      host_hostflags                 *_host_hostflags
+      host_linux_boot_append         *_host_linux_boot_append
+      host_ip                        *_host_ip
+      host_power_install             *_host_power_install
+   );
 
 #---------- test script startup ----------
 
@@ -1274,6 +1289,12 @@ sub selecthost ($;$$) {
        return $child;
     }
 
+    #----- if we're sharing an actual host, make sure we do it right -----
+
+    if ($isprep) {
+       runvar_access_restrict();
+    }
+
     #----- calculation of the host's properties -----
 
     # Firstly, hardcoded defaults
diff --git a/ts-host-reuse b/ts-host-reuse
index 29abe987..c852a858 100755
--- a/ts-host-reuse
+++ b/ts-host-reuse
@@ -64,18 +64,14 @@ sub sharetype_add ($$) {
 }
 
 sub compute_test_sharetype () {
-    $sharetype =
-       "test-$flight/$r{arch}/$r{xenbuildjob}/$r{kernbuildjob}/$r{buildjob}";
-
-    sharetype_add('suite', $ho->{Suite});
-    sharetype_add('di', $ho->{DiVersion});
-
-    foreach my $runvar (qw(freebsd_distpath freebsdbuildjob
-                          xenable_xsm toolstack kernkind
-                          xen_boot_append toolstack)) {
-       my $val = $r{$runvar};
-       die "$runvar $val ?" if defined $val && $val =~ m{[,/\%\\]};
-       sharetype_add($runvar, $val);
+    $sharetype = "test-$flight";
+    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}";
     }
 
     return $sharetype;
-- 
2.20.1




 


Rackspace

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