All of lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH v5 0/5] gitlab Qemu runtime testing
@ 2020-02-17 20:50 Romain Naour
  2020-02-17 20:50 ` [Buildroot] [PATCH v5 1/5] board/qemu: add defconfig file name as tag after the qemu command line Romain Naour
                   ` (6 more replies)
  0 siblings, 7 replies; 13+ messages in thread
From: Romain Naour @ 2020-02-17 20:50 UTC (permalink / raw)
  To: buildroot

This new iteration take into account the previous review with
some additional rework [1] [2] [5] [6].

Remove patch already merged.

Based on the Yann's review during the Buildroot Developper meeting
FOSDEM 2020 [2], add a tag in each readme file to easily retrieve
the qemu command line to be used for runtime testing in gitlab.

This tag is used by a post-image script to generate a script
called start-qemu.sh that can be used by users or by a new python
script for running the test in gitlab but only when a Qemu
defconfig is built.

Finally add this new python script to .gitlab-ci.yml.

This series has been tested on Gitlab [3], please ignore the
failing test related to missing host-python3 modules needed by
optee-os package [4].

This new iteration has been tested in gitlab [7].

[1] http://lists.busybox.net/pipermail/buildroot/2019-May/249432.html
[2] http://lists.busybox.net/pipermail/buildroot/2020-February/273189.html
[3] https://gitlab.com/kubu93/buildroot/pipelines/116298701
[4] http://lists.busybox.net/pipermail/buildroot/2020-February/273738.html
[5] http://lists.busybox.net/pipermail/buildroot/2020-February/273820.html
[6] http://lists.busybox.net/pipermail/buildroot/2020-February/273822.html
[7] https://gitlab.com/kubu93/buildroot/pipelines/116967006

Cc: Yann E. MORIN <yann.morin.1998@free.fr>
Jugurtha BELKALEM (2):
  support/scripts/boot-qemu-image.py: boot Qemu images with Qemu-system.
  gitlab.yml.in*: enable Qemu gitlab testing

Romain Naour (3):
  board/qemu: add defconfig file name as tag after the qemu command line
  board/qemu: add post-image script for gitlab qemu testing
  configs/qemu*: use the post-image script with "$(BR2_DEFCONFIG)" as
    argument.

 .gitlab-ci.yml                             |   7 ++
 .gitlab-ci.yml.in                          |   7 ++
 board/qemu/aarch64-virt/readme.txt         |   2 +-
 board/qemu/arm-versatile/readme.txt        |   4 +-
 board/qemu/arm-vexpress/readme.txt         |   2 +-
 board/qemu/csky/readme.txt                 |  11 ++-
 board/qemu/m68k-mcf5208/readme.txt         |   2 +-
 board/qemu/m68k-q800/readme.txt            |   2 +-
 board/qemu/microblazebe-mmu/readme.txt     |   2 +-
 board/qemu/microblazeel-mmu/readme.txt     |   2 +-
 board/qemu/mips32r2-malta/readme.txt       |   2 +-
 board/qemu/mips32r2el-malta/readme.txt     |   2 +-
 board/qemu/mips32r6-malta/readme.txt       |   2 +-
 board/qemu/mips32r6el-malta/readme.txt     |   2 +-
 board/qemu/mips64-malta/readme.txt         |   2 +-
 board/qemu/mips64el-malta/readme.txt       |   2 +-
 board/qemu/mips64r6-malta/readme.txt       |   2 +-
 board/qemu/mips64r6el-malta/readme.txt     |   2 +-
 board/qemu/nios2-10m50/readme.txt          |   2 +-
 board/qemu/or1k/readme.txt                 |   2 +-
 board/qemu/post-image.sh                   |  50 ++++++++++
 board/qemu/ppc-g3beige/readme.txt          |   2 +-
 board/qemu/ppc-mac99/readme.txt            |   2 +-
 board/qemu/ppc-mpc8544ds/readme.txt        |   2 +-
 board/qemu/ppc-virtex-ml507/readme.txt     |   2 +-
 board/qemu/ppc64-e5500/readme.txt          |   2 +-
 board/qemu/ppc64-pseries/readme.txt        |   2 +-
 board/qemu/ppc64le-pseries/readme.txt      |   2 +-
 board/qemu/riscv32-virt/readme.txt         |   2 +-
 board/qemu/riscv64-virt/readme.txt         |   2 +-
 board/qemu/sh4-r2d/readme.txt              |   2 +-
 board/qemu/sh4eb-r2d/readme.txt            |   2 +-
 board/qemu/sparc-ss10/readme.txt           |   2 +-
 board/qemu/sparc64-sun4u/readme.txt        |   2 +-
 board/qemu/x86/readme.txt                  |   2 +-
 board/qemu/x86_64/readme.txt               |   2 +-
 board/qemu/xtensa-lx60/readme.txt          |   4 +-
 configs/qemu_aarch64_virt_defconfig        |   4 +
 configs/qemu_arm_versatile_defconfig       |   4 +
 configs/qemu_arm_versatile_nommu_defconfig |   4 +
 configs/qemu_arm_vexpress_defconfig        |   4 +
 configs/qemu_csky610_virt_defconfig        |   4 +
 configs/qemu_csky807_virt_defconfig        |   4 +
 configs/qemu_csky810_virt_defconfig        |   4 +
 configs/qemu_csky860_virt_defconfig        |   4 +
 configs/qemu_m68k_mcf5208_defconfig        |   4 +
 configs/qemu_m68k_q800_defconfig           |   4 +
 configs/qemu_microblazebe_mmu_defconfig    |   4 +
 configs/qemu_microblazeel_mmu_defconfig    |   4 +
 configs/qemu_mips32r2_malta_defconfig      |   4 +
 configs/qemu_mips32r2el_malta_defconfig    |   4 +
 configs/qemu_mips32r6_malta_defconfig      |   4 +
 configs/qemu_mips32r6el_malta_defconfig    |   4 +
 configs/qemu_mips64_malta_defconfig        |   4 +
 configs/qemu_mips64el_malta_defconfig      |   4 +
 configs/qemu_mips64r6_malta_defconfig      |   4 +
 configs/qemu_mips64r6el_malta_defconfig    |   4 +
 configs/qemu_nios2_10m50_defconfig         |   4 +
 configs/qemu_or1k_defconfig                |   4 +
 configs/qemu_ppc64_e5500_defconfig         |   4 +
 configs/qemu_ppc64_pseries_defconfig       |   4 +
 configs/qemu_ppc64le_pseries_defconfig     |   4 +
 configs/qemu_ppc_g3beige_defconfig         |   4 +
 configs/qemu_ppc_mac99_defconfig           |   4 +
 configs/qemu_ppc_mpc8544ds_defconfig       |   4 +
 configs/qemu_ppc_virtex_ml507_defconfig    |   4 +
 configs/qemu_riscv32_virt_defconfig        |   4 +
 configs/qemu_riscv64_virt_defconfig        |   4 +
 configs/qemu_sh4_r2d_defconfig             |   4 +
 configs/qemu_sh4eb_r2d_defconfig           |   4 +
 configs/qemu_sparc64_sun4u_defconfig       |   4 +
 configs/qemu_sparc_ss10_defconfig          |   4 +
 configs/qemu_x86_64_defconfig              |   4 +
 configs/qemu_x86_defconfig                 |   4 +
 configs/qemu_xtensa_lx60_defconfig         |   4 +
 configs/qemu_xtensa_lx60_nommu_defconfig   |   4 +
 support/scripts/boot-qemu-image.py         | 105 +++++++++++++++++++++
 77 files changed, 368 insertions(+), 38 deletions(-)
 create mode 100755 board/qemu/post-image.sh
 create mode 100755 support/scripts/boot-qemu-image.py

-- 
2.24.1

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Buildroot] [PATCH v5 1/5] board/qemu: add defconfig file name as tag after the qemu command line
  2020-02-17 20:50 [Buildroot] [PATCH v5 0/5] gitlab Qemu runtime testing Romain Naour
@ 2020-02-17 20:50 ` Romain Naour
  2020-02-17 20:50 ` [Buildroot] [PATCH v5 2/5] board/qemu: add post-image script for gitlab qemu testing Romain Naour
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 13+ messages in thread
From: Romain Naour @ 2020-02-17 20:50 UTC (permalink / raw)
  To: buildroot

This commit add the name of the Qemu defconfig file after each
qemu command line in order to retrieve it easily.

Since a readme.txt can be shared between several Qemu defconfig, we
need at least one qemu command line in readme.txt for each defconfig.

For now, ignore the qemu_arm_vexpress_tz_defconfig since it fail to build
due to python script issue [1]. Anyway the arm vexpress boot is tested
with qemu_arm_vexpress_defconfig.

[1] http://lists.busybox.net/pipermail/buildroot/2020-February/273738.html

Signed-off-by: Romain Naour <romain.naour@smile.fr>
---
v5: add the tag in a comment after the command line [2] (ThomasP)
[1] http://lists.busybox.net/pipermail/buildroot/2020-February/273189.html
[2] http://lists.busybox.net/pipermail/buildroot/2020-February/273820.html
---
 board/qemu/aarch64-virt/readme.txt     |  2 +-
 board/qemu/arm-versatile/readme.txt    |  4 ++--
 board/qemu/arm-vexpress/readme.txt     |  2 +-
 board/qemu/csky/readme.txt             | 11 +++++++----
 board/qemu/m68k-mcf5208/readme.txt     |  2 +-
 board/qemu/m68k-q800/readme.txt        |  2 +-
 board/qemu/microblazebe-mmu/readme.txt |  2 +-
 board/qemu/microblazeel-mmu/readme.txt |  2 +-
 board/qemu/mips32r2-malta/readme.txt   |  2 +-
 board/qemu/mips32r2el-malta/readme.txt |  2 +-
 board/qemu/mips32r6-malta/readme.txt   |  2 +-
 board/qemu/mips32r6el-malta/readme.txt |  2 +-
 board/qemu/mips64-malta/readme.txt     |  2 +-
 board/qemu/mips64el-malta/readme.txt   |  2 +-
 board/qemu/mips64r6-malta/readme.txt   |  2 +-
 board/qemu/mips64r6el-malta/readme.txt |  2 +-
 board/qemu/nios2-10m50/readme.txt      |  2 +-
 board/qemu/or1k/readme.txt             |  2 +-
 board/qemu/ppc-g3beige/readme.txt      |  2 +-
 board/qemu/ppc-mac99/readme.txt        |  2 +-
 board/qemu/ppc-mpc8544ds/readme.txt    |  2 +-
 board/qemu/ppc-virtex-ml507/readme.txt |  2 +-
 board/qemu/ppc64-e5500/readme.txt      |  2 +-
 board/qemu/ppc64-pseries/readme.txt    |  2 +-
 board/qemu/ppc64le-pseries/readme.txt  |  2 +-
 board/qemu/riscv32-virt/readme.txt     |  2 +-
 board/qemu/riscv64-virt/readme.txt     |  2 +-
 board/qemu/sh4-r2d/readme.txt          |  2 +-
 board/qemu/sh4eb-r2d/readme.txt        |  2 +-
 board/qemu/sparc-ss10/readme.txt       |  2 +-
 board/qemu/sparc64-sun4u/readme.txt    |  2 +-
 board/qemu/x86/readme.txt              |  2 +-
 board/qemu/x86_64/readme.txt           |  2 +-
 board/qemu/xtensa-lx60/readme.txt      |  4 +++-
 34 files changed, 43 insertions(+), 38 deletions(-)

diff --git a/board/qemu/aarch64-virt/readme.txt b/board/qemu/aarch64-virt/readme.txt
index f868905d91..f12bed4e06 100644
--- a/board/qemu/aarch64-virt/readme.txt
+++ b/board/qemu/aarch64-virt/readme.txt
@@ -1,6 +1,6 @@
 Run the emulation with:
 
-  qemu-system-aarch64 -M virt -cpu cortex-a53 -nographic -smp 1 -kernel output/images/Image -append "rootwait root=/dev/vda console=ttyAMA0" -netdev user,id=eth0 -device virtio-net-device,netdev=eth0 -drive file=output/images/rootfs.ext4,if=none,format=raw,id=hd0 -device virtio-blk-device,drive=hd0
+  qemu-system-aarch64 -M virt -cpu cortex-a53 -nographic -smp 1 -kernel output/images/Image -append "rootwait root=/dev/vda console=ttyAMA0" -netdev user,id=eth0 -device virtio-net-device,netdev=eth0 -drive file=output/images/rootfs.ext4,if=none,format=raw,id=hd0 -device virtio-blk-device,drive=hd0 # qemu_aarch64_virt_defconfig
 
 The login prompt will appear in the terminal that started Qemu.
 
diff --git a/board/qemu/arm-versatile/readme.txt b/board/qemu/arm-versatile/readme.txt
index f3a9e1ab47..97331b2f03 100644
--- a/board/qemu/arm-versatile/readme.txt
+++ b/board/qemu/arm-versatile/readme.txt
@@ -1,10 +1,10 @@
 Run the emulation with:
 
-  qemu-system-arm -M versatilepb -kernel output/images/zImage -dtb output/images/versatile-pb.dtb -drive file=output/images/rootfs.ext2,if=scsi,format=raw -append "rootwait root=/dev/sda console=ttyAMA0,115200" -serial stdio -net nic,model=rtl8139 -net user
+  qemu-system-arm -M versatilepb -kernel output/images/zImage -dtb output/images/versatile-pb.dtb -drive file=output/images/rootfs.ext2,if=scsi,format=raw -append "rootwait root=/dev/sda console=ttyAMA0,115200" -serial stdio -net nic,model=rtl8139 -net user # qemu_arm_versatile_defconfig
 
 Or for the noMMU emulation:
 
-  qemu-system-arm -M versatilepb -kernel output/images/zImage -dtb output/images/versatile-pb.dtb -append "console=ttyAMA0,115200" -serial stdio -net user -net nic,model=smc91c111
+  qemu-system-arm -M versatilepb -kernel output/images/zImage -dtb output/images/versatile-pb.dtb -append "console=ttyAMA0,115200" -serial stdio -net user -net nic,model=smc91c111 # qemu_arm_versatile_nommu_defconfig
 
 The login prompt will appear in the terminal that started Qemu. The
 graphical window is the framebuffer.
diff --git a/board/qemu/arm-vexpress/readme.txt b/board/qemu/arm-vexpress/readme.txt
index 7f7b43a3b3..ff7790744f 100644
--- a/board/qemu/arm-vexpress/readme.txt
+++ b/board/qemu/arm-vexpress/readme.txt
@@ -1,6 +1,6 @@
 Run the emulation with:
 
-  qemu-system-arm -M vexpress-a9 -smp 1 -m 256 -kernel output/images/zImage -dtb output/images/vexpress-v2p-ca9.dtb -drive file=output/images/rootfs.ext2,if=sd,format=raw -append "console=ttyAMA0,115200 rootwait root=/dev/mmcblk0" -serial stdio -net nic,model=lan9118 -net user
+  qemu-system-arm -M vexpress-a9 -smp 1 -m 256 -kernel output/images/zImage -dtb output/images/vexpress-v2p-ca9.dtb -drive file=output/images/rootfs.ext2,if=sd,format=raw -append "console=ttyAMA0,115200 rootwait root=/dev/mmcblk0" -serial stdio -net nic,model=lan9118 -net user # qemu_arm_vexpress_defconfig
 
 The login prompt will appear in the terminal that started Qemu. The
 graphical window is the framebuffer.
diff --git a/board/qemu/csky/readme.txt b/board/qemu/csky/readme.txt
index 89d68aafb8..5e4cb1871c 100644
--- a/board/qemu/csky/readme.txt
+++ b/board/qemu/csky/readme.txt
@@ -1,12 +1,15 @@
 Run with qemu:
 
 For ck860 smp:
