Skip to contentSkip to conversation

ts-memdisk-try-append: Add missing -I

PATCH In review Ian Jackson 2 participants 4 messages Mar 10, 2020

lore
Share & tools
lore
#0 lore raw

PATCH 1/3 ts-memdisk-try-append: Add missing -I

This only worked in production by accident (most of the production stuff edits PERLLIB earlier in the invocation sequence).

CC Roger Pau Monné <[email protected]>
---
 ts-memdisk-try-append | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
ts-memdisk-try-append +1 -1
index ce39d5a7..cfc17559 100755
@@ -18,7 +18,7 @@
 
 set -xe -o posix
 
-arch=`perl -e '
+arch=`perl -I. -e '
                 use Osstest;
                 use Osstest::TestSupport;
 
Signature · 7 lines
2.11.0


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
#1 lore raw

PATCH 2/3 ts-memdisk-try-append: Notice when job arch retrieval fails

We currently have a bug where this fails, producing this output:

+ arch=
+ case "$arch" in
+ echo 'Arch not supported for memdisk tests'
Arch not supported for memdisk tests
+ exit 0

It should fail in this case.

CC Roger Pau Monné <[email protected]>
---
 ts-memdisk-try-append | 4 ++++
 1 file changed, 4 insertions(+)
ts-memdisk-try-append +4 -0
index cfc17559..2fe18f45 100755
@@ -29,6 +29,10 @@ arch=`perl -I. -e '
 case "$arch" in
 amd64)
     ;;
+'')
+    echo >&2 'Job arch retrieval failed?'
+    exit 1
+    ;;
 *)
     echo "Arch $arch not supported for memdisk tests"
     exit 0
Signature · 7 lines
2.11.0


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
#2 lore raw

PATCH 3/3 ts-memdisk-try-append: Call selecthost

In reply to Ian Jackson

In 7f49abaa0ff91d6dc1592ea80f10211c52fb03c4
arch replumbing: Replace many $r{arch} with $[g]ho->{Arch}
I accidentally broke this, by not spotting that the perl fragment did not call selecthost and has no $ho.

Fix this as follows:
* Pass all of the -try-append arguments to the perl rune.
* Include a simple replica of the arg parsing of ts-freebsd-host-install (notably, we don't parse options, and instead assume the host comes last).
* Call selecthost.

Compared to the situation prior to 7f49abaa0ff9, we now check that the host is allocated to us, etc., before looking at what arch the job specifies. Additionally, we would now honour host_arch if it were different to arch. (Currently, it isn't.)

CC Roger Pau Monné <[email protected]>
---
 ts-memdisk-try-append | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
ts-memdisk-try-append +6 -1
index 2fe18f45..4b54eff0 100755
@@ -23,8 +23,13 @@ arch=`perl -I. -e '
                 use Osstest::TestSupport;
 
                 tsreadconfig();
+
+		our $whhost = pop @ARGV; # arg parsing bodge
+		$whhost ||= "host";
+		our $ho = selecthost($whhost);
+
                 print $ho->{Arch} or die $!;
-              '`
+              ' "$@"`
 
 case "$arch" in
 amd64)
Signature · 7 lines
2.11.0


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
#3 lore raw
In reply to Ian Jackson
Quoted 5 lines · Ian Jackson

This only worked in production by accident (most of the production stuff edits PERLLIB earlier in the invocation sequence).

CC Roger Pau Monné <[email protected]>

Thanks! All patches LGTM, feel free to add my Acked-by, as I don't think I'm qualified to do a review of perl code.

Roger.

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel