diff mbox series

[OSSTEST,01/15] TestSupport: target_var: Refactor to allow for another host case

Message ID 20190426164002.22381-2-ian.jackson@eu.citrix.com (mailing list archive)
State Superseded
Headers show
Series Do armhf kernel builds on amd64 | expand

Commit Message

Ian Jackson April 26, 2019, 4:39 p.m. UTC
Make an explicit list of the prefixes and a loop to walk over them.
No functional change.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
---
 Osstest/TestSupport.pm | 16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)
diff mbox series

Patch

diff --git a/Osstest/TestSupport.pm b/Osstest/TestSupport.pm
index ec867e4f..fcbde0a2 100644
--- a/Osstest/TestSupport.pm
+++ b/Osstest/TestSupport.pm
@@ -2471,10 +2471,18 @@  sub target_var_prefix ($) {
 
 sub target_var ($$) {
     my ($ho,$vn) = @_;
-    my $pfx = target_var_prefix($ho);
-    my $allthing = exists $ho->{Guest} ? "guest" : "host";
-    return $r{ $pfx. $vn } //
-           $r{ "all_${allthing}_${vn}" };
+    my @prefixes;
+    push @prefixes, target_var_prefix($ho);
+    if (exists $ho->{Guest}) {
+	push @prefixes, 'all_guest_';
+    } else {
+	push @prefixes, 'all_host_';
+    }
+    foreach my $prefix (@prefixes) {
+	my $v = $r{ $prefix.$vn };
+	return $v if defined $v;
+    }
+    return undef;
 }
 
 sub target_kernkind_check ($) {