- qemu-system-cskyv2 -M virt -cpu ck860 -smp 2 -nographic -kernel vmlinux
+ qemu-system-cskyv2 -M virt -cpu ck860 -smp 2 -nographic -kernel vmlinux # qemu_csky860_virt_defconfig
 
-For ck810/ck807:
- qemu-system-cskyv2 -M virt -nographic -kernel vmlinux
+For ck807:
+ qemu-system-cskyv2 -M virt -nographic -kernel vmlinux # qemu_csky807_virt_defconfig
+
+For ck810:
+ qemu-system-cskyv2 -M virt -nographic -kernel vmlinux # qemu_csky810_virt_defconfig
 
 For ck610:
- qemu-system-cskyv1 -M virt -nographic -kernel vmlinux
+ qemu-system-cskyv1 -M virt -nographic -kernel vmlinux # qemu_csky610_virt_defconfig
 
 The login prompt will appear in the terminal that started Qemu. Username is root and no password.
diff --git a/board/qemu/m68k-mcf5208/readme.txt b/board/qemu/m68k-mcf5208/readme.txt
index d1c9086805..76dce0ab94 100644
--- a/board/qemu/m68k-mcf5208/readme.txt
+++ b/board/qemu/m68k-mcf5208/readme.txt
@@ -1,6 +1,6 @@
 Run the emulation with:
 
- qemu-system-m68k -M mcf5208evb -cpu m5208 -kernel output/images/vmlinux -nographic
+ qemu-system-m68k -M mcf5208evb -cpu m5208 -kernel output/images/vmlinux -nographic # qemu_m68k_mcf5208_defconfig
 
 The login prompt will appear in the terminal that started Qemu.
 
diff --git a/board/qemu/m68k-q800/readme.txt b/board/qemu/m68k-q800/readme.txt
index b516bacdff..4ed328507a 100644
--- a/board/qemu/m68k-q800/readme.txt
+++ b/board/qemu/m68k-q800/readme.txt
@@ -1,6 +1,6 @@
 Run the emulation with:
 
- qemu-system-m68k -M q800 -kernel output/images/vmlinux -nographic -drive file=output/images/rootfs.ext2,format=raw -append "rootwait root=/dev/sda console=ttyS0"
+ qemu-system-m68k -M q800 -kernel output/images/vmlinux -nographic -drive file=output/images/rootfs.ext2,format=raw -append "rootwait root=/dev/sda console=ttyS0" # qemu_m68k_q800_defconfig
 
 The login prompt will appear in the terminal that started Qemu.
 
diff --git a/board/qemu/microblazebe-mmu/readme.txt b/board/qemu/microblazebe-mmu/readme.txt
index 4f52baff1f..3d5064cbd3 100644
--- a/board/qemu/microblazebe-mmu/readme.txt
+++ b/board/qemu/microblazebe-mmu/readme.txt
@@ -1,6 +1,6 @@
 Run the emulation with:
 
- qemu-system-microblaze -M petalogix-s3adsp1800 -kernel output/images/linux.bin -serial stdio
+ qemu-system-microblaze -M petalogix-s3adsp1800 -kernel output/images/linux.bin -serial stdio # qemu_microblazebe_mmu_defconfig
 
 The login prompt will appear in the terminal that started Qemu.
 
diff --git a/board/qemu/microblazeel-mmu/readme.txt b/board/qemu/microblazeel-mmu/readme.txt
index 0b0f330a5e..c9f94f8de5 100644
--- a/board/qemu/microblazeel-mmu/readme.txt
+++ b/board/qemu/microblazeel-mmu/readme.txt
@@ -1,6 +1,6 @@
 Run the emulation with:
 
- qemu-system-microblazeel -M petalogix-s3adsp1800 -kernel output/images/linux.bin -serial stdio
+ qemu-system-microblazeel -M petalogix-s3adsp1800 -kernel output/images/linux.bin -serial stdio # qemu_microblazeel_mmu_defconfig
 
 The login prompt will appear in the terminal that started Qemu.
 
diff --git a/board/qemu/mips32r2-malta/readme.txt b/board/qemu/mips32r2-malta/readme.txt
index 9ff3c4b810..0fb8e47999 100644
--- a/board/qemu/mips32r2-malta/readme.txt
+++ b/board/qemu/mips32r2-malta/readme.txt
@@ -1,6 +1,6 @@
 Run the emulation with:
 
- qemu-system-mips -M malta -kernel output/images/vmlinux -serial stdio -drive file=output/images/rootfs.ext2,format=raw -append "rootwait root=/dev/hda" -net nic,model=pcnet -net user
+ qemu-system-mips -M malta -kernel output/images/vmlinux -serial stdio -drive file=output/images/rootfs.ext2,format=raw -append "rootwait root=/dev/hda" -net nic,model=pcnet -net user # qemu_mips32r2_malta_defconfig
 
 The login prompt will appear in the terminal that started Qemu. The
 graphical window is the framebuffer. No keyboard support has been
diff --git a/board/qemu/mips32r2el-malta/readme.txt b/board/qemu/mips32r2el-malta/readme.txt
index 745bfea608..1613757657 100644
--- a/board/qemu/mips32r2el-malta/readme.txt
+++ b/board/qemu/mips32r2el-malta/readme.txt
@@ -1,6 +1,6 @@
 Run the emulation with:
 
- qemu-system-mipsel -M malta -kernel output/images/vmlinux -serial stdio -drive file=output/images/rootfs.ext2,format=raw -append "rootwait root=/dev/hda" -net nic,model=pcnet -net user
+ qemu-system-mipsel -M malta -kernel output/images/vmlinux -serial stdio -drive file=output/images/rootfs.ext2,format=raw -append "rootwait root=/dev/hda" -net nic,model=pcnet -net user # qemu_mips32r2el_malta_defconfig
 
 The login prompt will appear in the terminal that started Qemu. The
 graphical window is the framebuffer. No keyboard support has been
diff --git a/board/qemu/mips32r6-malta/readme.txt b/board/qemu/mips32r6-malta/readme.txt
index 6a026b2165..21854a7f90 100644
--- a/board/qemu/mips32r6-malta/readme.txt
+++ b/board/qemu/mips32r6-malta/readme.txt
@@ -1,6 +1,6 @@
 Run the emulation with:
 
-qemu-system-mips -M malta -cpu mips32r6-generic -kernel output/images/vmlinux -drive file=output/images/rootfs.ext2,format=raw -append "rootwait root=/dev/hda" -nographic
+ qemu-system-mips -M malta -cpu mips32r6-generic -kernel output/images/vmlinux -drive file=output/images/rootfs.ext2,format=raw -append "rootwait root=/dev/hda" -nographic # qemu_mips32r6_malta_defconfig
 
 The login prompt will appear in the terminal that started Qemu.
 
diff --git a/board/qemu/mips32r6el-malta/readme.txt b/board/qemu/mips32r6el-malta/readme.txt
index f69fd21af1..d1bd3de7fa 100644
--- a/board/qemu/mips32r6el-malta/readme.txt
+++ b/board/qemu/mips32r6el-malta/readme.txt
@@ -1,6 +1,6 @@
 Run the emulation with:
 
-qemu-system-mipsel -M malta -cpu mips32r6-generic -kernel output/images/vmlinux -drive file=output/images/rootfs.ext2,format=raw -append "rootwait root=/dev/hda" -net nic,model=pcnet -net user -nographic
+ qemu-system-mipsel -M malta -cpu mips32r6-generic -kernel output/images/vmlinux -drive file=output/images/rootfs.ext2,format=raw -append "rootwait root=/dev/hda" -net nic,model=pcnet -net user -nographic # qemu_mips32r6el_malta_defconfig
 
 The login prompt will appear in the terminal that started Qemu.
 
diff --git a/board/qemu/mips64-malta/readme.txt b/board/qemu/mips64-malta/readme.txt
index ea3a92541e..6a411d23d2 100644
--- a/board/qemu/mips64-malta/readme.txt
+++ b/board/qemu/mips64-malta/readme.txt
@@ -1,6 +1,6 @@
 Run the emulation with:
 
- qemu-system-mips64 -M malta -kernel output/images/vmlinux -serial stdio -drive file=output/images/rootfs.ext2,format=raw -append "rootwait root=/dev/hda"
+ qemu-system-mips64 -M malta -kernel output/images/vmlinux -serial stdio -drive file=output/images/rootfs.ext2,format=raw -append "rootwait root=/dev/hda" # qemu_mips64_malta_defconfig
 
 The login prompt will appear in the terminal that started Qemu. The
 graphical window is the framebuffer.
diff --git a/board/qemu/mips64el-malta/readme.txt b/board/qemu/mips64el-malta/readme.txt
index 144da93839..d7dea160ff 100644
--- a/board/qemu/mips64el-malta/readme.txt
+++ b/board/qemu/mips64el-malta/readme.txt
@@ -1,6 +1,6 @@
 Run the emulation with:
 
- qemu-system-mips64el -M malta -kernel output/images/vmlinux -serial stdio -drive file=output/images/rootfs.ext2,format=raw -append "rootwait root=/dev/hda"
+ qemu-system-mips64el -M malta -kernel output/images/vmlinux -serial stdio -drive file=output/images/rootfs.ext2,format=raw -append "rootwait root=/dev/hda" # qemu_mips64el_malta_defconfig
 
 The login prompt will appear in the terminal that started Qemu. The
 graphical window is the framebuffer.
diff --git a/board/qemu/mips64r6-malta/readme.txt b/board/qemu/mips64r6-malta/readme.txt
index cfa16fd863..a5637b763c 100644
--- a/board/qemu/mips64r6-malta/readme.txt
+++ b/board/qemu/mips64r6-malta/readme.txt
@@ -1,6 +1,6 @@
 Run the emulation with:
 
- qemu-system-mips64 -M malta -cpu I6400 -kernel output/images/vmlinux -drive file=output/images/rootfs.ext2,format=raw -append "rootwait root=/dev/hda" -nographic
+ qemu-system-mips64 -M malta -cpu I6400 -kernel output/images/vmlinux -drive file=output/images/rootfs.ext2,format=raw -append "rootwait root=/dev/hda" -nographic # qemu_mips64r6_malta_defconfig
 
 The login prompt will appear in the terminal that started Qemu.
 
diff --git a/board/qemu/mips64r6el-malta/readme.txt b/board/qemu/mips64r6el-malta/readme.txt
index 61a6ceb5f4..48ed0ff6fb 100644
--- a/board/qemu/mips64r6el-malta/readme.txt
+++ b/board/qemu/mips64r6el-malta/readme.txt
@@ -1,6 +1,6 @@
 Run the emulation with:
 
- qemu-system-mips64el -M malta -cpu I6400 -kernel output/images/vmlinux -drive file=output/images/rootfs.ext2,format=raw -append "rootwait root=/dev/hda" -nographic
+ qemu-system-mips64el -M malta -cpu I6400 -kernel output/images/vmlinux -drive file=output/images/rootfs.ext2,format=raw -append "rootwait root=/dev/hda" -nographic # qemu_mips64r6el_malta_defconfig
 
 The login prompt will appear in the terminal that started Qemu.
 
diff --git a/board/qemu/nios2-10m50/readme.txt b/board/qemu/nios2-10m50/readme.txt
index 44cbcb08a2..d240891873 100644
--- a/board/qemu/nios2-10m50/readme.txt
+++ b/board/qemu/nios2-10m50/readme.txt
@@ -1,6 +1,6 @@
 Run the emulation with:
 
-  qemu-system-nios2 -kernel output/images/vmlinux -nographic
+  qemu-system-nios2 -kernel output/images/vmlinux -nographic # qemu_nios2_10m50_defconfig
 
 The login prompt will appear in the terminal that started Qemu.
 
diff --git a/board/qemu/or1k/readme.txt b/board/qemu/or1k/readme.txt
index df6b467e82..72c9e3c3cf 100644
--- a/board/qemu/or1k/readme.txt
+++ b/board/qemu/or1k/readme.txt
@@ -1,6 +1,6 @@
 Run the emulation with:
 
- qemu-system-or1k -kernel output/images/vmlinux -nographic
+ qemu-system-or1k -kernel output/images/vmlinux -nographic # qemu_or1k_defconfig
 
 The login prompt will appear in the terminal that started Qemu.
 
diff --git a/board/qemu/ppc-g3beige/readme.txt b/board/qemu/ppc-g3beige/readme.txt
index 608814ee3b..40021f0a17 100644
--- a/board/qemu/ppc-g3beige/readme.txt
+++ b/board/qemu/ppc-g3beige/readme.txt
@@ -1,6 +1,6 @@
 Run the emulation with:
 
-  qemu-system-ppc -M g3beige -kernel output/images/vmlinux -drive file=output/images/rootfs.ext2,format=raw -append "console=ttyS0 rootwait root=/dev/hda" -serial stdio -net nic,model=rtl8139 -net user
+  qemu-system-ppc -M g3beige -kernel output/images/vmlinux -drive file=output/images/rootfs.ext2,format=raw -append "console=ttyS0 rootwait root=/dev/hda" -serial stdio -net nic,model=rtl8139 -net user # qemu_ppc_g3beige_defconfig
 
 The login prompt will appear in the terminal that started Qemu. The
 graphical window is the framebuffer.
diff --git a/board/qemu/ppc-mac99/readme.txt b/board/qemu/ppc-mac99/readme.txt
index a8a18db5b9..f1b722bdb8 100644
--- a/board/qemu/ppc-mac99/readme.txt
+++ b/board/qemu/ppc-mac99/readme.txt
@@ -1,5 +1,5 @@
 Run the emulation with:
 
-  qemu-system-ppc -nographic -vga none -M mac99 -cpu g4 -m 1G -kernel output/images/vmlinux -drive file=output/images/rootfs.ext2,format=raw -net nic,model=sungem -net user -append "root=/dev/sda"
+  qemu-system-ppc -nographic -vga none -M mac99 -cpu g4 -m 1G -kernel output/images/vmlinux -drive file=output/images/rootfs.ext2,format=raw -net nic,model=sungem -net user -append "root=/dev/sda" # qemu_ppc_mac99_defconfig
 
 Tested with QEMU 3.1.0
diff --git a/board/qemu/ppc-mpc8544ds/readme.txt b/board/qemu/ppc-mpc8544ds/readme.txt
index 172aad5626..32be8a9290 100644
--- a/board/qemu/ppc-mpc8544ds/readme.txt
+++ b/board/qemu/ppc-mpc8544ds/readme.txt
@@ -1,6 +1,6 @@
 Run the emulation with:
 
- qemu-system-ppc -M mpc8544ds -kernel output/images/vmlinux -serial stdio -net nic,model=e1000 -net user
+ qemu-system-ppc -M mpc8544ds -kernel output/images/vmlinux -serial stdio -net nic,model=e1000 -net user # qemu_ppc_mpc8544ds_defconfig
 
 The login prompt will appear in the terminal that started Qemu.
 
diff --git a/board/qemu/ppc-virtex-ml507/readme.txt b/board/qemu/ppc-virtex-ml507/readme.txt
index 6178ace816..567ba7e6a7 100644
--- a/board/qemu/ppc-virtex-ml507/readme.txt
+++ b/board/qemu/ppc-virtex-ml507/readme.txt
@@ -1,6 +1,6 @@
 Run the emulation with:
 
- qemu-system-ppc -M virtex-ml507 -kernel output/images/vmlinux -m 256 -nographic -append "console=ttyS0" -dtb output/images/virtex440-ml507.dtb
+ qemu-system-ppc -M virtex-ml507 -kernel output/images/vmlinux -m 256 -nographic -append "console=ttyS0" -dtb output/images/virtex440-ml507.dtb # qemu_ppc_virtex_ml507_defconfig
 
 The login prompt will appear in the terminal that started Qemu.
 
