* [PATCH 1/2] meta: image: detect broken symlinks
@ 2018-03-09 8:21 Henning Schild
2018-03-09 8:21 ` [PATCH 2/2] scripts: return errors for CI Henning Schild
2018-03-09 8:30 ` [PATCH 1/2] meta: image: detect broken symlinks Henning Schild
0 siblings, 2 replies; 4+ messages in thread
From: Henning Schild @ 2018-03-09 8:21 UTC (permalink / raw)
To: isar-users; +Cc: Henning Schild
Switch get_image_name from os.path.lexists to os.path.exists because the
latter detects broken symlinks correctly. Also support older debian
versions where the symlinks in the rootfs are absolute
Also change scripts/start_vm to handle the case where no initrd is
present.
Issue:
If you build a kernel without CONFIG_BLK_DEV_INITRD the postinst hook will
still call "linux-update-symlinks" and create a broken symlink. After
that os.path.lexists will return True and "sudo cp" in do_copy_boot_files
will fail.
Signed-off-by: Henning Schild <henning.schild@siemens.com>
---
meta/classes/image.bbclass | 4 +++-
scripts/start_vm | 11 +++++++----
2 files changed, 10 insertions(+), 5 deletions(-)
diff --git a/meta/classes/image.bbclass b/meta/classes/image.bbclass
index 2c255f4..6753aed 100644
--- a/meta/classes/image.bbclass
+++ b/meta/classes/image.bbclass
@@ -8,8 +8,10 @@ IMAGE_ROOTFS = "${WORKDIR}/rootfs"
def get_image_name(d, name_link):
S = d.getVar("IMAGE_ROOTFS", True)
path_link = os.path.join(S, name_link)
- if os.path.lexists(path_link):
+ if os.path.exists(path_link):
return os.path.basename(os.path.realpath(path_link))
+ if os.path.islink(path_link):
+ return os.path.basename(os.path.join(S, os.path.realpath(path_link)))
return ""
# These variables are used by wic and start_vm
diff --git a/scripts/start_vm b/scripts/start_vm
index b7b5e17..0d1d554 100755
--- a/scripts/start_vm
+++ b/scripts/start_vm
@@ -25,8 +25,8 @@ qemu-system-$QEMU_ARCH \\\\\n\
-M $QEMU_MACHINE \\\\\n\
$QCPU\\\\\n\
-nographic \\\\\n\
- -kernel \$IMAGE_DIR/$KERNEL_IMAGE \\\\\n\
- -initrd \$IMAGE_DIR/$INITRD_IMAGE \\\\\n\
+ -kernel \$QKERNEL \\\\\n\
+ -initrd \$QINITRD \\\\\n\
-append \"console=$MACHINE_SERIAL root=/dev/$ROOTFS_DEV rw\" \\\\\n\
$EXTRA_ARGS \\\\\n\
$root1"
@@ -38,8 +38,8 @@ qemu-system-$QEMU_ARCH \\\\\n\
-M $QEMU_MACHINE \
$QCPU \
-nographic \
- -kernel $IMAGE_DIR/$KERNEL_IMAGE \
- -initrd $IMAGE_DIR/$INITRD_IMAGE \
+ -kernel $QKERNEL \
+ -initrd $QINITRD \
-append "console=$MACHINE_SERIAL root=/dev/$ROOTFS_DEV rw" \
$EXTRA_ARGS \
$root2
@@ -118,6 +118,9 @@ readonly ROOTFS_IMAGE=isar-image-base-debian-$DISTRO-qemu$ARCH.ext4.img
eval $(bitbake -e multiconfig:qemu$ARCH-$DISTRO:isar-image-base | grep "^KERNEL_IMAGE=")
eval $(bitbake -e multiconfig:qemu$ARCH-$DISTRO:isar-image-base | grep "^INITRD_IMAGE=")
+QKERNEL=$IMAGE_DIR/$KERNEL_IMAGE
+QINITRD=/dev/null
+[ -n "$INITRD_IMAGE" ] && QINITRD=$IMAGE_DIR/$INITRD_IMAGE
readonly ISARROOT="$(dirname "$0")"/..
--
2.16.1
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH 2/2] scripts: return errors for CI
2018-03-09 8:21 [PATCH 1/2] meta: image: detect broken symlinks Henning Schild
@ 2018-03-09 8:21 ` Henning Schild
2018-03-09 8:30 ` Henning Schild
2018-03-09 8:30 ` [PATCH 1/2] meta: image: detect broken symlinks Henning Schild
1 sibling, 1 reply; 4+ messages in thread
From: Henning Schild @ 2018-03-09 8:21 UTC (permalink / raw)
To: isar-users; +Cc: Henning Schild
I received mail from Jenkins looking like that:
> Test: FAIL
...
> Test: FAIL
...
> POST BUILD TASK : SUCCESS
This patch actually collects the number of failing qemus and returns it,
so the caller can react on it.
Signed-off-by: Henning Schild <henning.schild@siemens.com>
---
scripts/vm_smoke_test | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/scripts/vm_smoke_test b/scripts/vm_smoke_test
index 3bcfd5a..f1bd411 100755
--- a/scripts/vm_smoke_test
+++ b/scripts/vm_smoke_test
@@ -6,6 +6,8 @@
CONSOLE_OUTPUT=/tmp/isar_console
PID_FILE=/tmp/qemu.pid
+ret=0
+
check_output() {
str=$(tail -1 $CONSOLE_OUTPUT)
@@ -13,6 +15,7 @@ check_output() {
echo "Test: PASSED"
else
echo "Test: FAIL"
+ ret=`expr $ret + 1`
fi
}
@@ -48,3 +51,5 @@ run_test amd64 stretch
# i386 machine
run_test i386 jessie
run_test i386 stretch
+
+exit $ret
--
2.16.1
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 1/2] meta: image: detect broken symlinks
2018-03-09 8:21 [PATCH 1/2] meta: image: detect broken symlinks Henning Schild
2018-03-09 8:21 ` [PATCH 2/2] scripts: return errors for CI Henning Schild
@ 2018-03-09 8:30 ` Henning Schild
1 sibling, 0 replies; 4+ messages in thread
From: Henning Schild @ 2018-03-09 8:30 UTC (permalink / raw)
To: isar-users
Still wrong ... ignore that one.
Henning
Am Fri, 9 Mar 2018 09:21:27 +0100
schrieb Henning Schild <henning.schild@siemens.com>:
> Switch get_image_name from os.path.lexists to os.path.exists because
> the latter detects broken symlinks correctly. Also support older
> debian versions where the symlinks in the rootfs are absolute
> Also change scripts/start_vm to handle the case where no initrd is
> present.
>
> Issue:
> If you build a kernel without CONFIG_BLK_DEV_INITRD the postinst hook
> will still call "linux-update-symlinks" and create a broken symlink.
> After that os.path.lexists will return True and "sudo cp" in
> do_copy_boot_files will fail.
>
> Signed-off-by: Henning Schild <henning.schild@siemens.com>
> ---
> meta/classes/image.bbclass | 4 +++-
> scripts/start_vm | 11 +++++++----
> 2 files changed, 10 insertions(+), 5 deletions(-)
>
> diff --git a/meta/classes/image.bbclass b/meta/classes/image.bbclass
> index 2c255f4..6753aed 100644
> --- a/meta/classes/image.bbclass
> +++ b/meta/classes/image.bbclass
> @@ -8,8 +8,10 @@ IMAGE_ROOTFS = "${WORKDIR}/rootfs"
> def get_image_name(d, name_link):
> S = d.getVar("IMAGE_ROOTFS", True)
> path_link = os.path.join(S, name_link)
> - if os.path.lexists(path_link):
> + if os.path.exists(path_link):
> return os.path.basename(os.path.realpath(path_link))
> + if os.path.islink(path_link):
> + return os.path.basename(os.path.join(S,
> os.path.realpath(path_link))) return ""
>
> # These variables are used by wic and start_vm
> diff --git a/scripts/start_vm b/scripts/start_vm
> index b7b5e17..0d1d554 100755
> --- a/scripts/start_vm
> +++ b/scripts/start_vm
> @@ -25,8 +25,8 @@ qemu-system-$QEMU_ARCH \\\\\n\
> -M $QEMU_MACHINE \\\\\n\
> $QCPU\\\\\n\
> -nographic \\\\\n\
> - -kernel \$IMAGE_DIR/$KERNEL_IMAGE \\\\\n\
> - -initrd \$IMAGE_DIR/$INITRD_IMAGE \\\\\n\
> + -kernel \$QKERNEL \\\\\n\
> + -initrd \$QINITRD \\\\\n\
> -append \"console=$MACHINE_SERIAL root=/dev/$ROOTFS_DEV rw\"
> \\\\\n\ $EXTRA_ARGS \\\\\n\
> $root1"
> @@ -38,8 +38,8 @@ qemu-system-$QEMU_ARCH \\\\\n\
> -M $QEMU_MACHINE \
> $QCPU \
> -nographic \
> - -kernel $IMAGE_DIR/$KERNEL_IMAGE \
> - -initrd $IMAGE_DIR/$INITRD_IMAGE \
> + -kernel $QKERNEL \
> + -initrd $QINITRD \
> -append "console=$MACHINE_SERIAL root=/dev/$ROOTFS_DEV rw" \
> $EXTRA_ARGS \
> $root2
> @@ -118,6 +118,9 @@ readonly
> ROOTFS_IMAGE=isar-image-base-debian-$DISTRO-qemu$ARCH.ext4.img
> eval $(bitbake -e multiconfig:qemu$ARCH-$DISTRO:isar-image-base |
> grep "^KERNEL_IMAGE=") eval $(bitbake -e
> multiconfig:qemu$ARCH-$DISTRO:isar-image-base | grep
> "^INITRD_IMAGE=") +QKERNEL=$IMAGE_DIR/$KERNEL_IMAGE +QINITRD=/dev/null
> +[ -n "$INITRD_IMAGE" ] && QINITRD=$IMAGE_DIR/$INITRD_IMAGE
>
> readonly ISARROOT="$(dirname "$0")"/..
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 2/2] scripts: return errors for CI
2018-03-09 8:21 ` [PATCH 2/2] scripts: return errors for CI Henning Schild
@ 2018-03-09 8:30 ` Henning Schild
0 siblings, 0 replies; 4+ messages in thread
From: Henning Schild @ 2018-03-09 8:30 UTC (permalink / raw)
To: isar-users
I just saw something similar on the list.
Henning
Am Fri, 9 Mar 2018 09:21:28 +0100
schrieb Henning Schild <henning.schild@siemens.com>:
> I received mail from Jenkins looking like that:
>
> > Test: FAIL
> ...
> > Test: FAIL
> ...
> > POST BUILD TASK : SUCCESS
>
> This patch actually collects the number of failing qemus and returns
> it, so the caller can react on it.
>
> Signed-off-by: Henning Schild <henning.schild@siemens.com>
> ---
> scripts/vm_smoke_test | 5 +++++
> 1 file changed, 5 insertions(+)
>
> diff --git a/scripts/vm_smoke_test b/scripts/vm_smoke_test
> index 3bcfd5a..f1bd411 100755
> --- a/scripts/vm_smoke_test
> +++ b/scripts/vm_smoke_test
> @@ -6,6 +6,8 @@
> CONSOLE_OUTPUT=/tmp/isar_console
> PID_FILE=/tmp/qemu.pid
>
> +ret=0
> +
> check_output() {
> str=$(tail -1 $CONSOLE_OUTPUT)
>
> @@ -13,6 +15,7 @@ check_output() {
> echo "Test: PASSED"
> else
> echo "Test: FAIL"
> + ret=`expr $ret + 1`
> fi
> }
>
> @@ -48,3 +51,5 @@ run_test amd64 stretch
> # i386 machine
> run_test i386 jessie
> run_test i386 stretch
> +
> +exit $ret
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2018-03-09 8:30 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-03-09 8:21 [PATCH 1/2] meta: image: detect broken symlinks Henning Schild
2018-03-09 8:21 ` [PATCH 2/2] scripts: return errors for CI Henning Schild
2018-03-09 8:30 ` Henning Schild
2018-03-09 8:30 ` [PATCH 1/2] meta: image: detect broken symlinks Henning Schild
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox