]> xenbits.xensource.com Git - osstest.git/commitdiff
TestSupport: Provide runvar_is_synth
authorIan Jackson <ian.jackson@eu.citrix.com>
Thu, 20 Aug 2020 20:32:48 +0000 (21:32 +0100)
committerIan Jackson <iwj@xenproject.org>
Wed, 7 Oct 2020 16:48:33 +0000 (17:48 +0100)
Internally we use an array %r_notsynth.  This allows us to avoid
adding code to store_runvar etc.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
Osstest/TestSupport.pm

index 634d6d2e3cfdbef1d98b9a262af56ecb99dcd668..ce13d3a62b50f88c9bb739f8ec8cf14a00a342d7 100644 (file)
@@ -52,7 +52,7 @@ BEGIN {
                       store_runvar get_runvar get_runvar_maybe
                       get_runvar_default need_runvars
                       unique_incrementing_runvar next_unique_name
-                      stashfilecontents
+                      stashfilecontents runvar_is_synth
 
                       target_cmd_root_status target_cmd_output_root_status
                       target_cmd_root target_cmd target_cmd_build
@@ -147,7 +147,7 @@ BEGIN {
     @EXPORT_OK   = qw();
 }
 
-our (%r,$flight,$job,$stash);
+our (%r,$flight,$job,$stash,%r_,%r_notsynth);
 
 our %timeout= qw(RebootDown   100
                  RebootUp     400
@@ -178,12 +178,13 @@ sub tsreadconfig () {
         logm("starting $flight.$job");
 
         my $q= $dbh_tests->prepare(<<END);
-            SELECT name, val FROM runvars WHERE flight=? AND job=?
+            SELECT name, val, synth FROM runvars WHERE flight=? AND job=?
 END
         $q->execute($flight, $job);
         my $row;
         while ($row= $q->fetchrow_hashref()) {
             $r{ $row->{name} }= $row->{val};
+           $r_notsynth{ $row->{name} }= !$row->{synth};
             logm("setting $row->{name}=$row->{val}");
         }
         $q->finish();
@@ -434,6 +435,11 @@ END
     return $value;
 }
 
+sub runvar_is_synth ($) {
+    my ($key) = @_;
+    return !$r_notsynth{$key};
+}
+
 sub target_adjust_timeout ($$) {
     my ($ho,$timeoutref) = @_; # $ho might be a $gho
     my $nestinglvl = $ho->{NestingLevel} // $ho->{Host}{NestingLevel};