diff --git a/board/qemu/ppc64-e5500/readme.txt b/board/qemu/ppc64-e5500/readme.txt
index 8080766984..74b7c32820 100644
--- a/board/qemu/ppc64-e5500/readme.txt
+++ b/board/qemu/ppc64-e5500/readme.txt
@@ -1,6 +1,6 @@
 Run the emulation with:
 
- qemu-system-ppc64 -M ppce500 -cpu e5500 -m 256 -kernel output/images/uImage -drive file=output/images/rootfs.ext2,if=virtio,format=raw -append "console=ttyS0 rootwait root=/dev/vda" -serial mon:stdio -nographic
+ qemu-system-ppc64 -M ppce500 -cpu e5500 -m 256 -kernel output/images/uImage -drive file=output/images/rootfs.ext2,if=virtio,format=raw -append "console=ttyS0 rootwait root=/dev/vda" -serial mon:stdio -nographic # qemu_ppc64_e5500_defconfig
 
 The login prompt will appear in the terminal that started Qemu.
 
diff --git a/board/qemu/ppc64-pseries/readme.txt b/board/qemu/ppc64-pseries/readme.txt
index 6a3e96a2e5..cf82edacc5 100644
--- a/board/qemu/ppc64-pseries/readme.txt
+++ b/board/qemu/ppc64-pseries/readme.txt
@@ -1,6 +1,6 @@
 Run the emulation with:
 
- qemu-system-ppc64 -M pseries -cpu POWER7 -m 256 -kernel output/images/vmlinux -append "console=hvc0 rootwait root=/dev/sda" -drive file=output/images/rootfs.ext2,if=scsi,index=0,format=raw -serial stdio -display curses
+ qemu-system-ppc64 -M pseries -cpu POWER7 -m 256 -kernel output/images/vmlinux -append "console=hvc0 rootwait root=/dev/sda" -drive file=output/images/rootfs.ext2,if=scsi,index=0,format=raw -serial stdio -display curses # qemu_ppc64_pseries_defconfig
 
 The login prompt will appear in the terminal that started Qemu.
 
diff --git a/board/qemu/ppc64le-pseries/readme.txt b/board/qemu/ppc64le-pseries/readme.txt
index 2728675df2..00a38e9fc1 100644
--- a/board/qemu/ppc64le-pseries/readme.txt
+++ b/board/qemu/ppc64le-pseries/readme.txt
@@ -1,6 +1,6 @@
 Run the emulation with:
 
-qemu-system-ppc64 -M pseries -cpu POWER8 -m 256 -kernel output/images/vmlinux -append "console=hvc0 rootwait root=/dev/sda" -drive file=output/images/rootfs.ext2,if=scsi,index=0,format=raw -serial stdio -display curses
+qemu-system-ppc64 -M pseries -cpu POWER8 -m 256 -kernel output/images/vmlinux -append "console=hvc0 rootwait root=/dev/sda" -drive file=output/images/rootfs.ext2,if=scsi,index=0,format=raw -serial stdio -display curses # qemu_ppc64le_pseries_defconfig
 
 The login prompt will appear in the terminal window.
 
diff --git a/board/qemu/riscv32-virt/readme.txt b/board/qemu/riscv32-virt/readme.txt
index 5d7c1988d2..98028a980f 100644
--- a/board/qemu/riscv32-virt/readme.txt
+++ b/board/qemu/riscv32-virt/readme.txt
@@ -1,6 +1,6 @@
 Run Linux in emulation with:
 
-  qemu-system-riscv32 -M virt -kernel output/images/fw_jump.elf -device loader,file=output/images/Image,addr=0x80400000 -append "rootwait root=/dev/vda ro" -drive file=output/images/rootfs.ext2,format=raw,id=hd0 -device virtio-blk-device,drive=hd0 -netdev user,id=net0 -device virtio-net-device,netdev=net0 -nographic
+  qemu-system-riscv32 -M virt -kernel output/images/fw_jump.elf -device loader,file=output/images/Image,addr=0x80400000 -append "rootwait root=/dev/vda ro" -drive file=output/images/rootfs.ext2,format=raw,id=hd0 -device virtio-blk-device,drive=hd0 -netdev user,id=net0 -device virtio-net-device,netdev=net0 -nographic # qemu_riscv32_virt_defconfig
 
 The login prompt will appear in the terminal that started Qemu.
 
diff --git a/board/qemu/riscv64-virt/readme.txt b/board/qemu/riscv64-virt/readme.txt
index c075cc464d..4b05784549 100644
--- a/board/qemu/riscv64-virt/readme.txt
+++ b/board/qemu/riscv64-virt/readme.txt
@@ -1,6 +1,6 @@
 Run Linux in emulation with:
 
-  qemu-system-riscv64 -M virt -kernel output/images/fw_jump.elf -device loader,file=output/images/Image,addr=0x80200000 -append "rootwait root=/dev/vda ro" -drive file=output/images/rootfs.ext2,format=raw,id=hd0 -device virtio-blk-device,drive=hd0 -netdev user,id=net0 -device virtio-net-device,netdev=net0 -nographic
+  qemu-system-riscv64 -M virt -kernel output/images/fw_jump.elf -device loader,file=output/images/Image,addr=0x80200000 -append "rootwait root=/dev/vda ro" -drive file=output/images/rootfs.ext2,format=raw,id=hd0 -device virtio-blk-device,drive=hd0 -netdev user,id=net0 -device virtio-net-device,netdev=net0 -nographic # qemu_riscv64_virt_defconfig
 
 The login prompt will appear in the terminal that started Qemu.
 
diff --git a/board/qemu/sh4-r2d/readme.txt b/board/qemu/sh4-r2d/readme.txt
index dd80953b97..f5364fdfec 100644
--- a/board/qemu/sh4-r2d/readme.txt
+++ b/board/qemu/sh4-r2d/readme.txt
@@ -1,6 +1,6 @@
 Run the emulation with:
 
-  qemu-system-sh4 -M r2d -kernel output/images/zImage -drive file=output/images/rootfs.ext2,if=ide,format=raw -append "rootwait root=/dev/sda console=ttySC1,115200 noiotrap" -serial null -serial stdio -net nic,model=rtl8139 -net user
+  qemu-system-sh4 -M r2d -kernel output/images/zImage -drive file=output/images/rootfs.ext2,if=ide,format=raw -append "rootwait root=/dev/sda console=ttySC1,115200 noiotrap" -serial null -serial stdio -net nic,model=rtl8139 -net user # qemu_sh4_r2d_defconfig
 
 The login prompt will appear in the terminal that started Qemu.
 The graphical window is the framebuffer.
diff --git a/board/qemu/sh4eb-r2d/readme.txt b/board/qemu/sh4eb-r2d/readme.txt
index e71a9bce90..8a3373481a 100644
--- a/board/qemu/sh4eb-r2d/readme.txt
+++ b/board/qemu/sh4eb-r2d/readme.txt
@@ -1,6 +1,6 @@
 Run the emulation with:
 
-  qemu-system-sh4eb -M r2d -kernel output/images/zImage -drive file=output/images/rootfs.ext2,if=ide,format=raw -append "rootwait root=/dev/sda console=ttySC1,115200 noiotrap" -serial null -serial stdio -net nic,model=rtl8139 -net user
+  qemu-system-sh4eb -M r2d -kernel output/images/zImage -drive file=output/images/rootfs.ext2,if=ide,format=raw -append "rootwait root=/dev/sda console=ttySC1,115200 noiotrap" -serial null -serial stdio -net nic,model=rtl8139 -net user # qemu_sh4eb_r2d_defconfig
 
 The login prompt will appear in the terminal that started Qemu.
 The graphical window is the framebuffer.
diff --git a/board/qemu/sparc-ss10/readme.txt b/board/qemu/sparc-ss10/readme.txt
index 33833c2d33..e317ccdae5 100644
--- a/board/qemu/sparc-ss10/readme.txt
+++ b/board/qemu/sparc-ss10/readme.txt
@@ -1,6 +1,6 @@
 Run the emulation with:
 
-  qemu-system-sparc -M SS-10 -kernel output/images/zImage -drive file=output/images/rootfs.ext2,format=raw -append "rootwait root=/dev/sda console=ttyS0,115200" -serial stdio -net nic,model=lance -net user
+  qemu-system-sparc -M SS-10 -kernel output/images/zImage -drive file=output/images/rootfs.ext2,format=raw -append "rootwait root=/dev/sda console=ttyS0,115200" -serial stdio -net nic,model=lance -net user # qemu_sparc_ss10_defconfig
 
 The login prompt will appear in the terminal that started Qemu.
 
diff --git a/board/qemu/sparc64-sun4u/readme.txt b/board/qemu/sparc64-sun4u/readme.txt
index f2e6e81a86..439ecbf312 100644
--- a/board/qemu/sparc64-sun4u/readme.txt
+++ b/board/qemu/sparc64-sun4u/readme.txt
@@ -1,6 +1,6 @@
 Run the emulation with:
 
-  qemu-system-sparc64 -M sun4u -kernel output/images/vmlinux -append "rootwait root=/dev/sda console=ttyS0,115200" -serial stdio -drive file=output/images/rootfs.ext2,format=raw -net nic,model=e1000 -net user
+  qemu-system-sparc64 -M sun4u -kernel output/images/vmlinux -append "rootwait root=/dev/sda console=ttyS0,115200" -serial stdio -drive file=output/images/rootfs.ext2,format=raw -net nic,model=e1000 -net user # qemu_sparc64_sun4u_defconfig
 
 The login prompt will appear in the terminal that started Qemu.
 
diff --git a/board/qemu/x86/readme.txt b/board/qemu/x86/readme.txt
index 3bbafecf91..951bf11a68 100644
--- a/board/qemu/x86/readme.txt
+++ b/board/qemu/x86/readme.txt
@@ -1,6 +1,6 @@
 Run the emulation with:
 
-  qemu-system-i386 -M pc -kernel output/images/bzImage -drive file=output/images/rootfs.ext2,if=virtio,format=raw -append "rootwait root=/dev/vda console=tty1 console=ttyS0" -serial stdio -net nic,model=virtio -net user
+  qemu-system-i386 -M pc -kernel output/images/bzImage -drive file=output/images/rootfs.ext2,if=virtio,format=raw -append "rootwait root=/dev/vda console=tty1 console=ttyS0" -serial stdio -net nic,model=virtio -net user # qemu_x86_defconfig
 
 Optionally add -smp N to emulate a SMP system with N CPUs.
 
diff --git a/board/qemu/x86_64/readme.txt b/board/qemu/x86_64/readme.txt
index 93ac22a947..8b8efa7e8c 100644
--- a/board/qemu/x86_64/readme.txt
+++ b/board/qemu/x86_64/readme.txt
@@ -1,6 +1,6 @@
 Run the emulation with:
 
-  qemu-system-x86_64 -M pc -kernel output/images/bzImage -drive file=output/images/rootfs.ext2,if=virtio,format=raw -append "rootwait root=/dev/vda console=tty1 console=ttyS0" -serial stdio -net nic,model=virtio -net user
+  qemu-system-x86_64 -M pc -kernel output/images/bzImage -drive file=output/images/rootfs.ext2,if=virtio,format=raw -append "rootwait root=/dev/vda console=tty1 console=ttyS0" -serial stdio -net nic,model=virtio -net user # qemu_x86_64_defconfig
 
 Optionally add -smp N to emulate a SMP system with N CPUs.
 
diff --git a/board/qemu/xtensa-lx60/readme.txt b/board/qemu/xtensa-lx60/readme.txt
index 4287e1f09e..54355564d4 100644
--- a/board/qemu/xtensa-lx60/readme.txt
+++ b/board/qemu/xtensa-lx60/readme.txt
@@ -1,6 +1,8 @@
 Run the emulation with:
 
- qemu-system-xtensa -M lx60 -cpu dc233c -monitor null -nographic -kernel output/images/Image.elf
+ qemu-system-xtensa -M lx60 -cpu dc233c -monitor null -nographic -kernel output/images/Image.elf # qemu_xtensa_lx60_defconfig
+
+ qemu-system-xtensa -M lx60 -cpu dc233c -monitor null -nographic -kernel output/images/Image.elf # qemu_xtensa_lx60_nommu_defconfig
 
 The login prompt will appear in the terminal that started Qemu.
 
-- 
2.24.1

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [Buildroot] [PATCH v5 2/5] board/qemu: add post-image script for gitlab qemu testing
  2020-02-17 20:50 [Buildroot] [PATCH v5 0/5] gitlab Qemu runtime testing Romain Naour
  2020-02-17 20:50 ` [Buildroot] [PATCH v5 1/5] board/qemu: add defconfig file name as tag after the qemu command line Romain Naour
@ 2020-02-17 20:50 ` Romain Naour
  2020-04-13  7:25   ` Yann E. MORIN
  2020-02-17 20:50 ` [Buildroot] [PATCH v5 3/5] configs/qemu*: use the post-image script with "$(BR2_DEFCONFIG)" as argument Romain Naour
                   ` (4 subsequent siblings)
  6 siblings, 1 reply; 13+ messages in thread
From: Romain Naour @ 2020-02-17 20:50 UTC (permalink / raw)
  To: buildroot

This commit add a post-image script to be used by each qemu
board defconfig in order to generate start-qemu.sh in BINARIES_DIR.
The start-qemu.sh script can be used by Buildroot user to start
Qemu or by a gitlab CI.
start-qemu.sh is not started automatically at the end of the build.

To find the correct qemu command line, we use the second post
script argument which must contain "$(BR2_DEFCONFIG)"

  BR2_ROOTFS_POST_SCRIPT_ARGS="$(BR2_DEFCONFIG)"

The post-image script expect something like
"/path/to/qemu_aarch64_virt_defconfig" in BR2_DEFCONFIG.

Doing a basename allow to retrieve the name of the defconfig
file that should match on on the "tag" previously introduced in
readme.txt files.

The script start-qemu.sh is able to modify the qemu command
line if CI_JOB_NAME defined in the environment. This allow
to disable the graphical output and redirect serial I/Os to
console.

Only sh4/sh4eb needs a special handling by adding
"-serial stdio -display none" instead of "-display none".

Signed-off-by: Romain Naour <romain.naour@smile.fr>
---
v5: update the script after Thomas's review [1] [2]

[1] http://lists.busybox.net/pipermail/buildroot/2020-February/273820.html
[2] http://lists.busybox.net/pipermail/buildroot/2020-February/273822.html
---
 board/qemu/post-image.sh | 50 ++++++++++++++++++++++++++++++++++++++++
 1 file changed, 50 insertions(+)
 create mode 100755 board/qemu/post-image.sh

diff --git a/board/qemu/post-image.sh b/board/qemu/post-image.sh
new file mode 100755
index 0000000000..804c5f6110
--- /dev/null
+++ b/board/qemu/post-image.sh
@@ -0,0 +1,50 @@
+#!/bin/bash
+
+QEMU_BOARD_DIR="$(dirname $0)"
+DEFCONFIG_NAME="$(basename $2)"
+README_FILES="${QEMU_BOARD_DIR}/*/readme.txt"
+START_QEMU_SCRIPT="${BINARIES_DIR}/start-qemu.sh"
+
+if [[ "${DEFCONFIG_NAME}" =~ ^"qemu_*" ]]; then
+    # Not a Qemu defconfig, can't test.
+    exit 0
+fi
+
+# Search for "# qemu_*_defconfig" tag in all readme.txt files.
+# Qemu command line on multilines using back slash are accepted.
+QEMU_CMD_LINE=$(sed -r ':a; /\\$/N; s/\\\n//; s/\t/ /; ta; /# '${DEFCONFIG_NAME}'$/!d; s/#.*//' ${README_FILES})
+
+if [ -z "$QEMU_CMD_LINE" ]; then
+    # No Qemu cmd line found, can't test.
+    exit 0
+fi
+
+# Replace output/images path by ${IMAGE_DIR} since the script
+# will be in the same directory as the kernel and the rootfs images.
+QEMU_CMD_LINE=${QEMU_CMD_LINE//output\/images/\${IMAGE_DIR\}}
+
+# Test if we are running in gitlab
+if [ -n "$CI_JOB_NAME" ]; then
+    # Remove -serial stdio if present
+    QEMU_CMD_LINE=${QEMU_CMD_LINE//-serial stdio/}
+
+    # Disable graphical output and redirect serial I/Os to console
+    case ${DEFCONFIG_NAME} in
+        # Special case for SH4
+        qemu_sh4eb_r2d_defconfig | qemu_sh4_r2d_defconfig)
+            QEMU_CMD_LINE="$QEMU_CMD_LINE -serial stdio -display none"
+            ;;
+        *)
+            QEMU_CMD_LINE="$QEMU_CMD_LINE -nographic"
+            ;;
+    esac
+fi
+
+cat << EOF > $START_QEMU_SCRIPT
+#!/bin/sh
+IMAGE_DIR="\$(dirname \$0)"
+
+$QEMU_CMD_LINE
+EOF
+
+chmod +x $START_QEMU_SCRIPT
-- 
2.24.1

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [Buildroot] [PATCH v5 3/5] configs/qemu*: use the post-image script with "$(BR2_DEFCONFIG)" as argument.
  2020-02-17 20:50 [Buildroot] [PATCH v5 0/5] gitlab Qemu runtime testing Romain Naour
  2020-02-17 20:50 ` [Buildroot] [PATCH v5 1/5] board/qemu: add defconfig file name as tag after the qemu command line Romain Naour
  2020-02-17 20:50 ` [Buildroot] [PATCH v5 2/5] board/qemu: add post-image script for gitlab qemu testing Romain Naour
@ 2020-02-17 20:50 ` Romain Naour
  2020-02-17 20:50 ` [Buildroot] [PATCH v5 4/5] support/scripts/boot-qemu-image.py: boot Qemu images with Qemu-system Romain Naour
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 13+ messages in thread
From: Romain Naour @ 2020-02-17 20:50 UTC (permalink / raw)
  To: buildroot

This commit allow to use the post-image script previously added
for each qemu board.

Add "$(BR2_DEFCONFIG)" as post-image script argument to retried
the qemu command line.

Signed-off-by: Romain Naour <romain.naour@smile.fr>
---
v5: remove qem_arm_vexpress_tz_deconfig change since this
defconfig doesn't build.
---
 configs/qemu_aarch64_virt_defconfig        | 4 ++++
 configs/qemu_arm_versatile_defconfig       | 4 ++++
 configs/qemu_arm_versatile_nommu_defconfig | 4 ++++
 configs/qemu_arm_vexpress_defconfig        | 4 ++++
 configs/qemu_csky610_virt_defconfig        | 4 ++++
 configs/qemu_csky807_virt_defconfig        | 4 ++++
 configs/qemu_csky810_virt_defconfig        | 4 ++++
 configs/qemu_csky860_virt_defconfig        | 4 ++++
 configs/qemu_m68k_mcf5208_defconfig        | 4 ++++
 configs/qemu_m68k_q800_defconfig           | 4 ++++
 configs/qemu_microblazebe_mmu_defconfig    | 4 ++++
 configs/qemu_microblazeel_mmu_defconfig    | 4 ++++
 configs/qemu_mips32r2_malta_defconfig      | 4 ++++
 configs/qemu_mips32r2el_malta_defconfig    | 4 ++++
 configs/qemu_mips32r6_malta_defconfig      | 4 ++++
 configs/qemu_mips32r6el_malta_defconfig    | 4 ++++
 configs/qemu_mips64_malta_defconfig        | 4 ++++
 configs/qemu_mips64el_malta_defconfig      | 4 ++++
 configs/qemu_mips64r6_malta_defconfig      | 4 ++++
 configs/qemu_mips64r6el_malta_defconfig    | 4 ++++
 configs/qemu_nios2_10m50_defconfig         | 4 ++++
 configs/qemu_or1k_defconfig                | 4 ++++
 configs/qemu_ppc64_e5500_defconfig         | 4 ++++
 configs/qemu_ppc64_pseries_defconfig       | 4 ++++
 configs/qemu_ppc64le_pseries_defconfig     | 4 ++++
 configs/qemu_ppc_g3beige_defconfig         | 4 ++++
 configs/qemu_ppc_mac99_defconfig           | 4 ++++
 configs/qemu_ppc_mpc8544ds_defconfig       | 4 ++++
 configs/qemu_ppc_virtex_ml507_defconfig    | 4 ++++
 configs/qemu_riscv32_virt_defconfig        | 4 ++++
 configs/qemu_riscv64_virt_defconfig        | 4 ++++
 configs/qemu_sh4_r2d_defconfig             | 4 ++++
 configs/qemu_sh4eb_r2d_defconfig           | 4 ++++
 configs/qemu_sparc64_sun4u_defconfig       | 4 ++++
 configs/qemu_sparc_ss10_defconfig          | 4 ++++
 configs/qemu_x86_64_defconfig              | 4 ++++
 configs/qemu_x86_defconfig                 | 4 ++++
 configs/qemu_xtensa_lx60_defconfig         | 4 ++++
 configs/qemu_xtensa_lx60_nommu_defconfig   | 4 ++++
 39 files changed, 156 insertions(+)

diff --git a/configs/qemu_aarch64_virt_defconfig b/configs/qemu_aarch64_virt_defconfig
index 6a9bc25bea..4e36a0b9f9 100644
--- a/configs/qemu_aarch64_virt_defconfig
+++ b/configs/qemu_aarch64_virt_defconfig
@@ -11,6 +11,10 @@ BR2_TARGET_ROOTFS_EXT2=y
 BR2_TARGET_ROOTFS_EXT2_4=y
 # BR2_TARGET_ROOTFS_TAR is not set
 
+# Image
+BR2_ROOTFS_POST_IMAGE_SCRIPT="board/qemu/post-image.sh"
+BR2_ROOTFS_POST_SCRIPT_ARGS="$(BR2_DEFCONFIG)"
+
 # Linux headers same as kernel, a 4.19 series
 BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_4_19=y
 
diff --git a/configs/qemu_arm_versatile_defconfig b/configs/qemu_arm_versatile_defconfig
index 42d29e3bf3..ed73af63fe 100644
--- a/configs/qemu_arm_versatile_defconfig
+++ b/configs/qemu_arm_versatile_defconfig
@@ -10,6 +10,10 @@ BR2_TARGET_GENERIC_GETTY_PORT="ttyAMA0"
 BR2_TARGET_ROOTFS_EXT2=y
 # BR2_TARGET_ROOTFS_TAR is not set
 
+# Image
+BR2_ROOTFS_POST_IMAGE_SCRIPT="board/qemu/post-image.sh"
+BR2_ROOTFS_POST_SCRIPT_ARGS="$(BR2_DEFCONFIG)"
+
 # Linux headers same as kernel, a 4.19 series
 BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_4_19=y
 
diff --git a/configs/qemu_arm_versatile_nommu_defconfig b/configs/qemu_arm_versatile_nommu_defconfig
index 6e4de0a0dd..614d920438 100644
--- a/configs/qemu_arm_versatile_nommu_defconfig
+++ b/configs/qemu_arm_versatile_nommu_defconfig
@@ -21,6 +21,10 @@ BR2_TARGET_GENERIC_GETTY_PORT="ttyAMA0"
 # BR2_TARGET_ROOTFS_TAR is not set
 BR2_TARGET_ROOTFS_INITRAMFS=y
 
+# Image
+BR2_ROOTFS_POST_IMAGE_SCRIPT="board/qemu/post-image.sh"
+BR2_ROOTFS_POST_SCRIPT_ARGS="$(BR2_DEFCONFIG)"
+
 # Linux headers same as kernel, a 4.19 series
 BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_4_19=y
 
diff --git a/configs/qemu_arm_vexpress_defconfig b/configs/qemu_arm_vexpress_defconfig
index 188fd72014..e8968d6630 100644
--- a/configs/qemu_arm_vexpress_defconfig
+++ b/configs/qemu_arm_vexpress_defconfig
@@ -13,6 +13,10 @@ BR2_TARGET_GENERIC_GETTY_PORT="ttyAMA0"
 BR2_TARGET_ROOTFS_EXT2=y
 # BR2_TARGET_ROOTFS_TAR is not set
 
+# Image
+BR2_ROOTFS_POST_IMAGE_SCRIPT="board/qemu/post-image.sh"
+BR2_ROOTFS_POST_SCRIPT_ARGS="$(BR2_DEFCONFIG)"
+
 # Linux headers same as kernel, a 4.19 series
 BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_4_19=y
 
diff --git a/configs/qemu_csky610_virt_defconfig b/configs/qemu_csky610_virt_defconfig
index f337bd7eb4..e7d75f5f49 100644
--- a/configs/qemu_csky610_virt_defconfig
+++ b/configs/qemu_csky610_virt_defconfig
@@ -5,6 +5,10 @@ BR2_ck610=y
 # System
 BR2_TARGET_ROOTFS_INITRAMFS=y
 
+# Image
+BR2_ROOTFS_POST_IMAGE_SCRIPT="board/qemu/post-image.sh"
+BR2_ROOTFS_POST_SCRIPT_ARGS="$(BR2_DEFCONFIG)"
+
 # linux kernel header, the same version with linux kernel
 BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_5_0=y
 
diff --git a/configs/qemu_csky807_virt_defconfig b/configs/qemu_csky807_virt_defconfig
index c4a10b8ade..df12450a55 100644
--- a/configs/qemu_csky807_virt_defconfig
+++ b/configs/qemu_csky807_virt_defconfig
@@ -5,6 +5,10 @@ BR2_ck807=y
 # System
 BR2_TARGET_ROOTFS_INITRAMFS=y
 
+# Image
+BR2_ROOTFS_POST_IMAGE_SCRIPT="board/qemu/post-image.sh"
+BR2_ROOTFS_POST_SCRIPT_ARGS="$(BR2_DEFCONFIG)"
+
 # linux kernel header, the same version with linux kernel
 BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_5_0=y
 
diff --git a/configs/qemu_csky810_virt_defconfig b/configs/qemu_csky810_virt_defconfig
index 56efe8a6ae..dd1fd329f5 100644
--- a/configs/qemu_csky810_virt_defconfig
+++ b/configs/qemu_csky810_virt_defconfig
@@ -5,6 +5,10 @@ BR2_ck810=y
 # System
 BR2_TARGET_ROOTFS_INITRAMFS=y
 
+# Image
+BR2_ROOTFS_POST_IMAGE_SCRIPT="board/qemu/post-image.sh"
+BR2_ROOTFS_POST_SCRIPT_ARGS="$(BR2_DEFCONFIG)"
+
 # linux kernel header, the same version with linux kernel
 BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_5_0=y
 
diff --git a/configs/qemu_csky860_virt_defconfig b/configs/qemu_csky860_virt_defconfig
index 9ec8f633af..6edfba4e8e 100644
--- a/configs/qemu_csky860_virt_defconfig
+++ b/configs/qemu_csky860_virt_defconfig
@@ -5,6 +5,10 @@ BR2_ck860=y
 # System
 BR2_TARGET_ROOTFS_INITRAMFS=y
 
+# Image
+BR2_ROOTFS_POST_IMAGE_SCRIPT="board/qemu/post-image.sh"
+BR2_ROOTFS_POST_SCRIPT_ARGS="$(BR2_DEFCONFIG)"
+
 # linux kernel header, the same version with linux kernel
 BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_5_0=y
 
diff --git a/configs/qemu_m68k_mcf5208_defconfig b/configs/qemu_m68k_mcf5208_defconfig
index a2cadffa92..916a113cd7 100644
--- a/configs/qemu_m68k_mcf5208_defconfig
+++ b/configs/qemu_m68k_mcf5208_defconfig
@@ -9,6 +9,10 @@ BR2_SYSTEM_DHCP="eth0"
 BR2_TARGET_ROOTFS_INITRAMFS=y
 # BR2_TARGET_ROOTFS_TAR is not set
 
+# Image
+BR2_ROOTFS_POST_IMAGE_SCRIPT="board/qemu/post-image.sh"
+BR2_ROOTFS_POST_SCRIPT_ARGS="$(BR2_DEFCONFIG)"
+
 # Linux headers same as kernel, a 4.19 series
 BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_4_19=y
 
diff --git a/configs/qemu_m68k_q800_defconfig b/configs/qemu_m68k_q800_defconfig
index 2ef73d1dd6..7b4a9e3e66 100644
--- a/configs/qemu_m68k_q800_defconfig
+++ b/configs/qemu_m68k_q800_defconfig
@@ -9,6 +9,10 @@ BR2_SYSTEM_DHCP="eth0"
 BR2_TARGET_ROOTFS_EXT2=y
 # BR2_TARGET_ROOTFS_TAR is not set
 
+# Image
+BR2_ROOTFS_POST_IMAGE_SCRIPT="board/qemu/post-image.sh"
+BR2_ROOTFS_POST_SCRIPT_ARGS="$(BR2_DEFCONFIG)"
+
 # Linux headers same as kernel, a 4.19 series
 BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_4_19=y
 
diff --git a/configs/qemu_microblazebe_mmu_defconfig b/configs/qemu_microblazebe_mmu_defconfig
index 2bcf13e085..d14d2fcf65 100644
--- a/configs/qemu_microblazebe_mmu_defconfig
+++ b/configs/qemu_microblazebe_mmu_defconfig
@@ -10,6 +10,10 @@ BR2_TARGET_GENERIC_GETTY_PORT="ttyUL0"
 # BR2_TARGET_ROOTFS_TAR is not set
 BR2_TARGET_ROOTFS_INITRAMFS=y
 
+# Image
+BR2_ROOTFS_POST_IMAGE_SCRIPT="board/qemu/post-image.sh"
+BR2_ROOTFS_POST_SCRIPT_ARGS="$(BR2_DEFCONFIG)"
+
 # Linux headers same as kernel, a 4.19 series
 BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_4_19=y
 
diff --git a/configs/qemu_microblazeel_mmu_defconfig b/configs/qemu_microblazeel_mmu_defconfig
index 4352ad6873..71018e9e36 100644
--- a/configs/qemu_microblazeel_mmu_defconfig
+++ b/configs/qemu_microblazeel_mmu_defconfig
@@ -10,6 +10,10 @@ BR2_TARGET_GENERIC_GETTY_PORT="ttyUL0"
 # BR2_TARGET_ROOTFS_TAR is not set
 BR2_TARGET_ROOTFS_INITRAMFS=y
 
+# Image
+BR2_ROOTFS_POST_IMAGE_SCRIPT="board/qemu/post-image.sh"
+BR2_ROOTFS_POST_SCRIPT_ARGS="$(BR2_DEFCONFIG)"
+
 # Linux headers same as kernel, a 4.19 series
 BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_4_19=y
 
diff --git a/configs/qemu_mips32r2_malta_defconfig b/configs/qemu_mips32r2_malta_defconfig
index baacc3cc83..51dfa48bb6 100644
--- a/configs/qemu_mips32r2_malta_defconfig
+++ b/configs/qemu_mips32r2_malta_defconfig
@@ -9,6 +9,10 @@ BR2_SYSTEM_DHCP="eth0"
 BR2_TARGET_ROOTFS_EXT2=y
 # BR2_TARGET_ROOTFS_TAR is not set
 
+# Image
+BR2_ROOTFS_POST_IMAGE_SCRIPT="board/qemu/post-image.sh"
+BR2_ROOTFS_POST_SCRIPT_ARGS="$(BR2_DEFCONFIG)"
+
 # Linux headers same as kernel, a 4.19 series
 BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_4_19=y
 
diff --git a/configs/qemu_mips32r2el_malta_defconfig b/configs/qemu_mips32r2el_malta_defconfig
index 35ad64368e..26a4560bee 100644
--- a/configs/qemu_mips32r2el_malta_defconfig
+++ b/configs/qemu_mips32r2el_malta_defconfig
@@ -9,6 +9,10 @@ BR2_SYSTEM_DHCP="eth0"
 BR2_TARGET_ROOTFS_EXT2=y
 # BR2_TARGET_ROOTFS_TAR is not set
 
+# Image
+BR2_ROOTFS_POST_IMAGE_SCRIPT="board/qemu/post-image.sh"
+BR2_ROOTFS_POST_SCRIPT_ARGS="$(BR2_DEFCONFIG)"
+
 # Linux headers same as kernel, a 4.19 series
 BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_4_19=y
 
diff --git a/configs/qemu_mips32r6_malta_defconfig b/configs/qemu_mips32r6_malta_defconfig
index a0553ed964..b9dd0dfd4d 100644
--- a/configs/qemu_mips32r6_malta_defconfig
+++ b/configs/qemu_mips32r6_malta_defconfig
@@ -9,6 +9,10 @@ BR2_SYSTEM_DHCP="eth0"
 BR2_TARGET_ROOTFS_EXT2=y
 # BR2_TARGET_ROOTFS_TAR is not set
 
+# Image
+BR2_ROOTFS_POST_IMAGE_SCRIPT="board/qemu/post-image.sh"
+BR2_ROOTFS_POST_SCRIPT_ARGS="$(BR2_DEFCONFIG)"
+
 # Linux headers same as kernel, a 4.19 series
 BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_4_19=y
 
diff --git a/configs/qemu_mips32r6el_malta_defconfig b/configs/qemu_mips32r6el_malta_defconfig
index aaace9540b..8ed5d30818 100644
--- a/configs/qemu_mips32r6el_malta_defconfig
+++ b/configs/qemu_mips32r6el_malta_defconfig
@@ -9,6 +9,10 @@ BR2_SYSTEM_DHCP="eth0"
 BR2_TARGET_ROOTFS_EXT2=y
 # BR2_TARGET_ROOTFS_TAR is not set
 
+# Image
+BR2_ROOTFS_POST_IMAGE_SCRIPT="board/qemu/post-image.sh"
+BR2_ROOTFS_POST_SCRIPT_ARGS="$(BR2_DEFCONFIG)"
+
 # Linux headers same as kernel, a 4.19 series
 BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_4_19=y
 
diff --git a/configs/qemu_mips64_malta_defconfig b/configs/qemu_mips64_malta_defconfig
index 2a8b50a18f..07fbb86046 100644
--- a/configs/qemu_mips64_malta_defconfig
+++ b/configs/qemu_mips64_malta_defconfig
@@ -9,6 +9,10 @@ BR2_SYSTEM_DHCP="eth0"
 BR2_TARGET_ROOTFS_EXT2=y
 # BR2_TARGET_ROOTFS_TAR is not set
 
+# Image
+BR2_ROOTFS_POST_IMAGE_SCRIPT="board/qemu/post-image.sh"
+BR2_ROOTFS_POST_SCRIPT_ARGS="$(BR2_DEFCONFIG)"
+
 # Linux headers same as kernel, a 4.19 series
 BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_4_19=y
 
diff --git a/configs/qemu_mips64el_malta_defconfig b/configs/qemu_mips64el_malta_defconfig
index 1d9d0807d0..50b9dfe703 100644
--- a/configs/qemu_mips64el_malta_defconfig
+++ b/configs/qemu_mips64el_malta_defconfig
@@ -9,6 +9,10 @@ BR2_SYSTEM_DHCP="eth0"
 BR2_TARGET_ROOTFS_EXT2=y
 # BR2_TARGET_ROOTFS_TAR is not set
 
+# Image
+BR2_ROOTFS_POST_IMAGE_SCRIPT="board/qemu/post-image.sh"
+BR2_ROOTFS_POST_SCRIPT_ARGS="$(BR2_DEFCONFIG)"
+
 # Linux headers same as kernel, a 4.19 series
 BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_4_19=y
 
diff --git a/configs/qemu_mips64r6_malta_defconfig b/configs/qemu_mips64r6_malta_defconfig
index ed42042292..bcf66b47fe 100644
--- a/configs/qemu_mips64r6_malta_defconfig
+++ b/configs/qemu_mips64r6_malta_defconfig
@@ -10,6 +10,10 @@ BR2_SYSTEM_DHCP="eth0"
 BR2_TARGET_ROOTFS_EXT2=y
 # BR2_TARGET_ROOTFS_TAR is not set
 
+# Image
+BR2_ROOTFS_POST_IMAGE_SCRIPT="board/qemu/post-image.sh"
+BR2_ROOTFS_POST_SCRIPT_ARGS="$(BR2_DEFCONFIG)"
+
 # Linux headers same as kernel, a 4.19 series
 BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_4_19=y
 
diff --git a/configs/qemu_mips64r6el_malta_defconfig b/configs/qemu_mips64r6el_malta_defconfig
index 7f4f28a708..fde495620e 100644
--- a/configs/qemu_mips64r6el_malta_defconfig
+++ b/configs/qemu_mips64r6el_malta_defconfig
@@ -10,6 +10,10 @@ BR2_SYSTEM_DHCP="eth0"
 BR2_TARGET_ROOTFS_EXT2=y
 # BR2_TARGET_ROOTFS_TAR is not set
 
+# Image
+BR2_ROOTFS_POST_IMAGE_SCRIPT="board/qemu/post-image.sh"
+BR2_ROOTFS_POST_SCRIPT_ARGS="$(BR2_DEFCONFIG)"
+
 # Linux headers same as kernel, a 4.19 series
 BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_4_19=y
 
diff --git a/configs/qemu_nios2_10m50_defconfig b/configs/qemu_nios2_10m50_defconfig
index 48d1513846..f5f8623305 100644
--- a/configs/qemu_nios2_10m50_defconfig
+++ b/configs/qemu_nios2_10m50_defconfig
@@ -6,6 +6,10 @@ BR2_LINUX_KERNEL_DEFCONFIG="10m50"
 BR2_LINUX_KERNEL_CONFIG_FRAGMENT_FILES="board/qemu/nios2-10m50/linux.fragment"
 BR2_TARGET_ROOTFS_INITRAMFS=y
 
+# Image
+BR2_ROOTFS_POST_IMAGE_SCRIPT="board/qemu/post-image.sh"
+BR2_ROOTFS_POST_SCRIPT_ARGS="$(BR2_DEFCONFIG)"
+
 # Linux headers same as kernel, a 4.19 series
 BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_4_19=y
 
diff --git a/configs/qemu_or1k_defconfig b/configs/qemu_or1k_defconfig
index 60147acd4b..2a61a38394 100644
--- a/configs/qemu_or1k_defconfig
+++ b/configs/qemu_or1k_defconfig
@@ -5,6 +5,10 @@ BR2_or1k=y
 # BR2_TARGET_ROOTFS_TAR is not set
 BR2_TARGET_ROOTFS_INITRAMFS=y
 
+# Image
+BR2_ROOTFS_POST_IMAGE_SCRIPT="board/qemu/post-image.sh"
+BR2_ROOTFS_POST_SCRIPT_ARGS="$(BR2_DEFCONFIG)"
+
 # Linux headers same as kernel, a 4,19 series
 BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_4_19=y
 
diff --git a/configs/qemu_ppc64_e5500_defconfig b/configs/qemu_ppc64_e5500_defconfig
index 3c71c17e0a..b37bd11041 100644
--- a/configs/qemu_ppc64_e5500_defconfig
+++ b/configs/qemu_ppc64_e5500_defconfig
@@ -5,6 +5,10 @@ BR2_powerpc_e5500=y
 # Serial port config
 BR2_TARGET_GENERIC_GETTY_PORT="ttyS0"
 
+# Image
+BR2_ROOTFS_POST_IMAGE_SCRIPT="board/qemu/post-image.sh"
+BR2_ROOTFS_POST_SCRIPT_ARGS="$(BR2_DEFCONFIG)"
+
 # Linux headers same as the kernel
 BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_4_19=y
 
diff --git a/configs/qemu_ppc64_pseries_defconfig b/configs/qemu_ppc64_pseries_defconfig
index 42856a52b7..3f516a0462 100644
--- a/configs/qemu_ppc64_pseries_defconfig
+++ b/configs/qemu_ppc64_pseries_defconfig
@@ -10,6 +10,10 @@ BR2_TARGET_GENERIC_GETTY_PORT="hvc0"
 BR2_TARGET_ROOTFS_EXT2=y
 # BR2_TARGET_ROOTFS_TAR is not set
 
+# Image
+BR2_ROOTFS_POST_IMAGE_SCRIPT="board/qemu/post-image.sh"
+BR2_ROOTFS_POST_SCRIPT_ARGS="$(BR2_DEFCONFIG)"
+
 # Linux headers same as kernel, a 4.19 series
 BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_4_19=y
 
diff --git a/configs/qemu_ppc64le_pseries_defconfig b/configs/qemu_ppc64le_pseries_defconfig
index 653d111953..fa6651f7fd 100644
--- a/configs/qemu_ppc64le_pseries_defconfig
+++ b/configs/qemu_ppc64le_pseries_defconfig
@@ -10,6 +10,10 @@ BR2_SYSTEM_DHCP="eth0"
 BR2_TARGET_ROOTFS_EXT2=y
 # BR2_TARGET_ROOTFS_TAR is not set
 
+# Image
+BR2_ROOTFS_POST_IMAGE_SCRIPT="board/qemu/post-image.sh"
+BR2_ROOTFS_POST_SCRIPT_ARGS="$(BR2_DEFCONFIG)"
+
 # Linux headers same as kernel, a 4.19 series
 BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_4_19=y
 
diff --git a/configs/qemu_ppc_g3beige_defconfig b/configs/qemu_ppc_g3beige_defconfig
index acb9d86fb6..2403cfbd83 100644
--- a/configs/qemu_ppc_g3beige_defconfig
+++ b/configs/qemu_ppc_g3beige_defconfig
@@ -9,6 +9,10 @@ BR2_SYSTEM_DHCP="eth0"
 BR2_TARGET_ROOTFS_EXT2=y
 # BR2_TARGET_ROOTFS_TAR is not set
 
+# Image
+BR2_ROOTFS_POST_IMAGE_SCRIPT="board/qemu/post-image.sh"
+BR2_ROOTFS_POST_SCRIPT_ARGS="$(BR2_DEFCONFIG)"
+
 # Linux headers same as kernel, a 4.19 series
 BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_4_19=y
 
diff --git a/configs/qemu_ppc_mac99_defconfig b/configs/qemu_ppc_mac99_defconfig
index 496b0fb2a4..55715dce85 100644
--- a/configs/qemu_ppc_mac99_defconfig
+++ b/configs/qemu_ppc_mac99_defconfig
@@ -25,6 +25,10 @@ BR2_TARGET_ROOTFS_CPIO=y
 BR2_TARGET_ROOTFS_EXT2=y
 # BR2_TARGET_ROOTFS_TAR is not set
 
+# Image
+BR2_ROOTFS_POST_IMAGE_SCRIPT="board/qemu/post-image.sh"
+BR2_ROOTFS_POST_SCRIPT_ARGS="$(BR2_DEFCONFIG)"
+
 # host-qemu for gitlab testing
 BR2_PACKAGE_HOST_QEMU=y
 BR2_PACKAGE_HOST_QEMU_SYSTEM_MODE=y
diff --git a/configs/qemu_ppc_mpc8544ds_defconfig b/configs/qemu_ppc_mpc8544ds_defconfig
index 66bc1d2089..9841575479 100644
--- a/configs/qemu_ppc_mpc8544ds_defconfig
+++ b/configs/qemu_ppc_mpc8544ds_defconfig
@@ -9,6 +9,10 @@ BR2_SYSTEM_DHCP="eth0"
 # BR2_TARGET_ROOTFS_TAR is not set
 BR2_TARGET_ROOTFS_INITRAMFS=y
 
+# Image
+BR2_ROOTFS_POST_IMAGE_SCRIPT="board/qemu/post-image.sh"
+BR2_ROOTFS_POST_SCRIPT_ARGS="$(BR2_DEFCONFIG)"
+
 # Linux headers same as kernel, a 4.19 series
 BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_4_19=y
 
diff --git a/configs/qemu_ppc_virtex_ml507_defconfig b/configs/qemu_ppc_virtex_ml507_defconfig
index c7c324d5e8..2ecf9464d9 100644
--- a/configs/qemu_ppc_virtex_ml507_defconfig
+++ b/configs/qemu_ppc_virtex_ml507_defconfig
@@ -6,6 +6,10 @@ BR2_powerpc_440=y
 # BR2_TARGET_ROOTFS_TAR is not set
 BR2_TARGET_ROOTFS_INITRAMFS=y
 
+# Image
+BR2_ROOTFS_POST_IMAGE_SCRIPT="board/qemu/post-image.sh"
+BR2_ROOTFS_POST_SCRIPT_ARGS="$(BR2_DEFCONFIG)"
+
 # Linux headers same as kernel, a 4.19 series
 BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_4_19=y
 
diff --git a/configs/qemu_riscv32_virt_defconfig b/configs/qemu_riscv32_virt_defconfig
index 914eada004..427ea47387 100644
--- a/configs/qemu_riscv32_virt_defconfig
+++ b/configs/qemu_riscv32_virt_defconfig
@@ -11,6 +11,10 @@ BR2_GLOBAL_PATCH_DIR="board/qemu/riscv32-virt/patches/"
 # Filesystem
 BR2_TARGET_ROOTFS_EXT2=y
 
+# Image
+BR2_ROOTFS_POST_IMAGE_SCRIPT="board/qemu/post-image.sh"
+BR2_ROOTFS_POST_SCRIPT_ARGS="$(BR2_DEFCONFIG)"
+
 # Linux headers same as kernel, a 5.1 series
 BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_5_1=y
 
diff --git a/configs/qemu_riscv64_virt_defconfig b/configs/qemu_riscv64_virt_defconfig
index 5c52f7a0f8..2125324aff 100644
--- a/configs/qemu_riscv64_virt_defconfig
+++ b/configs/qemu_riscv64_virt_defconfig
@@ -10,6 +10,10 @@ BR2_TARGET_GENERIC_GETTY_PORT="ttyS0"
 # Filesystem
 BR2_TARGET_ROOTFS_EXT2=y
 
+# Image
+BR2_ROOTFS_POST_IMAGE_SCRIPT="board/qemu/post-image.sh"
+BR2_ROOTFS_POST_SCRIPT_ARGS="$(BR2_DEFCONFIG)"
+
 # Linux headers same as kernel, a 5.1 series
 BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_5_1=y
 
diff --git a/configs/qemu_sh4_r2d_defconfig b/configs/qemu_sh4_r2d_defconfig
index c7c5126bf9..8d5cf18fc1 100644
--- a/configs/qemu_sh4_r2d_defconfig
+++ b/configs/qemu_sh4_r2d_defconfig
@@ -11,6 +11,10 @@ BR2_TARGET_GENERIC_GETTY_PORT="ttySC1"
 BR2_TARGET_ROOTFS_EXT2=y
 # BR2_TARGET_ROOTFS_TAR is not set
 
+# Image
+BR2_ROOTFS_POST_IMAGE_SCRIPT="board/qemu/post-image.sh"
+BR2_ROOTFS_POST_SCRIPT_ARGS="$(BR2_DEFCONFIG)"
+
 # Linux headers same as kernel, a 4.19 series
 BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_4_19=y
 
diff --git a/configs/qemu_sh4eb_r2d_defconfig b/configs/qemu_sh4eb_r2d_defconfig
index 4d9559a387..8b35e2081d 100644
--- a/configs/qemu_sh4eb_r2d_defconfig
+++ b/configs/qemu_sh4eb_r2d_defconfig
@@ -10,6 +10,10 @@ BR2_TARGET_GENERIC_GETTY_PORT="ttySC1"
 BR2_TARGET_ROOTFS_EXT2=y
 # BR2_TARGET_ROOTFS_TAR is not set
 
+# Image
+BR2_ROOTFS_POST_IMAGE_SCRIPT="board/qemu/post-image.sh"
+BR2_ROOTFS_POST_SCRIPT_ARGS="$(BR2_DEFCONFIG)"
+
 # Linux headers same as kernel, a 4.19 series
 BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_4_19=y
 
diff --git a/configs/qemu_sparc64_sun4u_defconfig b/configs/qemu_sparc64_sun4u_defconfig
index d7be664cbf..0d045a8aca 100644
--- a/configs/qemu_sparc64_sun4u_defconfig
+++ b/configs/qemu_sparc64_sun4u_defconfig
@@ -9,6 +9,10 @@ BR2_SYSTEM_DHCP="eth0"
 BR2_TARGET_ROOTFS_EXT2=y
 # BR2_TARGET_ROOTFS_TAR is not set
 
+# Image
+BR2_ROOTFS_POST_IMAGE_SCRIPT="board/qemu/post-image.sh"
+BR2_ROOTFS_POST_SCRIPT_ARGS="$(BR2_DEFCONFIG)"
+
 # Linux headers same as kernel, a 4.19 series
 BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_4_19=y
 
diff --git a/configs/qemu_sparc_ss10_defconfig b/configs/qemu_sparc_ss10_defconfig
index dada40d469..fd66576fed 100644
--- a/configs/qemu_sparc_ss10_defconfig
+++ b/configs/qemu_sparc_ss10_defconfig
@@ -9,6 +9,10 @@ BR2_SYSTEM_DHCP="eth0"
 BR2_TARGET_ROOTFS_EXT2=y
 # BR2_TARGET_ROOTFS_TAR is not set
 
+# Image
+BR2_ROOTFS_POST_IMAGE_SCRIPT="board/qemu/post-image.sh"
+BR2_ROOTFS_POST_SCRIPT_ARGS="$(BR2_DEFCONFIG)"
+
 # Linux headers same as kernel, a 4.19 series
 BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_4_19=y
 
diff --git a/configs/qemu_x86_64_defconfig b/configs/qemu_x86_64_defconfig
index b561e42e51..8adc00ad20 100644
--- a/configs/qemu_x86_64_defconfig
+++ b/configs/qemu_x86_64_defconfig
@@ -11,6 +11,10 @@ BR2_TARGET_ROOTFS_EXT2=y
 # Image
 BR2_ROOTFS_POST_BUILD_SCRIPT="board/qemu/x86_64/post-build.sh"
 
+# Image
+BR2_ROOTFS_POST_IMAGE_SCRIPT="board/qemu/post-image.sh"
+BR2_ROOTFS_POST_SCRIPT_ARGS="$(BR2_DEFCONFIG)"
+
 # Linux headers same as kernel, a 4.19 series
 BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_4_19=y
 
diff --git a/configs/qemu_x86_defconfig b/configs/qemu_x86_defconfig
index 52f1744344..b1f508bb1e 100644
--- a/configs/qemu_x86_defconfig
+++ b/configs/qemu_x86_defconfig
@@ -12,6 +12,10 @@ BR2_TARGET_ROOTFS_EXT2=y
 # Image
 BR2_ROOTFS_POST_BUILD_SCRIPT="board/qemu/x86/post-build.sh"
 
+# Image
+BR2_ROOTFS_POST_IMAGE_SCRIPT="board/qemu/post-image.sh"
+BR2_ROOTFS_POST_SCRIPT_ARGS="$(BR2_DEFCONFIG)"
+
 # Linux headers same as kernel, a 4.19 series
 BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_4_19=y
 
diff --git a/configs/qemu_xtensa_lx60_defconfig b/configs/qemu_xtensa_lx60_defconfig
index 7cf8c41fd4..a18e670bda 100644
--- a/configs/qemu_xtensa_lx60_defconfig
+++ b/configs/qemu_xtensa_lx60_defconfig
@@ -11,6 +11,10 @@ BR2_TARGET_GENERIC_GETTY_PORT="ttyS0"
 # BR2_TARGET_ROOTFS_TAR is not set
 BR2_TARGET_ROOTFS_INITRAMFS=y
 
+# Image
+BR2_ROOTFS_POST_IMAGE_SCRIPT="board/qemu/post-image.sh"
+BR2_ROOTFS_POST_SCRIPT_ARGS="$(BR2_DEFCONFIG)"
+
 # Linux headers same as kernel, a 4.19 series
 BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_4_19=y
 
diff --git a/configs/qemu_xtensa_lx60_nommu_defconfig b/configs/qemu_xtensa_lx60_nommu_defconfig
index 8cb93f2d3d..7aef864650 100644
--- a/configs/qemu_xtensa_lx60_nommu_defconfig
+++ b/configs/qemu_xtensa_lx60_nommu_defconfig
@@ -15,6 +15,10 @@ BR2_TARGET_GENERIC_GETTY_PORT="ttyS0"
 # BR2_TARGET_ROOTFS_TAR is not set
 BR2_TARGET_ROOTFS_INITRAMFS=y
 
+# Image
+BR2_ROOTFS_POST_IMAGE_SCRIPT="board/qemu/post-image.sh"
+BR2_ROOTFS_POST_SCRIPT_ARGS="$(BR2_DEFCONFIG)"
+
 # Linux headers same as kernel, a 4.19 series
 BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_4_19=y
 
-- 
2.24.1

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [Buildroot] [PATCH v5 4/5] support/scripts/boot-qemu-image.py: boot Qemu images with Qemu-system.
  2020-02-17 20:50 [Buildroot] [PATCH v5 0/5] gitlab Qemu runtime testing Romain Naour
                   ` (2 preceding siblings ...)
  2020-02-17 20:50 ` [Buildroot] [PATCH v5 3/5] configs/qemu*: use the post-image script with "$(BR2_DEFCONFIG)" as argument Romain Naour
@ 2020-02-17 20:50 ` Romain Naour
  2020-04-13  7:15   ` Yann E. MORIN
  2020-02-17 20:50 ` [Buildroot] [PATCH v5 5/5] gitlab.yml.in*: enable Qemu gitlab testing Romain Naour
                   ` (2 subsequent siblings)
  6 siblings, 1 reply; 13+ messages in thread
From: Romain Naour @ 2020-02-17 20:50 UTC (permalink / raw)
  To: buildroot

From: Jugurtha BELKALEM <jugurtha.belkalem@smile.fr>

This script is intended to be used by gitlab CI to test
at runtime Qemu images generated by Buildroot's Qemu defconfigs.

This allows to troubleshoot different issues that may be
associated with defective builds by lanching a qemu machine,
sending root password, waiting for login shell and then perform
a shutdown.

This script is inspired by toolchain builder [1] and the Buildroot
testing infrastructure.

Usage: boot-qemu-image.py <qemu_arch_defconfig>

The gitlab CI will call this script for each defconfig build but
only Qemu defconfig will be runtime tested, all others defconfig are
ignored. The script retrieve the qemu command line from start-qemu.sh
script. The start-qemu.sh script is no executed directly since we
want to handle the serial output with pexpect to detect the
shell, enter the password and powerdown the system.
If the script is missing, error out with a message in the log.

The script check is the corresponding Qemu binary (qemu-system) is
available, either built by Buildroot or available from the host.
Some Qemu defconfig must be used with a specific Qemu version (fork)
that is not always available. The script doesn't error out when
qemu-system is missing but a message is added in the log.

Finally, the script start Qemu like it's done for the Buildroot
testing infrastructure (using pexpect).

Note:
We noticed some timeout issues with pexpect when the Qemu machine is
powered off. That's because Qemu process doesn't stop even if the
system is halted (after "System halted"). So the script doesn't error
out when such timeout occure. The behaviour depends on the architecture
emulated by Qemu.

[1] https://github.com/bootlin/toolchains-builder/blob/master/build.sh

Signed-off-by: Jugurtha BELKALEM <jugurtha.belkalem@smile.fr>
Signed-off-by: Romain Naour <romain.naour@smile.fr>
---
v5: No Change
---
 support/scripts/boot-qemu-image.py | 105 +++++++++++++++++++++++++++++
 1 file changed, 105 insertions(+)
 create mode 100755 support/scripts/boot-qemu-image.py

diff --git a/support/scripts/boot-qemu-image.py b/support/scripts/boot-qemu-image.py
new file mode 100755
index 0000000000..abaf88d446
--- /dev/null
+++ b/support/scripts/boot-qemu-image.py
@@ -0,0 +1,105 @@
+#!/usr/bin/env python3
+
+# This script expect to run from the Buildroot top directory.
+
+import pexpect
+import sys
+import os
+import re
+import shlex
+import shutil
+import subprocess
+
+argc = len(sys.argv)
+if not (argc == 2):
+    print("Error: incorrect number of arguments")
+    print("""Usage: boot-qemu-image.py <qemu_arch_defconfig>""")
+    sys.exit(1)
+
+defconfig_filename = sys.argv[1]
+
+# Ignore non Qemu defconfig
+if defconfig_filename.startswith('qemu_') is False:
+    sys.exit(0)
+
+qemu_start_script_filepath = os.path.join(os.getcwd(), 'output/images/start-qemu.sh')
+
+# Ignore if start-qemu.sh is missing, we can't test.
+if not os.path.exists(qemu_start_script_filepath):
+    print("Error: " + qemu_start_script_filepath) + " file is missing."
+    sys.exit(1)
+
+qemu_cmd = ""
+
+with open(qemu_start_script_filepath, 'r') as script_file:
+    for line in script_file:
+        if re.search("qemu-system", line):
+            qemu_cmd = line
+            break
+
+if not qemu_cmd:
+    print("Error: No QEMU command line found in " + qemu_start_script_filepath)
+    sys.exit(1)
+
+# Replace bashism
+qemu_cmd = line.replace("${IMAGE_DIR}", "output/images")
+
+# pexpect needs a list, convert a sting to a list and escape quoted substring.
+qemu_cmd = shlex.split(qemu_cmd)
+
+# Use host Qemu if provided by Buildroot.
+os.environ["PATH"] = os.getcwd() + "/output/host/bin" + os.pathsep + os.environ["PATH"]
+
+# Ignore when no Qemu emulation is available
+if not shutil.which(qemu_cmd[0]):
+    print("No " + qemu_cmd[0] + " binary available, THIS DEFCONFIG CAN NOT BE TESTED!")
+    sys.exit(0)
+
+
+def main():
+    global child
+
+    try:
+        child.expect(["buildroot login:", pexpect.TIMEOUT], timeout=60)
+    except pexpect.EOF:
+        print("Connection problem, exiting.")
+        sys.exit(1)
+    except pexpect.TIMEOUT:
+        print("System did not boot in time, exiting.")
+        sys.exit(1)
+
+    child.sendline("root\r")
+
+    try:
+        child.expect(["# ", pexpect.TIMEOUT], timeout=60)
+    except pexpect.EOF:
+        print("Cannot connect to shell")
+        sys.exit(1)
+    except pexpect.TIMEOUT:
+        print("Timeout while waiting for shell")
+        sys.exit(1)
+
+    child.sendline("poweroff\r")
+
+    try:
+        child.expect(["System halted", pexpect.TIMEOUT], timeout=60)
+        child.expect(pexpect.EOF)
+    except pexpect.EOF:
+        sys.exit(0)
+    except pexpect.TIMEOUT:
+        print("Cannot halt machine")
+        # Qemu may not exit properly after "System halted", ignore.
+        sys.exit(0)
+
+
+# Log the Qemu version
+subprocess.call([qemu_cmd[0], "--version"])
+
+# Log the Qemu command line
+print(qemu_cmd)
+
+child = pexpect.spawn(qemu_cmd[0], qemu_cmd[1:], timeout=5, encoding='utf-8',
+                      env={"QEMU_AUDIO_DRV": "none", 'PATH': os.environ["PATH"]})
+# We want only stdout into the log to avoid double echo
+child.logfile = sys.stdout
+main()
-- 
2.24.1

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [Buildroot] [PATCH v5 5/5] gitlab.yml.in*: enable Qemu gitlab testing
  2020-02-17 20:50 [Buildroot] [PATCH v5 0/5] gitlab Qemu runtime testing Romain Naour
                   ` (3 preceding siblings ...)
  2020-02-17 20:50 ` [Buildroot] [PATCH v5 4/5] support/scripts/boot-qemu-image.py: boot Qemu images with Qemu-system Romain Naour
@ 2020-02-17 20:50 ` Romain Naour
  2020-04-12 14:11 ` [Buildroot] [PATCH v5 0/5] gitlab Qemu runtime testing Thomas Petazzoni
  2020-04-13 19:56 ` Yann E. MORIN
  6 siblings, 0 replies; 13+ messages in thread
From: Romain Naour @ 2020-02-17 20:50 UTC (permalink / raw)
  To: buildroot

From: Jugurtha BELKALEM <jugurtha.belkalem@smile.fr>

Used to launch qemu tests for various qemu architectures.
Neverthless to say that this file skips any other job
different from qemu (only qemu configurations are
runtime tested).

Add the log generated by Qemu to the build artefacts.

Signed-off-by: Jugurtha BELKALEM <jugurtha.belkalem@smile.fr>
Signed-off-by: Romain Naour <romain.naour@smile.fr>
---
v5: No Change
---
 .gitlab-ci.yml    | 7 +++++++
 .gitlab-ci.yml.in | 7 +++++++
 2 files changed, 14 insertions(+)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index a6436a8417..6341f6463a 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -54,6 +54,12 @@ check-package:
                 tail -200 build.log
                 exit 1
             }
+        - |
+            ./support/scripts/boot-qemu-image.py "${DEFCONFIG_NAME}" > >(tee runtime-test.log) 2>&1 || {
+                echo 'Failed runtime test last output'
+                tail -200 runtime-test.log
+                exit 1
+            }
     artifacts:
         when: always
         expire_in: 2 weeks
@@ -64,6 +70,7 @@ check-package:
             - output/build/build-time.log
             - output/build/packages-file-list.txt
             - output/build/*/.config
+            - runtime-test.log
 
 .defconfig:
     extends: .defconfig_base
diff --git a/.gitlab-ci.yml.in b/.gitlab-ci.yml.in
index 7e6a7598ae..6b09730a65 100644
--- a/.gitlab-ci.yml.in
+++ b/.gitlab-ci.yml.in
@@ -54,6 +54,12 @@ check-package:
                 tail -200 build.log
                 exit 1
             }
+        - |
+            ./support/scripts/boot-qemu-image.py "${DEFCONFIG_NAME}" > >(tee runtime-test.log) 2>&1 || {
+                echo 'Failed runtime test last output'
+                tail -200 runtime-test.log
+                exit 1
+            }
     artifacts:
         when: always
         expire_in: 2 weeks
@@ -64,6 +70,7 @@ check-package:
             - output/build/build-time.log
             - output/build/packages-file-list.txt
             - output/build/*/.config
+            - runtime-test.log
 
 .defconfig:
     extends: .defconfig_base
-- 
2.24.1

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [Buildroot] [PATCH v5 0/5] gitlab Qemu runtime testing
  2020-02-17 20:50 [Buildroot] [PATCH v5 0/5] gitlab Qemu runtime testing Romain Naour
                   ` (4 preceding siblings ...)
  2020-02-17 20:50 ` [Buildroot] [PATCH v5 5/5] gitlab.yml.in*: enable Qemu gitlab testing Romain Naour
@ 2020-04-12 14:11 ` Thomas Petazzoni
  2020-04-12 20:00   ` Romain Naour
  2020-04-13 19:56 ` Yann E. MORIN
  6 siblings, 1 reply; 13+ messages in thread
From: Thomas Petazzoni @ 2020-04-12 14:11 UTC (permalink / raw)
  To: buildroot

Hello,

On Mon, 17 Feb 2020 21:50:25 +0100
Romain Naour <romain.naour@smile.fr> wrote:

> Jugurtha BELKALEM (2):
>   support/scripts/boot-qemu-image.py: boot Qemu images with Qemu-system.
>   gitlab.yml.in*: enable Qemu gitlab testing
> 
> Romain Naour (3):
>   board/qemu: add defconfig file name as tag after the qemu command line
>   board/qemu: add post-image script for gitlab qemu testing
>   configs/qemu*: use the post-image script with "$(BR2_DEFCONFIG)" as
>     argument.

Overall, I am quite happy with the series. There are just two things
that I am not entirely sure about:

 (1) The logic that tests $CI_JOB_NAME in board/qemu/post-image.sh, to
     test if we are running under Gitlab CI or not. It feels a bit
     hackish to me. Should this magic be there, or instead tweaked by
     the Gitlab CI testing stuff directly ?

 (2) We now generate this start-qemu.sh script in $(BINARIES_DIR), but
     in fact only really use it for Gitlab CI testing. Should we make
     this start-qemu.sh script more prominently useful ? Or should we
     instead not have any start-qemu.sh script, and have the Gitlab CI
     testing logic directly find what the Qemu command line should be ?

That being said, this series has been around for a long time, so unless
I get some feedback on these questions, I'm going to apply it as-is, we
can always improve on top of that later on.

Best regards,

Thomas
-- 
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Buildroot] [PATCH v5 0/5] gitlab Qemu runtime testing
  2020-04-12 14:11 ` [Buildroot] [PATCH v5 0/5] gitlab Qemu runtime testing Thomas Petazzoni
@ 2020-04-12 20:00   ` Romain Naour
  0 siblings, 0 replies; 13+ messages in thread
From: Romain Naour @ 2020-04-12 20:00 UTC (permalink / raw)
  To: buildroot

Hi Thomas, All,

Le 12/04/2020 ? 16:11, Thomas Petazzoni a ?crit?:
> Hello,
> 
> On Mon, 17 Feb 2020 21:50:25 +0100
> Romain Naour <romain.naour@smile.fr> wrote:
> 
>> Jugurtha BELKALEM (2):
>>   support/scripts/boot-qemu-image.py: boot Qemu images with Qemu-system.
>>   gitlab.yml.in*: enable Qemu gitlab testing
>>
>> Romain Naour (3):
>>   board/qemu: add defconfig file name as tag after the qemu command line
>>   board/qemu: add post-image script for gitlab qemu testing
>>   configs/qemu*: use the post-image script with "$(BR2_DEFCONFIG)" as
>>     argument.
> 
> Overall, I am quite happy with the series. There are just two things
> that I am not entirely sure about:
> 
>  (1) The logic that tests $CI_JOB_NAME in board/qemu/post-image.sh, to
>      test if we are running under Gitlab CI or not. It feels a bit
>      hackish to me. Should this magic be there, or instead tweaked by
>      the Gitlab CI testing stuff directly ?

True, this is how it's done in toolchain-builder project. But the goal here is
to provide the start-qemu.sh script at the end of the build, even outside of
Gitlab CI.

> 
>  (2) We now generate this start-qemu.sh script in $(BINARIES_DIR), but
>      in fact only really use it for Gitlab CI testing. Should we make
>      this start-qemu.sh script more prominently useful ? Or should we
>      instead not have any start-qemu.sh script, and have the Gitlab CI
>      testing logic directly find what the Qemu command line should be ?

start-qemu.sh can be used outside of Gitlab CI, I'm regularly using Qemu
defconfig locally and getting the qemu command line from the readme is not
practical. That was the feedback I had from one user on previous iteration.

> 
> That being said, this series has been around for a long time, so unless
> I get some feedback on these questions, I'm going to apply it as-is, we
> can always improve on top of that later on.

This series was started by my colleague Jugurtha about one year ago. Since then
toolchains update showed that Qemu runtime testing is necessary otherwise we can
end up with a non working defconfig (see issue with binutils 2.34 and sh4 kernel).

http://patchwork.ozlabs.org/patch/1216434/

Thanks Yann for the review during the last Buildroot meeting!

Best regards,
Romain


> 
> Best regards,
> 
> Thomas
> 

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Buildroot] [PATCH v5 4/5] support/scripts/boot-qemu-image.py: boot Qemu images with Qemu-system.
  2020-02-17 20:50 ` [Buildroot] [PATCH v5 4/5] support/scripts/boot-qemu-image.py: boot Qemu images with Qemu-system Romain Naour
@ 2020-04-13  7:15   ` Yann E. MORIN
  2020-04-13 21:38     ` Romain Naour
  0 siblings, 1 reply; 13+ messages in thread
From: Yann E. MORIN @ 2020-04-13  7:15 UTC (permalink / raw)
  To: buildroot

Romain, Jugurtha, All,

On 2020-02-17 21:50 +0100, Romain Naour spake thusly:
> From: Jugurtha BELKALEM <jugurtha.belkalem@smile.fr>
> This script is intended to be used by gitlab CI to test
> at runtime Qemu images generated by Buildroot's Qemu defconfigs.
[--SNIP--]
> diff --git a/support/scripts/boot-qemu-image.py b/support/scripts/boot-qemu-image.py
> new file mode 100755
> index 0000000000..abaf88d446
> --- /dev/null
> +++ b/support/scripts/boot-qemu-image.py
> @@ -0,0 +1,105 @@
> +#!/usr/bin/env python3
> +
> +# This script expect to run from the Buildroot top directory.
> +
> +import pexpect
> +import sys
> +import os
> +import re
> +import shlex
> +import shutil
> +import subprocess
> +
> +argc = len(sys.argv)
> +if not (argc == 2):
> +    print("Error: incorrect number of arguments")
> +    print("""Usage: boot-qemu-image.py <qemu_arch_defconfig>""")
> +    sys.exit(1)
> +
> +defconfig_filename = sys.argv[1]
> +
> +# Ignore non Qemu defconfig
> +if defconfig_filename.startswith('qemu_') is False:
> +    sys.exit(0)
> +
> +qemu_start_script_filepath = os.path.join(os.getcwd(), 'output/images/start-qemu.sh')
> +
> +# Ignore if start-qemu.sh is missing, we can't test.
> +if not os.path.exists(qemu_start_script_filepath):
> +    print("Error: " + qemu_start_script_filepath) + " file is missing."
> +    sys.exit(1)
> +
> +qemu_cmd = ""
> +
> +with open(qemu_start_script_filepath, 'r') as script_file:
> +    for line in script_file:
> +        if re.search("qemu-system", line):
> +            qemu_cmd = line
> +            break
> +
> +if not qemu_cmd:
> +    print("Error: No QEMU command line found in " + qemu_start_script_filepath)
> +    sys.exit(1)

Why do you extract the command line, and can't directly run the script?

> +# Replace bashism
> +qemu_cmd = line.replace("${IMAGE_DIR}", "output/images")

This would avoid this dance...

> +# pexpect needs a list, convert a sting to a list and escape quoted substring.
> +qemu_cmd = shlex.split(qemu_cmd)

... as well as this one.

> +# Use host Qemu if provided by Buildroot.
> +os.environ["PATH"] = os.getcwd() + "/output/host/bin" + os.pathsep + os.environ["PATH"]

And this one can be avoided too if the script is called with PATH
properly set to include ${HOST_DIR}/bin. This should be easy, as this
script is only expected to run from the gitlab-ci pipelines.

> +# Ignore when no Qemu emulation is available
> +if not shutil.which(qemu_cmd[0]):
> +    print("No " + qemu_cmd[0] + " binary available, THIS DEFCONFIG CAN NOT BE TESTED!")
> +    sys.exit(0)
> +
> +
> +def main():
> +    global child

Mixing code at the top-level and in a main() is ugly. Mocve everything
to a main (and helper functions if youlike), but don't mix the two.

> +    try:
> +        child.expect(["buildroot login:", pexpect.TIMEOUT], timeout=60)
> +    except pexpect.EOF:
> +        print("Connection problem, exiting.")
> +        sys.exit(1)
> +    except pexpect.TIMEOUT:
> +        print("System did not boot in time, exiting.")
> +        sys.exit(1)
> +
> +    child.sendline("root\r")
> +
> +    try:
> +        child.expect(["# ", pexpect.TIMEOUT], timeout=60)
> +    except pexpect.EOF:
> +        print("Cannot connect to shell")
> +        sys.exit(1)
> +    except pexpect.TIMEOUT:
> +        print("Timeout while waiting for shell")
> +        sys.exit(1)
> +
> +    child.sendline("poweroff\r")
> +
> +    try:
> +        child.expect(["System halted", pexpect.TIMEOUT], timeout=60)
> +        child.expect(pexpect.EOF)
> +    except pexpect.EOF:
> +        sys.exit(0)
> +    except pexpect.TIMEOUT:
> +        print("Cannot halt machine")
> +        # Qemu may not exit properly after "System halted", ignore.
> +        sys.exit(0)
> +
> +
> +# Log the Qemu version
> +subprocess.call([qemu_cmd[0], "--version"])
> +
> +# Log the Qemu command line
> +print(qemu_cmd)

You would not have to do that if you just called the start-qemu.sh script.

Regards,
Yann E. MORIN.

> +child = pexpect.spawn(qemu_cmd[0], qemu_cmd[1:], timeout=5, encoding='utf-8',
> +                      env={"QEMU_AUDIO_DRV": "none", 'PATH': os.environ["PATH"]})
> +# We want only stdout into the log to avoid double echo
> +child.logfile = sys.stdout
> +main()
> -- 
> 2.24.1
> 
> _______________________________________________
> buildroot mailing list
> buildroot at busybox.net
> http://lists.busybox.net/mailman/listinfo/buildroot

-- 
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 561 099 427 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Buildroot] [PATCH v5 2/5] board/qemu: add post-image script for gitlab qemu testing
  2020-02-17 20:50 ` [Buildroot] [PATCH v5 2/5] board/qemu: add post-image script for gitlab qemu testing Romain Naour
@ 2020-04-13  7:25   ` Yann E. MORIN
  0 siblings, 0 replies; 13+ messages in thread
From: Yann E. MORIN @ 2020-04-13  7:25 UTC (permalink / raw)
  To: buildroot

Romain, jugurtha, All,

On 2020-02-17 21:50 +0100, Romain Naour spake thusly:
> This commit add a post-image script to be used by each qemu
> board defconfig in order to generate start-qemu.sh in BINARIES_DIR.
> The start-qemu.sh script can be used by Buildroot user to start
> Qemu or by a gitlab CI.
> start-qemu.sh is not started automatically at the end of the build.
> 
> To find the correct qemu command line, we use the second post
> script argument which must contain "$(BR2_DEFCONFIG)"
> 
>   BR2_ROOTFS_POST_SCRIPT_ARGS="$(BR2_DEFCONFIG)"
> 
> The post-image script expect something like
> "/path/to/qemu_aarch64_virt_defconfig" in BR2_DEFCONFIG.
> 
> Doing a basename allow to retrieve the name of the defconfig
> file that should match on on the "tag" previously introduced in
> readme.txt files.
> 
> The script start-qemu.sh is able to modify the qemu command
> line if CI_JOB_NAME defined in the environment. This allow
> to disable the graphical output and redirect serial I/Os to
> console.

Like Thomas, I'm not too keen on this gitlab-ci knowledge leaking in
there...

I think we can abstract that in the post-build script to just prepare
the two sets of options, the default one (graphical), or the serial-only
case, and store both sets in start-qemu.sh.

Then start-qemu.sh chooses which to use based on ${1}: if it is
'serial-only' (or whatever), then ti uses the serial-only options,
otherwise it uses the graphical options.

I've already hack that: http://code.bulix.org/ip443p-1282035?raw

Of course, whis will require a bit of rewriting in the latter patch that
tries to extract the qemu command line to run it in gitlab-ci, but I've
anyway already replied to that patch (hint: it would just need to call
start-qemu.sh with the new parameter).

I understand this review is coming late, so I'll take on me to apply
those changes and respin the series a bit later today...

Regards,
Yann E. MORIN.

> Only sh4/sh4eb needs a special handling by adding
> "-serial stdio -display none" instead of "-display none".
> 
> Signed-off-by: Romain Naour <romain.naour@smile.fr>
> ---
> v5: update the script after Thomas's review [1] [2]
> 
> [1] http://lists.busybox.net/pipermail/buildroot/2020-February/273820.html
> [2] http://lists.busybox.net/pipermail/buildroot/2020-February/273822.html
> ---
>  board/qemu/post-image.sh | 50 ++++++++++++++++++++++++++++++++++++++++
>  1 file changed, 50 insertions(+)
>  create mode 100755 board/qemu/post-image.sh
> 
> diff --git a/board/qemu/post-image.sh b/board/qemu/post-image.sh
> new file mode 100755
> index 0000000000..804c5f6110
> --- /dev/null
> +++ b/board/qemu/post-image.sh
> @@ -0,0 +1,50 @@
> +#!/bin/bash
> +
> +QEMU_BOARD_DIR="$(dirname $0)"
> +DEFCONFIG_NAME="$(basename $2)"
> +README_FILES="${QEMU_BOARD_DIR}/*/readme.txt"
> +START_QEMU_SCRIPT="${BINARIES_DIR}/start-qemu.sh"
> +
> +if [[ "${DEFCONFIG_NAME}" =~ ^"qemu_*" ]]; then
> +    # Not a Qemu defconfig, can't test.
> +    exit 0
> +fi
> +
> +# Search for "# qemu_*_defconfig" tag in all readme.txt files.
> +# Qemu command line on multilines using back slash are accepted.
> +QEMU_CMD_LINE=$(sed -r ':a; /\\$/N; s/\\\n//; s/\t/ /; ta; /# '${DEFCONFIG_NAME}'$/!d; s/#.*//' ${README_FILES})
> +
> +if [ -z "$QEMU_CMD_LINE" ]; then
> +    # No Qemu cmd line found, can't test.
> +    exit 0
> +fi
> +
> +# Replace output/images path by ${IMAGE_DIR} since the script
> +# will be in the same directory as the kernel and the rootfs images.
> +QEMU_CMD_LINE=${QEMU_CMD_LINE//output\/images/\${IMAGE_DIR\}}
> +
> +# Test if we are running in gitlab
> +if [ -n "$CI_JOB_NAME" ]; then
> +    # Remove -serial stdio if present
> +    QEMU_CMD_LINE=${QEMU_CMD_LINE//-serial stdio/}
> +
> +    # Disable graphical output and redirect serial I/Os to console
> +    case ${DEFCONFIG_NAME} in
> +        # Special case for SH4
> +        qemu_sh4eb_r2d_defconfig | qemu_sh4_r2d_defconfig)
> +            QEMU_CMD_LINE="$QEMU_CMD_LINE -serial stdio -display none"
> +            ;;
> +        *)
> +            QEMU_CMD_LINE="$QEMU_CMD_LINE -nographic"
> +            ;;
> +    esac
> +fi
> +
> +cat << EOF > $START_QEMU_SCRIPT
> +#!/bin/sh
> +IMAGE_DIR="\$(dirname \$0)"
> +
> +$QEMU_CMD_LINE
> +EOF
> +
> +chmod +x $START_QEMU_SCRIPT
> -- 
> 2.24.1
> 
> _______________________________________________
> buildroot mailing list
> buildroot at busybox.net
> http://lists.busybox.net/mailman/listinfo/buildroot

-- 
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 561 099 427 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Buildroot] [PATCH v5 0/5] gitlab Qemu runtime testing
  2020-02-17 20:50 [Buildroot] [PATCH v5 0/5] gitlab Qemu runtime testing Romain Naour
                   ` (5 preceding siblings ...)
  2020-04-12 14:11 ` [Buildroot] [PATCH v5 0/5] gitlab Qemu runtime testing Thomas Petazzoni
@ 2020-04-13 19:56 ` Yann E. MORIN
  2020-04-13 20:03   ` Romain Naour
  6 siblings, 1 reply; 13+ messages in thread
From: Yann E. MORIN @ 2020-04-13 19:56 UTC (permalink / raw)
  To: buildroot

Roma, Jugurtha, All,

On 2020-02-17 21:50 +0100, Romain Naour spake thusly:
> This new iteration take into account the previous review with
> some additional rework [1] [2] [5] [6].
> 
> Remove patch already merged.
> 
> Based on the Yann's review during the Buildroot Developper meeting
> FOSDEM 2020 [2], add a tag in each readme file to easily retrieve
> the qemu command line to be used for runtime testing in gitlab.
> 
> This tag is used by a post-image script to generate a script
> called start-qemu.sh that can be used by users or by a new python
> script for running the test in gitlab but only when a Qemu
> defconfig is built.
> 
> Finally add this new python script to .gitlab-ci.yml.
> 
> This series has been tested on Gitlab [3], please ignore the
> failing test related to missing host-python3 modules needed by
> optee-os package [4].

I've finally applied this series, after reworking in-depth the two
scripts. Please review the commits and watch the pipelines, and yell at
me if I broke it too badly... Thanks you!

Regards,
Yann E. MORIN.

> This new iteration has been tested in gitlab [7].
> 
> [1] http://lists.busybox.net/pipermail/buildroot/2019-May/249432.html
> [2] http://lists.busybox.net/pipermail/buildroot/2020-February/273189.html
> [3] https://gitlab.com/kubu93/buildroot/pipelines/116298701
> [4] http://lists.busybox.net/pipermail/buildroot/2020-February/273738.html
> [5] http://lists.busybox.net/pipermail/buildroot/2020-February/273820.html
> [6] http://lists.busybox.net/pipermail/buildroot/2020-February/273822.html
> [7] https://gitlab.com/kubu93/buildroot/pipelines/116967006
> 
> Cc: Yann E. MORIN <yann.morin.1998@free.fr>
> Jugurtha BELKALEM (2):
>   support/scripts/boot-qemu-image.py: boot Qemu images with Qemu-system.
>   gitlab.yml.in*: enable Qemu gitlab testing
> 
> Romain Naour (3):
>   board/qemu: add defconfig file name as tag after the qemu command line
>   board/qemu: add post-image script for gitlab qemu testing
>   configs/qemu*: use the post-image script with "$(BR2_DEFCONFIG)" as
>     argument.
> 
>  .gitlab-ci.yml                             |   7 ++
>  .gitlab-ci.yml.in                          |   7 ++
>  board/qemu/aarch64-virt/readme.txt         |   2 +-
>  board/qemu/arm-versatile/readme.txt        |   4 +-
>  board/qemu/arm-vexpress/readme.txt         |   2 +-
>  board/qemu/csky/readme.txt                 |  11 ++-
>  board/qemu/m68k-mcf5208/readme.txt         |   2 +-
>  board/qemu/m68k-q800/readme.txt            |   2 +-
>  board/qemu/microblazebe-mmu/readme.txt     |   2 +-
>  board/qemu/microblazeel-mmu/readme.txt     |   2 +-
>  board/qemu/mips32r2-malta/readme.txt       |   2 +-
>  board/qemu/mips32r2el-malta/readme.txt     |   2 +-
>  board/qemu/mips32r6-malta/readme.txt       |   2 +-
>  board/qemu/mips32r6el-malta/readme.txt     |   2 +-
>  board/qemu/mips64-malta/readme.txt         |   2 +-
>  board/qemu/mips64el-malta/readme.txt       |   2 +-
>  board/qemu/mips64r6-malta/readme.txt       |   2 +-
>  board/qemu/mips64r6el-malta/readme.txt     |   2 +-
>  board/qemu/nios2-10m50/readme.txt          |   2 +-
>  board/qemu/or1k/readme.txt                 |   2 +-
>  board/qemu/post-image.sh                   |  50 ++++++++++
>  board/qemu/ppc-g3beige/readme.txt          |   2 +-
>  board/qemu/ppc-mac99/readme.txt            |   2 +-
>  board/qemu/ppc-mpc8544ds/readme.txt        |   2 +-
>  board/qemu/ppc-virtex-ml507/readme.txt     |   2 +-
>  board/qemu/ppc64-e5500/readme.txt          |   2 +-
>  board/qemu/ppc64-pseries/readme.txt        |   2 +-
>  board/qemu/ppc64le-pseries/readme.txt      |   2 +-
>  board/qemu/riscv32-virt/readme.txt         |   2 +-
>  board/qemu/riscv64-virt/readme.txt         |   2 +-
>  board/qemu/sh4-r2d/readme.txt              |   2 +-
>  board/qemu/sh4eb-r2d/readme.txt            |   2 +-
>  board/qemu/sparc-ss10/readme.txt           |   2 +-
>  board/qemu/sparc64-sun4u/readme.txt        |   2 +-
>  board/qemu/x86/readme.txt                  |   2 +-
>  board/qemu/x86_64/readme.txt               |   2 +-
>  board/qemu/xtensa-lx60/readme.txt          |   4 +-
>  configs/qemu_aarch64_virt_defconfig        |   4 +
>  configs/qemu_arm_versatile_defconfig       |   4 +
>  configs/qemu_arm_versatile_nommu_defconfig |   4 +
>  configs/qemu_arm_vexpress_defconfig        |   4 +
>  configs/qemu_csky610_virt_defconfig        |   4 +
>  configs/qemu_csky807_virt_defconfig        |   4 +
>  configs/qemu_csky810_virt_defconfig        |   4 +
>  configs/qemu_csky860_virt_defconfig        |   4 +
>  configs/qemu_m68k_mcf5208_defconfig        |   4 +
>  configs/qemu_m68k_q800_defconfig           |   4 +
>  configs/qemu_microblazebe_mmu_defconfig    |   4 +
>  configs/qemu_microblazeel_mmu_defconfig    |   4 +
>  configs/qemu_mips32r2_malta_defconfig      |   4 +
>  configs/qemu_mips32r2el_malta_defconfig    |   4 +
>  configs/qemu_mips32r6_malta_defconfig      |   4 +
>  configs/qemu_mips32r6el_malta_defconfig    |   4 +
>  configs/qemu_mips64_malta_defconfig        |   4 +
>  configs/qemu_mips64el_malta_defconfig      |   4 +
>  configs/qemu_mips64r6_malta_defconfig      |   4 +
>  configs/qemu_mips64r6el_malta_defconfig    |   4 +
>  configs/qemu_nios2_10m50_defconfig         |   4 +
>  configs/qemu_or1k_defconfig                |   4 +
>  configs/qemu_ppc64_e5500_defconfig         |   4 +
>  configs/qemu_ppc64_pseries_defconfig       |   4 +
>  configs/qemu_ppc64le_pseries_defconfig     |   4 +
>  configs/qemu_ppc_g3beige_defconfig         |   4 +
>  configs/qemu_ppc_mac99_defconfig           |   4 +
>  configs/qemu_ppc_mpc8544ds_defconfig       |   4 +
>  configs/qemu_ppc_virtex_ml507_defconfig    |   4 +
>  configs/qemu_riscv32_virt_defconfig        |   4 +
>  configs/qemu_riscv64_virt_defconfig        |   4 +
>  configs/qemu_sh4_r2d_defconfig             |   4 +
>  configs/qemu_sh4eb_r2d_defconfig           |   4 +
>  configs/qemu_sparc64_sun4u_defconfig       |   4 +
>  configs/qemu_sparc_ss10_defconfig          |   4 +
>  configs/qemu_x86_64_defconfig              |   4 +
>  configs/qemu_x86_defconfig                 |   4 +
>  configs/qemu_xtensa_lx60_defconfig         |   4 +
>  configs/qemu_xtensa_lx60_nommu_defconfig   |   4 +
>  support/scripts/boot-qemu-image.py         | 105 +++++++++++++++++++++
>  77 files changed, 368 insertions(+), 38 deletions(-)
>  create mode 100755 board/qemu/post-image.sh
>  create mode 100755 support/scripts/boot-qemu-image.py
> 
> -- 
> 2.24.1
> 

-- 
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 561 099 427 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Buildroot] [PATCH v5 0/5] gitlab Qemu runtime testing
  2020-04-13 19:56 ` Yann E. MORIN
@ 2020-04-13 20:03   ` Romain Naour
  0 siblings, 0 replies; 13+ messages in thread
From: Romain Naour @ 2020-04-13 20:03 UTC (permalink / raw)
  To: buildroot

Hi Yann, All,

Le 13/04/2020 ? 21:56, Yann E. MORIN a ?crit?:
> Roma, Jugurtha, All,
> 
> On 2020-02-17 21:50 +0100, Romain Naour spake thusly:
>> This new iteration take into account the previous review with
>> some additional rework [1] [2] [5] [6].
>>
>> Remove patch already merged.
>>
>> Based on the Yann's review during the Buildroot Developper meeting
>> FOSDEM 2020 [2], add a tag in each readme file to easily retrieve
>> the qemu command line to be used for runtime testing in gitlab.
>>
>> This tag is used by a post-image script to generate a script
>> called start-qemu.sh that can be used by users or by a new python
>> script for running the test in gitlab but only when a Qemu
>> defconfig is built.
>>
>> Finally add this new python script to .gitlab-ci.yml.
>>
>> This series has been tested on Gitlab [3], please ignore the
>> failing test related to missing host-python3 modules needed by
>> optee-os package [4].
> 
> I've finally applied this series, after reworking in-depth the two
> scripts. Please review the commits and watch the pipelines, and yell at
> me if I broke it too badly... Thanks you!

Thanks you too for improving the series!

Best regards,
Romain


> 
> Regards,
> Yann E. MORIN.
> 

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Buildroot] [PATCH v5 4/5] support/scripts/boot-qemu-image.py: boot Qemu images with Qemu-system.
  2020-04-13  7:15   ` Yann E. MORIN
@ 2020-04-13 21:38     ` Romain Naour
  0 siblings, 0 replies; 13+ messages in thread
From: Romain Naour @ 2020-04-13 21:38 UTC (permalink / raw)
  To: buildroot

Hi Yann, All,

Le 13/04/2020 ? 09:15, Yann E. MORIN a ?crit?:
> Romain, Jugurtha, All,
> 
> On 2020-02-17 21:50 +0100, Romain Naour spake thusly:
>> From: Jugurtha BELKALEM <jugurtha.belkalem@smile.fr>
>> This script is intended to be used by gitlab CI to test
>> at runtime Qemu images generated by Buildroot's Qemu defconfigs.
> [--SNIP--]
>> diff --git a/support/scripts/boot-qemu-image.py b/support/scripts/boot-qemu-image.py
>> new file mode 100755
>> index 0000000000..abaf88d446
>> --- /dev/null
>> +++ b/support/scripts/boot-qemu-image.py
>> @@ -0,0 +1,105 @@
>> +#!/usr/bin/env python3
>> +
>> +# This script expect to run from the Buildroot top directory.
>> +
>> +import pexpect
>> +import sys
>> +import os
>> +import re
>> +import shlex
>> +import shutil
>> +import subprocess
>> +
>> +argc = len(sys.argv)
>> +if not (argc == 2):
>> +    print("Error: incorrect number of arguments")
>> +    print("""Usage: boot-qemu-image.py <qemu_arch_defconfig>""")
>> +    sys.exit(1)
>> +
>> +defconfig_filename = sys.argv[1]
>> +
>> +# Ignore non Qemu defconfig
>> +if defconfig_filename.startswith('qemu_') is False:
>> +    sys.exit(0)
>> +
>> +qemu_start_script_filepath = os.path.join(os.getcwd(), 'output/images/start-qemu.sh')
>> +
>> +# Ignore if start-qemu.sh is missing, we can't test.
>> +if not os.path.exists(qemu_start_script_filepath):
>> +    print("Error: " + qemu_start_script_filepath) + " file is missing."
>> +    sys.exit(1)
>> +
>> +qemu_cmd = ""
>> +
>> +with open(qemu_start_script_filepath, 'r') as script_file:
>> +    for line in script_file:
>> +        if re.search("qemu-system", line):
>> +            qemu_cmd = line
>> +            break
>> +
>> +if not qemu_cmd:
>> +    print("Error: No QEMU command line found in " + qemu_start_script_filepath)
>> +    sys.exit(1)
> 
> Why do you extract the command line, and can't directly run the script?
> 
>> +# Replace bashism
>> +qemu_cmd = line.replace("${IMAGE_DIR}", "output/images")
> 
> This would avoid this dance...
> 
>> +# pexpect needs a list, convert a sting to a list and escape quoted substring.
>> +qemu_cmd = shlex.split(qemu_cmd)
> 
> ... as well as this one.
> 
>> +# Use host Qemu if provided by Buildroot.
>> +os.environ["PATH"] = os.getcwd() + "/output/host/bin" + os.pathsep + os.environ["PATH"]
> 
> And this one can be avoided too if the script is called with PATH
> properly set to include ${HOST_DIR}/bin. This should be easy, as this
> script is only expected to run from the gitlab-ci pipelines.
> 
>> +# Ignore when no Qemu emulation is available
>> +if not shutil.which(qemu_cmd[0]):
>> +    print("No " + qemu_cmd[0] + " binary available, THIS DEFCONFIG CAN NOT BE TESTED!")
>> +    sys.exit(0)

Extracting the qemu command line in the boot-qemu-image.py allowed to test if at
least one qemu-systemd-<arch> binary is present. Starting start-qemu.sh directly
crash the python script.

https://gitlab.com/kubu93/buildroot/-/jobs/509053135/artifacts/file/runtime-test.log

csky and or1k defconfig doesn't select any host-qemu and there is none installed
in the Buildroot Docker image used by gitlab CI.

It seems we need to catch the exception while calling pexpect.spawn(qemu_start...)

https://git.buildroot.net/buildroot/tree/support/scripts/boot-qemu-image.py#n22

Or just add this test in start-qemu.sh

Best regards,
Romain

^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2020-04-13 21:38 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-02-17 20:50 [Buildroot] [PATCH v5 0/5] gitlab Qemu runtime testing Romain Naour
2020-02-17 20:50 ` [Buildroot] [PATCH v5 1/5] board/qemu: add defconfig file name as tag after the qemu command line Romain Naour
2020-02-17 20:50 ` [Buildroot] [PATCH v5 2/5] board/qemu: add post-image script for gitlab qemu testing Romain Naour
2020-04-13  7:25   ` Yann E. MORIN
2020-02-17 20:50 ` [Buildroot] [PATCH v5 3/5] configs/qemu*: use the post-image script with "$(BR2_DEFCONFIG)" as argument Romain Naour
2020-02-17 20:50 ` [Buildroot] [PATCH v5 4/5] support/scripts/boot-qemu-image.py: boot Qemu images with Qemu-system Romain Naour
2020-04-13  7:15   ` Yann E. MORIN
2020-04-13 21:38     ` Romain Naour
2020-02-17 20:50 ` [Buildroot] [PATCH v5 5/5] gitlab.yml.in*: enable Qemu gitlab testing Romain Naour
2020-04-12 14:11 ` [Buildroot] [PATCH v5 0/5] gitlab Qemu runtime testing Thomas Petazzoni
2020-04-12 20:00   ` Romain Naour
2020-04-13 19:56 ` Yann E. MORIN
2020-04-13 20:03   ` Romain Naour

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.