qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/8] hw/arm: Add raspi[0123] acceptance tests
@ 2020-02-15 19:22 Philippe Mathieu-Daudé
  2020-02-15 19:22 ` [PATCH 1/8] tests/acceptance/boot_linux_console: Use raspi console model as key Philippe Mathieu-Daudé
                   ` (7 more replies)
  0 siblings, 8 replies; 17+ messages in thread
From: Philippe Mathieu-Daudé @ 2020-02-15 19:22 UTC (permalink / raw)
  To: qemu-devel
  Cc: Peter Maydell, Philippe Mathieu-Daudé,
	Andrew Baumann, Igor Mammedov

- Add raspi0/raspi1 Linux boot tests
- Add raspi2/raspi3 U-Boot tests
- Add bcm2835 framebuffer test

I'll send another series moving these tests from boot_linux_console.py
to machine_arm_raspi.py, but this doesn't affect the review.

raspi0/raspi1 are based on "hw/arm: Add raspi0 and raspi1 machines".
Based-on: <20200215191543.3235-1-f4bug@amsat.org>

Philippe Mathieu-Daudé (8):
  tests/acceptance/boot_linux_console: Use raspi console model as key
  tests/acceptance/boot_linux_console: Add raspi version=2 parameter
  tests/acceptance/boot_linux_console: Test the raspi1 console
  tests/acceptance/boot_linux_console: Test the raspi0 console
  tests/acceptance/boot_linux_console: Test the raspi1 AUX console
  tests/boot_linux_console: Test booting U-Boot on the Raspberry Pi 2
  tests/boot_linux_console: Test booting U-Boot on the Raspberry Pi 3
  tests/acceptance: Count Raspberry Pi logos displayed on framebuffer

 tests/acceptance/boot_linux_console.py | 207 +++++++++++++++++++++++--
 1 file changed, 195 insertions(+), 12 deletions(-)

-- 
2.21.1



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

* [PATCH 1/8] tests/acceptance/boot_linux_console: Use raspi console model as key
  2020-02-15 19:22 [PATCH 0/8] hw/arm: Add raspi[0123] acceptance tests Philippe Mathieu-Daudé
@ 2020-02-15 19:22 ` Philippe Mathieu-Daudé
  2020-02-17  8:25   ` Luc Michel
  2020-02-15 19:22 ` [PATCH 2/8] tests/acceptance/boot_linux_console: Add raspi version=2 parameter Philippe Mathieu-Daudé
                   ` (6 subsequent siblings)
  7 siblings, 1 reply; 17+ messages in thread
From: Philippe Mathieu-Daudé @ 2020-02-15 19:22 UTC (permalink / raw)
  To: qemu-devel
  Cc: Peter Maydell, Philippe Mathieu-Daudé,
	Andrew Baumann, Igor Mammedov

Python dictionary are not that expensive. Use a key makes the
code easier to review.

Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
---
 tests/acceptance/boot_linux_console.py | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/tests/acceptance/boot_linux_console.py b/tests/acceptance/boot_linux_console.py
index 34d37eba3b..8cfc758d42 100644
--- a/tests/acceptance/boot_linux_console.py
+++ b/tests/acceptance/boot_linux_console.py
@@ -347,14 +347,14 @@ def test_arm_emcraft_sf2(self):
         self.vm.launch()
         self.wait_for_console_pattern('init started: BusyBox')
 
-    def do_test_arm_raspi2(self, uart_id):
+    def do_test_arm_raspi2(self, uart_model):
         """
         The kernel can be rebuilt using the kernel source referenced
         and following the instructions on the on:
         https://www.raspberrypi.org/documentation/linux/kernel/building.md
         """
         serial_kernel_cmdline = {
-            0: 'earlycon=pl011,0x3f201000 console=ttyAMA0',
+            'pl011': 'earlycon=pl011,0x3f201000 console=ttyAMA0',
         }
         deb_url = ('http://archive.raspberrypi.org/debian/'
                    'pool/main/r/raspberrypi-firmware/'
@@ -366,7 +366,7 @@ def do_test_arm_raspi2(self, uart_id):
 
         self.vm.set_console()
         kernel_command_line = (self.KERNEL_COMMON_COMMAND_LINE +
-                               serial_kernel_cmdline[uart_id])
+                               serial_kernel_cmdline[uart_model])
         self.vm.add_args('-kernel', kernel_path,
                          '-dtb', dtb_path,
                          '-append', kernel_command_line)
@@ -380,7 +380,7 @@ def test_arm_raspi2_uart0(self):
         :avocado: tags=machine:raspi2
         :avocado: tags=device:pl011
         """
-        self.do_test_arm_raspi2(0)
+        self.do_test_arm_raspi2('pl011')
 
     def test_arm_exynos4210_initrd(self):
         """
-- 
2.21.1



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

* [PATCH 2/8] tests/acceptance/boot_linux_console: Add raspi version=2 parameter
  2020-02-15 19:22 [PATCH 0/8] hw/arm: Add raspi[0123] acceptance tests Philippe Mathieu-Daudé
  2020-02-15 19:22 ` [PATCH 1/8] tests/acceptance/boot_linux_console: Use raspi console model as key Philippe Mathieu-Daudé
@ 2020-02-15 19:22 ` Philippe Mathieu-Daudé
  2020-02-17  8:26   ` Luc Michel
  2020-02-15 19:22 ` [PATCH 3/8] tests/acceptance/boot_linux_console: Test the raspi1 console Philippe Mathieu-Daudé
                   ` (5 subsequent siblings)
  7 siblings, 1 reply; 17+ messages in thread
From: Philippe Mathieu-Daudé @ 2020-02-15 19:22 UTC (permalink / raw)
  To: qemu-devel
  Cc: Peter Maydell, Philippe Mathieu-Daudé,
	Andrew Baumann, Igor Mammedov

We want to tests different Raspberry Pi machines. Refactor to
take the board version as argument.

Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
---
 tests/acceptance/boot_linux_console.py | 21 +++++++++++++++------
 1 file changed, 15 insertions(+), 6 deletions(-)

diff --git a/tests/acceptance/boot_linux_console.py b/tests/acceptance/boot_linux_console.py
index 8cfc758d42..a1b6e70d3f 100644
--- a/tests/acceptance/boot_linux_console.py
+++ b/tests/acceptance/boot_linux_console.py
@@ -347,26 +347,34 @@ def test_arm_emcraft_sf2(self):
         self.vm.launch()
         self.wait_for_console_pattern('init started: BusyBox')
 
-    def do_test_arm_raspi2(self, uart_model):
+    def do_test_arm_raspi(self, version, uart_model):
         """
         The kernel can be rebuilt using the kernel source referenced
         and following the instructions on the on:
         https://www.raspberrypi.org/documentation/linux/kernel/building.md
         """
         serial_kernel_cmdline = {
-            'pl011': 'earlycon=pl011,0x3f201000 console=ttyAMA0',
+            'pl011': {
+                2: 'earlycon=pl011,0x3f201000 console=ttyAMA0',
+            },
+        }
+        kernel = {
+            2: '/boot/kernel7.img',
+        }
+        dtb = {
+            2: '/boot/bcm2709-rpi-2-b.dtb',
         }
         deb_url = ('http://archive.raspberrypi.org/debian/'
                    'pool/main/r/raspberrypi-firmware/'
                    'raspberrypi-kernel_1.20190215-1_armhf.deb')
         deb_hash = 'cd284220b32128c5084037553db3c482426f3972'
         deb_path = self.fetch_asset(deb_url, asset_hash=deb_hash)
-        kernel_path = self.extract_from_deb(deb_path, '/boot/kernel7.img')
-        dtb_path = self.extract_from_deb(deb_path, '/boot/bcm2709-rpi-2-b.dtb')
+        kernel_path = self.extract_from_deb(deb_path, kernel[version])
+        dtb_path = self.extract_from_deb(deb_path, dtb[version])
 
         self.vm.set_console()
         kernel_command_line = (self.KERNEL_COMMON_COMMAND_LINE +
-                               serial_kernel_cmdline[uart_model])
+                               serial_kernel_cmdline[uart_model][version])
         self.vm.add_args('-kernel', kernel_path,
                          '-dtb', dtb_path,
                          '-append', kernel_command_line)
@@ -378,9 +386,10 @@ def test_arm_raspi2_uart0(self):
         """
         :avocado: tags=arch:arm
         :avocado: tags=machine:raspi2
+        :avocado: tags=cpu:cortex-a7
         :avocado: tags=device:pl011
         """
-        self.do_test_arm_raspi2('pl011')
+        self.do_test_arm_raspi(2, 'pl011')
 
     def test_arm_exynos4210_initrd(self):
         """
-- 
2.21.1



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

* [PATCH 3/8] tests/acceptance/boot_linux_console: Test the raspi1 console
  2020-02-15 19:22 [PATCH 0/8] hw/arm: Add raspi[0123] acceptance tests Philippe Mathieu-Daudé
  2020-02-15 19:22 ` [PATCH 1/8] tests/acceptance/boot_linux_console: Use raspi console model as key Philippe Mathieu-Daudé
  2020-02-15 19:22 ` [PATCH 2/8] tests/acceptance/boot_linux_console: Add raspi version=2 parameter Philippe Mathieu-Daudé
@ 2020-02-15 19:22 ` Philippe Mathieu-Daudé
  2020-02-17  8:27   ` Luc Michel
  2020-02-15 19:22 ` [PATCH 4/8] tests/acceptance/boot_linux_console: Test the raspi0 console Philippe Mathieu-Daudé
                   ` (4 subsequent siblings)
  7 siblings, 1 reply; 17+ messages in thread
From: Philippe Mathieu-Daudé @ 2020-02-15 19:22 UTC (permalink / raw)
  To: qemu-devel
  Cc: Peter Maydell, Philippe Mathieu-Daudé,
	Andrew Baumann, Igor Mammedov

  $ avocado --show=app,console run -t machine:raspi1 tests/acceptance/
  JOB ID     : c49310d4a21444f03789cd2c443d8c54a29ffd0a
  JOB LOG    : avocado/job-results/job-2020-02-05T23.52-c49310d/job.log
   (1/1) tests/acceptance/boot_linux_console.py:BootLinuxConsole.test_arm_raspi1_uart0:
  console: [    0.000000] Booting Linux on physical CPU 0x0
  console: [    0.000000] Linux version 4.14.98+ (dom@dom-XPS-13-9370) (gcc version 4.9.3 (crosstool-NG crosstool-ng-1.22.0-88-g8460611)) #1200 Tue Feb 12 20:11:02 GMT 2019
  console: [    0.000000] CPU: ARMv6-compatible processor [410fb767] revision 7 (ARMv7), cr=00c5387d
  console: [    0.000000] CPU: VIPT aliasing data cache, unknown instruction cache
  console: [    0.000000] OF: fdt: Machine model: Raspberry Pi Model B
  console: [    0.000000] earlycon: pl11 at MMIO 0x20201000 (options '')
  console: [    0.000000] bootconsole [pl11] enabled
  console: [    0.000000] Memory policy: Data cache writeback
  console: [    0.000000] cma: Reserved 8 MiB at 0x1b800000
  console: [    0.000000] Built 1 zonelists, mobility grouping on.  Total pages: 113680
  console: [    0.000000] Kernel command line: printk.time=0 earlycon=pl011,0x20201000 console=ttyAMA0
  PASS (12.93 s)
  RESULTS    : PASS 1 | ERROR 0 | FAIL 0 | SKIP 0 | WARN 0 | INTERRUPT 0 | CANCEL 0
  JOB TIME   : 13.18 s

Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
---
 tests/acceptance/boot_linux_console.py | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/tests/acceptance/boot_linux_console.py b/tests/acceptance/boot_linux_console.py
index a1b6e70d3f..c8eabae695 100644
--- a/tests/acceptance/boot_linux_console.py
+++ b/tests/acceptance/boot_linux_console.py
@@ -355,13 +355,16 @@ def do_test_arm_raspi(self, version, uart_model):
         """
         serial_kernel_cmdline = {
             'pl011': {
+                1: 'earlycon=pl011,0x20201000 console=ttyAMA0',
                 2: 'earlycon=pl011,0x3f201000 console=ttyAMA0',
             },
         }
         kernel = {
+            1: '/boot/kernel.img',
             2: '/boot/kernel7.img',
         }
         dtb = {
+            1: '/boot/bcm2708-rpi-b.dtb',
             2: '/boot/bcm2709-rpi-2-b.dtb',
         }
         deb_url = ('http://archive.raspberrypi.org/debian/'
@@ -382,6 +385,15 @@ def do_test_arm_raspi(self, version, uart_model):
         console_pattern = 'Kernel command line: %s' % kernel_command_line
         self.wait_for_console_pattern(console_pattern)
 
+    def test_arm_raspi1_uart0(self):
+        """
+        :avocado: tags=arch:arm
+        :avocado: tags=machine:raspi1
+        :avocado: tags=cpu:arm1176
+        :avocado: tags=device:pl011
+        """
+        self.do_test_arm_raspi(1, 'pl011')
+
     def test_arm_raspi2_uart0(self):
         """
         :avocado: tags=arch:arm
-- 
2.21.1



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

* [PATCH 4/8] tests/acceptance/boot_linux_console: Test the raspi0 console
  2020-02-15 19:22 [PATCH 0/8] hw/arm: Add raspi[0123] acceptance tests Philippe Mathieu-Daudé
                   ` (2 preceding siblings ...)
  2020-02-15 19:22 ` [PATCH 3/8] tests/acceptance/boot_linux_console: Test the raspi1 console Philippe Mathieu-Daudé
@ 2020-02-15 19:22 ` Philippe Mathieu-Daudé
  2020-02-17  8:27   ` Luc Michel
  2020-02-15 19:22 ` [PATCH 5/8] tests/acceptance/boot_linux_console: Test the raspi1 AUX console Philippe Mathieu-Daudé
                   ` (3 subsequent siblings)
  7 siblings, 1 reply; 17+ messages in thread
From: Philippe Mathieu-Daudé @ 2020-02-15 19:22 UTC (permalink / raw)
  To: qemu-devel
  Cc: Peter Maydell, Philippe Mathieu-Daudé,
	Andrew Baumann, Igor Mammedov

  $ avocado --show=app,console run -t machine:raspi0 tests/acceptance/
  JOB ID     : af8e017486290758bff39c986934134199af3556
  JOB LOG    : avocado/job-results/job-2020-02-05T23.53-af8e017/job.log
   (1/1) tests/acceptance/boot_linux_console.py:BootLinuxConsole.test_arm_raspi0_uart0:
  console: [    0.000000] Booting Linux on physical CPU 0x0
  console: [    0.000000] Linux version 4.14.98+ (dom@dom-XPS-13-9370) (gcc version 4.9.3 (crosstool-NG crosstool-ng-1.22.0-88-g8460611)) #1200 Tue Feb 12 20:11:02 GMT 2019
  console: [    0.000000] CPU: ARMv6-compatible processor [410fb767] revision 7 (ARMv7), cr=00c5387d
  console: [    0.000000] CPU: VIPT aliasing data cache, unknown instruction cache
  console: [    0.000000] OF: fdt: Machine model: Raspberry Pi Zero W
  console: [    0.000000] earlycon: pl11 at MMIO 0x20201000 (options '')
  console: [    0.000000] bootconsole [pl11] enabled
  console: [    0.000000] Memory policy: Data cache writeback
  console: [    0.000000] cma: Reserved 8 MiB at 0x1b800000
  console: [    0.000000] Built 1 zonelists, mobility grouping on.  Total pages: 113680
  console: [    0.000000] Kernel command line: printk.time=0 earlycon=pl011,0x20201000 console=ttyAMA0
  PASS (12.59 s)
  RESULTS    : PASS 1 | ERROR 0 | FAIL 0 | SKIP 0 | WARN 0 | INTERRUPT 0 | CANCEL 0
  JOB TIME   : 12.88 s

Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
---
 tests/acceptance/boot_linux_console.py | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/tests/acceptance/boot_linux_console.py b/tests/acceptance/boot_linux_console.py
index c8eabae695..bd3f0fc852 100644
--- a/tests/acceptance/boot_linux_console.py
+++ b/tests/acceptance/boot_linux_console.py
@@ -355,15 +355,18 @@ def do_test_arm_raspi(self, version, uart_model):
         """
         serial_kernel_cmdline = {
             'pl011': {
+                0: 'earlycon=pl011,0x20201000 console=ttyAMA0',
                 1: 'earlycon=pl011,0x20201000 console=ttyAMA0',
                 2: 'earlycon=pl011,0x3f201000 console=ttyAMA0',
             },
         }
         kernel = {
+            0: '/boot/kernel.img',
             1: '/boot/kernel.img',
             2: '/boot/kernel7.img',
         }
         dtb = {
+            0: '/boot/bcm2708-rpi-0-w.dtb',
             1: '/boot/bcm2708-rpi-b.dtb',
             2: '/boot/bcm2709-rpi-2-b.dtb',
         }
@@ -385,6 +388,15 @@ def do_test_arm_raspi(self, version, uart_model):
         console_pattern = 'Kernel command line: %s' % kernel_command_line
         self.wait_for_console_pattern(console_pattern)
 
+    def test_arm_raspi0_uart0(self):
+        """
+        :avocado: tags=arch:arm
+        :avocado: tags=machine:raspi0
+        :avocado: tags=cpu:arm1176
+        :avocado: tags=device:pl011
+        """
+        self.do_test_arm_raspi(0, 'pl011')
+
     def test_arm_raspi1_uart0(self):
         """
         :avocado: tags=arch:arm
-- 
2.21.1



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

* [PATCH 5/8] tests/acceptance/boot_linux_console: Test the raspi1 AUX console
  2020-02-15 19:22 [PATCH 0/8] hw/arm: Add raspi[0123] acceptance tests Philippe Mathieu-Daudé
                   ` (3 preceding siblings ...)
  2020-02-15 19:22 ` [PATCH 4/8] tests/acceptance/boot_linux_console: Test the raspi0 console Philippe Mathieu-Daudé
@ 2020-02-15 19:22 ` Philippe Mathieu-Daudé
  2020-02-17  8:28   ` Luc Michel
  2020-02-15 19:22 ` [PATCH 6/8] tests/boot_linux_console: Test booting U-Boot on the Raspberry Pi 2 Philippe Mathieu-Daudé
                   ` (2 subsequent siblings)
  7 siblings, 1 reply; 17+ messages in thread
From: Philippe Mathieu-Daudé @ 2020-02-15 19:22 UTC (permalink / raw)
  To: qemu-devel
  Cc: Peter Maydell, Philippe Mathieu-Daudé,
	Andrew Baumann, Igor Mammedov

  $ avocado --show=app,console run -t device:bcm2835_aux tests/acceptance/
  JOB ID     : a8846d69d52da701681b1d17f80ef299009fd078
  JOB LOG    : avocado/job-results/job-2020-02-05T23.44-a8846d6/job.log
   (1/3) tests/acceptance/boot_linux_console.py:BootLinuxConsole.test_arm_raspi0_uart1:
  console: [    0.000000] Booting Linux on physical CPU 0x0
  console: [    0.000000] Linux version 4.14.98+ (dom@dom-XPS-13-9370) (gcc version 4.9.3 (crosstool-NG crosstool-ng-1.22.0-88-g8460611)) #1200 Tue Feb 12 20:11:02 GMT 2019
  console: [    0.000000] CPU: ARMv6-compatible processor [410fb767] revision 7 (ARMv7), cr=00c5387d
  console: [    0.000000] CPU: VIPT aliasing data cache, unknown instruction cache
  console: [    0.000000] OF: fdt: Machine model: Raspberry Pi Zero W
  console: [    0.000000] earlycon: uart8250 at MMIO32 0x20215040 (options '')
  console: [    0.000000] bootconsole [uart8250] enabled
  console: [    0.000000] Memory policy: Data cache writeback
  console: [    0.000000] cma: Reserved 8 MiB at 0x1b800000
  console: [    0.000000] Built 1 zonelists, mobility grouping on.  Total pages: 113680
  console: [    0.000000] Kernel command line: printk.time=0 earlycon=uart8250,mmio32,0x20215040 console=ttyS1,115200
  PASS (13.31 s)
   (2/3) tests/acceptance/boot_linux_console.py:BootLinuxConsole.test_arm_raspi1_uart1:
  console: [    0.000000] Booting Linux on physical CPU 0x0
  console: [    0.000000] Linux version 4.14.98+ (dom@dom-XPS-13-9370) (gcc version 4.9.3 (crosstool-NG crosstool-ng-1.22.0-88-g8460611)) #1200 Tue Feb 12 20:11:02 GMT 2019
  console: [    0.000000] CPU: ARMv6-compatible processor [410fb767] revision 7 (ARMv7), cr=00c5387d
  console: [    0.000000] CPU: VIPT aliasing data cache, unknown instruction cache
  console: [    0.000000] OF: fdt: Machine model: Raspberry Pi Model B
  console: [    0.000000] earlycon: uart8250 at MMIO32 0x20215040 (options '')
  console: [    0.000000] bootconsole [uart8250] enabled
  console: [    0.000000] Memory policy: Data cache writeback
  console: [    0.000000] cma: Reserved 8 MiB at 0x1b800000
  console: [    0.000000] Built 1 zonelists, mobility grouping on.  Total pages: 113680
  console: [    0.000000] Kernel command line: printk.time=0 earlycon=uart8250,mmio32,0x20215040 console=ttyS1,115200
  PASS (13.39 s)
   (3/3) tests/acceptance/boot_linux_console.py:BootLinuxConsole.test_arm_raspi2_uart1:
  console: [    0.000000] Booting Linux on physical CPU 0xf00
  console: [    0.000000] Linux version 4.14.98-v7+ (dom@dom-XPS-13-9370) (gcc version 4.9.3 (crosstool-NG crosstool-ng-1.22.0-88-g8460611)) #1200 SMP Tue Feb 12 20:27:48 GMT 2019
  console: [    0.000000] CPU: ARMv7 Processor [410fc075] revision 5 (ARMv7), cr=10c5387d
  console: [    0.000000] CPU: div instructions available: patching division code
  console: [    0.000000] CPU: PIPT / VIPT nonaliasing data cache, VIPT aliasing instruction cache
  console: [    0.000000] OF: fdt: Machine model: Raspberry Pi 2 Model B
  console: [    0.000000] earlycon: uart8250 at MMIO32 0x3f215040 (options '')
  console: [    0.000000] bootconsole [uart8250] enabled
  console: [    0.000000] Memory policy: Data cache writealloc
  console: [    0.000000] cma: Reserved 8 MiB at 0x3b800000
  console: [    0.000000] percpu: Embedded 17 pages/cpu @baf2e000 s38720 r8192 d22720 u69632
  console: [    0.000000] Built 1 zonelists, mobility grouping on.  Total pages: 243600
  console: [    0.000000] Kernel command line: printk.time=0 earlycon=uart8250,mmio32,0x3f215040 console=ttyS1,115200
  PASS (12.46 s)
  RESULTS    : PASS 3 | ERROR 0 | FAIL 0 | SKIP 0 | WARN 0 | INTERRUPT 0 | CANCEL 0
  JOB TIME   : 39.60 s

Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
---
 tests/acceptance/boot_linux_console.py | 37 +++++++++++++++++++++++++-
 1 file changed, 36 insertions(+), 1 deletion(-)

diff --git a/tests/acceptance/boot_linux_console.py b/tests/acceptance/boot_linux_console.py
index bd3f0fc852..3d442b6cd1 100644
--- a/tests/acceptance/boot_linux_console.py
+++ b/tests/acceptance/boot_linux_console.py
@@ -359,6 +359,14 @@ def do_test_arm_raspi(self, version, uart_model):
                 1: 'earlycon=pl011,0x20201000 console=ttyAMA0',
                 2: 'earlycon=pl011,0x3f201000 console=ttyAMA0',
             },
+            'bcm2835_aux': {
+                0: 'earlycon=uart8250,mmio32,0x20215040 console=ttyS1,115200',
+                1: 'earlycon=uart8250,mmio32,0x20215040 console=ttyS1,115200',
+                2: 'earlycon=uart8250,mmio32,0x3f215040 console=ttyS1,115200',
+            },
+        }
+        uart_id = {
+            'pl011': 0, 'bcm2835_aux': 1,
         }
         kernel = {
             0: '/boot/kernel.img',
@@ -378,7 +386,7 @@ def do_test_arm_raspi(self, version, uart_model):
         kernel_path = self.extract_from_deb(deb_path, kernel[version])
         dtb_path = self.extract_from_deb(deb_path, dtb[version])
 
-        self.vm.set_console()
+        self.vm.set_console(console_index=uart_id[uart_model])
         kernel_command_line = (self.KERNEL_COMMON_COMMAND_LINE +
                                serial_kernel_cmdline[uart_model][version])
         self.vm.add_args('-kernel', kernel_path,
@@ -397,6 +405,15 @@ def test_arm_raspi0_uart0(self):
         """
         self.do_test_arm_raspi(0, 'pl011')
 
+    def test_arm_raspi0_uart1(self):
+        """
+        :avocado: tags=arch:arm
+        :avocado: tags=machine:raspi0
+        :avocado: tags=cpu:arm1176
+        :avocado: tags=device:bcm2835_aux
+        """
+        self.do_test_arm_raspi(0, 'bcm2835_aux')
+
     def test_arm_raspi1_uart0(self):
         """
         :avocado: tags=arch:arm
@@ -406,6 +423,15 @@ def test_arm_raspi1_uart0(self):
         """
         self.do_test_arm_raspi(1, 'pl011')
 
+    def test_arm_raspi1_uart1(self):
+        """
+        :avocado: tags=arch:arm
+        :avocado: tags=machine:raspi1
+        :avocado: tags=cpu:arm1176
+        :avocado: tags=device:bcm2835_aux
+        """
+        self.do_test_arm_raspi(1, 'bcm2835_aux')
+
     def test_arm_raspi2_uart0(self):
         """
         :avocado: tags=arch:arm
@@ -415,6 +441,15 @@ def test_arm_raspi2_uart0(self):
         """
         self.do_test_arm_raspi(2, 'pl011')
 
+    def test_arm_raspi2_uart1(self):
+        """
+        :avocado: tags=arch:arm
+        :avocado: tags=machine:raspi2
+        :avocado: tags=cpu:cortex-a7
+        :avocado: tags=device:bcm2835_aux
+        """
+        self.do_test_arm_raspi(2, 'bcm2835_aux')
+
     def test_arm_exynos4210_initrd(self):
         """
         :avocado: tags=arch:arm
-- 
2.21.1



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

* [PATCH 6/8] tests/boot_linux_console: Test booting U-Boot on the Raspberry Pi 2
  2020-02-15 19:22 [PATCH 0/8] hw/arm: Add raspi[0123] acceptance tests Philippe Mathieu-Daudé
                   ` (4 preceding siblings ...)
  2020-02-15 19:22 ` [PATCH 5/8] tests/acceptance/boot_linux_console: Test the raspi1 AUX console Philippe Mathieu-Daudé
@ 2020-02-15 19:22 ` Philippe Mathieu-Daudé
  2020-02-17  8:28   ` Luc Michel
  2020-02-15 19:22 ` [PATCH 7/8] tests/boot_linux_console: Test booting U-Boot on the Raspberry Pi 3 Philippe Mathieu-Daudé
  2020-02-15 19:22 ` [PATCH 8/8] tests/acceptance: Count Raspberry Pi logos displayed on framebuffer Philippe Mathieu-Daudé
  7 siblings, 1 reply; 17+ messages in thread
From: Philippe Mathieu-Daudé @ 2020-02-15 19:22 UTC (permalink / raw)
  To: qemu-devel
  Cc: Peter Maydell, Philippe Mathieu-Daudé,
	Andrew Baumann, Igor Mammedov

This test runs U-Boot on the Raspberry Pi 2.
It is very simple and fast:

  $ avocado --show=app,console run -t raspi2 -t u-boot tests/acceptance/
  JOB LOG    : avocado/job-results/job-2020-01-20T23.40-2424777/job.log
   (1/1) tests/acceptance/boot_linux_console.py:BootLinuxConsole.test_arm_raspi2_uboot:
  console: MMC:   sdhci@7e300000: 0
  console: Loading Environment from FAT... Card did not respond to voltage select!
  console: In:    serial
  console: Out:   vidconsole
  console: Err:   vidconsole
  console: Net:   No ethernet found.
  console: starting USB...
  console: USB0:   Port not available.
  console: Hit any key to stop autoboot:  0
  console: U-Boot>
  console: U-Boot> bdinfo
  console: arch_number = 0x00000000
  console: boot_params = 0x00000100
  console: DRAM bank   = 0x00000000
  console: -> start    = 0x00000000
  console: -> size     = 0x3c000000
  console: baudrate    = 115200 bps
  console: TLB addr    = 0x3bff0000
  console: relocaddr   = 0x3bf64000
  console: reloc off   = 0x3bf5c000
  console: irq_sp      = 0x3bb5fec0
  console: sp start    = 0x3bb5feb0
  console: Early malloc usage: 2a4 / 400
  console: fdt_blob    = 0x3bfbdfb0
  console: U-Boot> version
  console: U-Boot 2019.01+dfsg-7 (May 14 2019 - 02:07:44 +0000)
  console: gcc (Debian 8.3.0-7) 8.3.0
  console: GNU ld (GNU Binutils for Debian) 2.31.1
  console: U-Boot> reset
  console: resetting ...
  PASS (0.46 s)

U-Boot is built by the Debian project, see:
https://wiki.debian.org/InstallingDebianOn/Allwinner#Creating_a_bootable_SD_Card_with_u-boot

Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
---
 tests/acceptance/boot_linux_console.py | 28 ++++++++++++++++++++++++++
 1 file changed, 28 insertions(+)

diff --git a/tests/acceptance/boot_linux_console.py b/tests/acceptance/boot_linux_console.py
index 3d442b6cd1..3b1952b2df 100644
--- a/tests/acceptance/boot_linux_console.py
+++ b/tests/acceptance/boot_linux_console.py
@@ -16,6 +16,7 @@
 from avocado import skipUnless
 from avocado_qemu import Test
 from avocado_qemu import exec_command_and_wait_for_pattern
+from avocado_qemu import interrupt_interactive_console_until_pattern
 from avocado_qemu import wait_for_console_pattern
 from avocado.utils import process
 from avocado.utils import archive
@@ -575,6 +576,33 @@ def test_arm_cubieboard_sata(self):
         exec_command_and_wait_for_pattern(self, 'reboot',
                                                 'reboot: Restarting system')
 
+    def test_arm_raspi2_uboot(self):
+        """
+        :avocado: tags=arch:arm
+        :avocado: tags=machine:raspi2
+        :avocado: tags=u-boot
+        """
+        deb_url = ('https://snapshot.debian.org/archive/debian/'
+                   '20190514T084354Z/pool/main/u/u-boot/'
+                   'u-boot-rpi_2019.01%2Bdfsg-7_armhf.deb')
+        deb_hash = 'ad858cf3afe623b6c3fa2e20dcdd1768fcb9ae83'
+        deb_path = self.fetch_asset(deb_url, asset_hash=deb_hash)
+        uboot_path = '/usr/lib/u-boot/rpi_2/uboot.elf'
+        uboot_path = self.extract_from_deb(deb_path, uboot_path)
+
+        self.vm.set_console()
+        self.vm.add_args('-kernel', uboot_path,
+                         # VideoCore starts CPU with only 1 core enabled
+                         '-global', 'bcm2836.enabled-cpus=1',
+                         '-no-reboot')
+        self.vm.launch()
+        interrupt_interactive_console_until_pattern(self,
+                                       'Hit any key to stop autoboot:',
+                                       'Config file not found')
+        exec_command_and_wait_for_pattern(self, 'bdinfo', 'U-Boot')
+        exec_command_and_wait_for_pattern(self, 'version', 'U-Boot')
+        exec_command_and_wait_for_pattern(self, 'reset', 'resetting ...')
+
     def test_s390x_s390_ccw_virtio(self):
         """
         :avocado: tags=arch:s390x
-- 
2.21.1



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

* [PATCH 7/8] tests/boot_linux_console: Test booting U-Boot on the Raspberry Pi 3
  2020-02-15 19:22 [PATCH 0/8] hw/arm: Add raspi[0123] acceptance tests Philippe Mathieu-Daudé
                   ` (5 preceding siblings ...)
  2020-02-15 19:22 ` [PATCH 6/8] tests/boot_linux_console: Test booting U-Boot on the Raspberry Pi 2 Philippe Mathieu-Daudé
@ 2020-02-15 19:22 ` Philippe Mathieu-Daudé
  2020-02-17  8:28   ` Luc Michel
  2020-02-15 19:22 ` [PATCH 8/8] tests/acceptance: Count Raspberry Pi logos displayed on framebuffer Philippe Mathieu-Daudé
  7 siblings, 1 reply; 17+ messages in thread
From: Philippe Mathieu-Daudé @ 2020-02-15 19:22 UTC (permalink / raw)
  To: qemu-devel
  Cc: Peter Maydell, Philippe Mathieu-Daudé,
	Andrew Baumann, Igor Mammedov

This test runs U-Boot on the Raspberry Pi 3.
It is very simple and fast:

  $ avocado --show=app,console run -t raspi3 -t u-boot tests/acceptance/
  JOB LOG    : avocado/job-results/job-2020-01-20T23.40-2424777/job.log
   (1/1) tests/acceptance/boot_linux_console.py:BootLinuxConsole.test_aarch64_raspi3_uboot:
  console: MMC:   mmc@7e202000: 0, sdhci@7e300000: 1
  console: Loading Environment from FAT... WARNING at drivers/mmc/bcm2835_sdhost.c:410/bcm2835_send_command()!
  console: WARNING at drivers/mmc/bcm2835_sdhost.c:410/bcm2835_send_command()!
  console: Card did not respond to voltage select!
  console: In:    serial
  console: Out:   vidconsole
  console: Err:   vidconsole
  console: Net:   No ethernet found.
  console: starting USB...
  console: Bus usb@7e980000: Port not available.
  console: Hit any key to stop autoboot:  0
  console: U-Boot>
  console: U-Boot>
  console: U-Boot> bdinfo
  console: arch_number = 0x0000000000000000
  console: boot_params = 0x0000000000000100
  console: DRAM bank   = 0x0000000000000000
  console: -> start    = 0x0000000000000000
  console: -> size     = 0x000000003c000000
  console: baudrate    = 115200 bps
  console: TLB addr    = 0x000000003bff0000
  console: relocaddr   = 0x000000003bf57000
  console: reloc off   = 0x000000003bed7000
  console: irq_sp      = 0x000000003bb52dd0
  console: sp start    = 0x000000003bb52dd0
  console: FB base     = 0x0000000000000000
  console: Early malloc usage: 7b0 / 2000
  console: fdt_blob    = 0x000000003bfbf200
  console: U-Boot> version
  console: U-Boot 2020.01+dfsg-1 (Jan 08 2020 - 08:19:44 +0000)
  console: gcc (Debian 9.2.1-22) 9.2.1 20200104
  console: GNU ld (GNU Binutils for Debian) 2.33.1
  console: U-Boot> reset
  console: resetting ...
  PASS (1.79 s)

U-Boot is built by the Debian project, see:
https://wiki.debian.org/InstallingDebianOn/Allwinner#Creating_a_bootable_SD_Card_with_u-boot

Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
---
 tests/acceptance/boot_linux_console.py | 25 +++++++++++++++++++++++++
 1 file changed, 25 insertions(+)

diff --git a/tests/acceptance/boot_linux_console.py b/tests/acceptance/boot_linux_console.py
index 3b1952b2df..989db7d461 100644
--- a/tests/acceptance/boot_linux_console.py
+++ b/tests/acceptance/boot_linux_console.py
@@ -603,6 +603,31 @@ def test_arm_raspi2_uboot(self):
         exec_command_and_wait_for_pattern(self, 'version', 'U-Boot')
         exec_command_and_wait_for_pattern(self, 'reset', 'resetting ...')
 
+    def test_aarch64_raspi3_uboot(self):
+        """
+        :avocado: tags=arch:aarch64
+        :avocado: tags=machine:raspi3
+        :avocado: tags=u-boot
+        """
+        deb_url = ('https://snapshot.debian.org/archive/debian/'
+                   '20200108T145233Z/pool/main/u/u-boot/'
+                   'u-boot-rpi_2020.01%2Bdfsg-1_arm64.deb')
+        deb_hash = 'f394386e02469d52f2eb3c07a2325b1c95aeb00b'
+        deb_path = self.fetch_asset(deb_url, asset_hash=deb_hash)
+        uboot_path = '/usr/lib/u-boot/rpi_3/u-boot.bin'
+        uboot_path = self.extract_from_deb(deb_path, uboot_path)
+
+        self.vm.set_console(console_index=1)
+        self.vm.add_args('-kernel', uboot_path,
+                         '-no-reboot')
+        self.vm.launch()
+        interrupt_interactive_console_until_pattern(self,
+                                       'Hit any key to stop autoboot:',
+                                       'Config file not found')
+        exec_command_and_wait_for_pattern(self, 'bdinfo', 'U-Boot')
+        exec_command_and_wait_for_pattern(self, 'version', 'U-Boot')
+        exec_command_and_wait_for_pattern(self, 'reset', 'resetting ...')
+
     def test_s390x_s390_ccw_virtio(self):
         """
         :avocado: tags=arch:s390x
-- 
2.21.1



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

* [PATCH 8/8] tests/acceptance: Count Raspberry Pi logos displayed on framebuffer
  2020-02-15 19:22 [PATCH 0/8] hw/arm: Add raspi[0123] acceptance tests Philippe Mathieu-Daudé
                   ` (6 preceding siblings ...)
  2020-02-15 19:22 ` [PATCH 7/8] tests/boot_linux_console: Test booting U-Boot on the Raspberry Pi 3 Philippe Mathieu-Daudé
@ 2020-02-15 19:22 ` Philippe Mathieu-Daudé
  2020-02-17  8:29   ` Luc Michel
  7 siblings, 1 reply; 17+ messages in thread
From: Philippe Mathieu-Daudé @ 2020-02-15 19:22 UTC (permalink / raw)
  To: qemu-devel
  Cc: Peter Maydell, Philippe Mathieu-Daudé,
	Andrew Baumann, Igor Mammedov

Add a test that verifies that each core properly displays the
Raspberry Pi logo on the framebuffer device.

We simply follow the OpenCV "Template Matching with Multiple Objects"
tutorial, replacing Lionel Messi by a raspberrry:
https://docs.opencv.org/4.2.0/d4/dc6/tutorial_py_template_matching.html

When OpenCV and NumPy are installed, this test can be run using:

  $ avocado --show=app,framebuffer run -t device:bcm2835-fb tests/acceptance/
  JOB ID     : 9bbbc54c0a6fa180348d0b5305507f76852b4da2
  JOB LOG    : avocado/job-results/job-2020-01-31T23.48-9bbbc54/job.log
   (1/1) tests/acceptance/boot_linux_console.py:BootLinuxConsole.test_arm_raspi2_framebuffer_logo:
  framebuffer: found raspberry at position (x, y) = (0, 0)
  framebuffer: found raspberry at position (x, y) = (71, 0)
  framebuffer: found raspberry at position (x, y) = (142, 0)
  framebuffer: found raspberry at position (x, y) = (213, 0)
  PASS (11.06 s)
  RESULTS    : PASS 1 | ERROR 0 | FAIL 0 | SKIP 0 | WARN 0 | INTERRUPT 0 | CANCEL 0
  JOB TIME   : 11.39 s

Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
---
The resulting match can be visualised at https://pasteboard.co/ISzNHtx.png
---
 tests/acceptance/boot_linux_console.py | 62 ++++++++++++++++++++++++++
 1 file changed, 62 insertions(+)

diff --git a/tests/acceptance/boot_linux_console.py b/tests/acceptance/boot_linux_console.py
index 989db7d461..7c960051a6 100644
--- a/tests/acceptance/boot_linux_console.py
+++ b/tests/acceptance/boot_linux_console.py
@@ -12,6 +12,7 @@
 import lzma
 import gzip
 import shutil
+import logging
 
 from avocado import skipUnless
 from avocado_qemu import Test
@@ -22,6 +23,19 @@
 from avocado.utils import archive
 
 
+NUMPY_AVAILABLE = True
+try:
+    import numpy as np
+except ImportError:
+    NUMPY_AVAILABLE = False
+
+CV2_AVAILABLE = True
+try:
+    import cv2
+except ImportError:
+    CV2_AVAILABLE = False
+
+
 class BootLinuxConsole(Test):
     """
     Boots a Linux kernel and checks that the console is operational and the
@@ -451,6 +465,54 @@ def test_arm_raspi2_uart1(self):
         """
         self.do_test_arm_raspi(2, 'bcm2835_aux')
 
+    @skipUnless(NUMPY_AVAILABLE, 'Python NumPy not installed')
+    @skipUnless(CV2_AVAILABLE, 'Python OpenCV not installed')
+    def test_arm_raspi2_framebuffer_logo(self):
+        """
+        :avocado: tags=arch:arm
+        :avocado: tags=machine:raspi2
+        :avocado: tags=device:bcm2835-fb
+        """
+        screendump_path = os.path.join(self.workdir, 'screendump.pbm')
+        rpilogo_url = ('https://github.com/raspberrypi/linux/raw/'
+                       'raspberrypi-kernel_1.20190517-1/'
+                       'drivers/video/logo/logo_linux_clut224.ppm')
+        rpilogo_hash = 'fff3cc20c6030acce0953147f9baac43f44ed6b0'
+        rpilogo_path = self.fetch_asset(rpilogo_url, asset_hash=rpilogo_hash)
+        deb_url = ('http://archive.raspberrypi.org/debian/'
+                   'pool/main/r/raspberrypi-firmware/'
+                   'raspberrypi-kernel_1.20190215-1_armhf.deb')
+        deb_hash = 'cd284220b32128c5084037553db3c482426f3972'
+        deb_path = self.fetch_asset(deb_url, asset_hash=deb_hash)
+        kernel_path = self.extract_from_deb(deb_path, '/boot/kernel7.img')
+        dtb_path = self.extract_from_deb(deb_path, '/boot/bcm2709-rpi-2-b.dtb')
+
+        self.vm.set_console()
+        kernel_command_line = (self.KERNEL_COMMON_COMMAND_LINE +
+                               'earlycon=pl011,0x3f201000 console=ttyAMA0')
+        self.vm.add_args('-kernel', kernel_path,
+                         '-dtb', dtb_path,
+                         '-append', kernel_command_line)
+        self.vm.launch()
+        framebuffer_ready = 'Console: switching to colour frame buffer device'
+        wait_for_console_pattern(self, framebuffer_ready)
+        self.vm.command('human-monitor-command', command_line='stop')
+        self.vm.command('human-monitor-command',
+                        command_line='screendump %s' % screendump_path)
+        logger = logging.getLogger('framebuffer')
+
+        cpu_cores_count = 4
+        match_threshold = 0.95
+        screendump_bgr = cv2.imread(screendump_path, cv2.IMREAD_COLOR)
+        rpilogo_bgr = cv2.imread(rpilogo_path, cv2.IMREAD_COLOR)
+        result = cv2.matchTemplate(screendump_bgr, rpilogo_bgr,
+                                   cv2.TM_CCOEFF_NORMED)
+        loc = np.where(result >= match_threshold)
+        rpilogo_count = 0
+        for rpilogo_count, pt in enumerate(zip(*loc[::-1]), start=1):
+            logger.debug('found raspberry at position (x, y) = %s', pt)
+        self.assertGreaterEqual(rpilogo_count, cpu_cores_count)
+
     def test_arm_exynos4210_initrd(self):
         """
         :avocado: tags=arch:arm
-- 
2.21.1



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

* Re: [PATCH 1/8] tests/acceptance/boot_linux_console: Use raspi console model as key
  2020-02-15 19:22 ` [PATCH 1/8] tests/acceptance/boot_linux_console: Use raspi console model as key Philippe Mathieu-Daudé
@ 2020-02-17  8:25   ` Luc Michel
  0 siblings, 0 replies; 17+ messages in thread
From: Luc Michel @ 2020-02-17  8:25 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé, qemu-devel
  Cc: Peter Maydell, Andrew Baumann, Igor Mammedov

On 2/15/20 8:22 PM, Philippe Mathieu-Daudé wrote:
> Python dictionary are not that expensive. Use a key makes the
> code easier to review.
> 
> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>

Reviewed-by: Luc Michel <luc.michel@greensocs.com>

> ---
>  tests/acceptance/boot_linux_console.py | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/tests/acceptance/boot_linux_console.py b/tests/acceptance/boot_linux_console.py
> index 34d37eba3b..8cfc758d42 100644
> --- a/tests/acceptance/boot_linux_console.py
> +++ b/tests/acceptance/boot_linux_console.py
> @@ -347,14 +347,14 @@ def test_arm_emcraft_sf2(self):
>          self.vm.launch()
>          self.wait_for_console_pattern('init started: BusyBox')
>  
> -    def do_test_arm_raspi2(self, uart_id):
> +    def do_test_arm_raspi2(self, uart_model):
>          """
>          The kernel can be rebuilt using the kernel source referenced
>          and following the instructions on the on:
>          https://www.raspberrypi.org/documentation/linux/kernel/building.md
>          """
>          serial_kernel_cmdline = {
> -            0: 'earlycon=pl011,0x3f201000 console=ttyAMA0',
> +            'pl011': 'earlycon=pl011,0x3f201000 console=ttyAMA0',
>          }
>          deb_url = ('http://archive.raspberrypi.org/debian/'
>                     'pool/main/r/raspberrypi-firmware/'
> @@ -366,7 +366,7 @@ def do_test_arm_raspi2(self, uart_id):
>  
>          self.vm.set_console()
>          kernel_command_line = (self.KERNEL_COMMON_COMMAND_LINE +
> -                               serial_kernel_cmdline[uart_id])
> +                               serial_kernel_cmdline[uart_model])
>          self.vm.add_args('-kernel', kernel_path,
>                           '-dtb', dtb_path,
>                           '-append', kernel_command_line)
> @@ -380,7 +380,7 @@ def test_arm_raspi2_uart0(self):
>          :avocado: tags=machine:raspi2
>          :avocado: tags=device:pl011
>          """
> -        self.do_test_arm_raspi2(0)
> +        self.do_test_arm_raspi2('pl011')
>  
>      def test_arm_exynos4210_initrd(self):
>          """
> 


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

* Re: [PATCH 2/8] tests/acceptance/boot_linux_console: Add raspi version=2 parameter
  2020-02-15 19:22 ` [PATCH 2/8] tests/acceptance/boot_linux_console: Add raspi version=2 parameter Philippe Mathieu-Daudé
@ 2020-02-17  8:26   ` Luc Michel
  0 siblings, 0 replies; 17+ messages in thread
From: Luc Michel @ 2020-02-17  8:26 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé, qemu-devel
  Cc: Peter Maydell, Andrew Baumann, Igor Mammedov

On 2/15/20 8:22 PM, Philippe Mathieu-Daudé wrote:
> We want to tests different Raspberry Pi machines. Refactor to
> take the board version as argument.
> 
> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>

Reviewed-by: Luc Michel <luc.michel@greensocs.com>

> ---
>  tests/acceptance/boot_linux_console.py | 21 +++++++++++++++------
>  1 file changed, 15 insertions(+), 6 deletions(-)
> 
> diff --git a/tests/acceptance/boot_linux_console.py b/tests/acceptance/boot_linux_console.py
> index 8cfc758d42..a1b6e70d3f 100644
> --- a/tests/acceptance/boot_linux_console.py
> +++ b/tests/acceptance/boot_linux_console.py
> @@ -347,26 +347,34 @@ def test_arm_emcraft_sf2(self):
>          self.vm.launch()
>          self.wait_for_console_pattern('init started: BusyBox')
>  
> -    def do_test_arm_raspi2(self, uart_model):
> +    def do_test_arm_raspi(self, version, uart_model):
>          """
>          The kernel can be rebuilt using the kernel source referenced
>          and following the instructions on the on:
>          https://www.raspberrypi.org/documentation/linux/kernel/building.md
>          """
>          serial_kernel_cmdline = {
> -            'pl011': 'earlycon=pl011,0x3f201000 console=ttyAMA0',
> +            'pl011': {
> +                2: 'earlycon=pl011,0x3f201000 console=ttyAMA0',
> +            },
> +        }
> +        kernel = {
> +            2: '/boot/kernel7.img',
> +        }
> +        dtb = {
> +            2: '/boot/bcm2709-rpi-2-b.dtb',
>          }
>          deb_url = ('http://archive.raspberrypi.org/debian/'
>                     'pool/main/r/raspberrypi-firmware/'
>                     'raspberrypi-kernel_1.20190215-1_armhf.deb')
>          deb_hash = 'cd284220b32128c5084037553db3c482426f3972'
>          deb_path = self.fetch_asset(deb_url, asset_hash=deb_hash)
> -        kernel_path = self.extract_from_deb(deb_path, '/boot/kernel7.img')
> -        dtb_path = self.extract_from_deb(deb_path, '/boot/bcm2709-rpi-2-b.dtb')
> +        kernel_path = self.extract_from_deb(deb_path, kernel[version])
> +        dtb_path = self.extract_from_deb(deb_path, dtb[version])
>  
>          self.vm.set_console()
>          kernel_command_line = (self.KERNEL_COMMON_COMMAND_LINE +
> -                               serial_kernel_cmdline[uart_model])
> +                               serial_kernel_cmdline[uart_model][version])
>          self.vm.add_args('-kernel', kernel_path,
>                           '-dtb', dtb_path,
>                           '-append', kernel_command_line)
> @@ -378,9 +386,10 @@ def test_arm_raspi2_uart0(self):
>          """
>          :avocado: tags=arch:arm
>          :avocado: tags=machine:raspi2
> +        :avocado: tags=cpu:cortex-a7
>          :avocado: tags=device:pl011
>          """
> -        self.do_test_arm_raspi2('pl011')
> +        self.do_test_arm_raspi(2, 'pl011')
>  
>      def test_arm_exynos4210_initrd(self):
>          """
> 


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

* Re: [PATCH 3/8] tests/acceptance/boot_linux_console: Test the raspi1 console
  2020-02-15 19:22 ` [PATCH 3/8] tests/acceptance/boot_linux_console: Test the raspi1 console Philippe Mathieu-Daudé
@ 2020-02-17  8:27   ` Luc Michel
  0 siblings, 0 replies; 17+ messages in thread
From: Luc Michel @ 2020-02-17  8:27 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé, qemu-devel
  Cc: Peter Maydell, Andrew Baumann, Igor Mammedov

On 2/15/20 8:22 PM, Philippe Mathieu-Daudé wrote:
>   $ avocado --show=app,console run -t machine:raspi1 tests/acceptance/
>   JOB ID     : c49310d4a21444f03789cd2c443d8c54a29ffd0a
>   JOB LOG    : avocado/job-results/job-2020-02-05T23.52-c49310d/job.log
>    (1/1) tests/acceptance/boot_linux_console.py:BootLinuxConsole.test_arm_raspi1_uart0:
>   console: [    0.000000] Booting Linux on physical CPU 0x0
>   console: [    0.000000] Linux version 4.14.98+ (dom@dom-XPS-13-9370) (gcc version 4.9.3 (crosstool-NG crosstool-ng-1.22.0-88-g8460611)) #1200 Tue Feb 12 20:11:02 GMT 2019
>   console: [    0.000000] CPU: ARMv6-compatible processor [410fb767] revision 7 (ARMv7), cr=00c5387d
>   console: [    0.000000] CPU: VIPT aliasing data cache, unknown instruction cache
>   console: [    0.000000] OF: fdt: Machine model: Raspberry Pi Model B
>   console: [    0.000000] earlycon: pl11 at MMIO 0x20201000 (options '')
>   console: [    0.000000] bootconsole [pl11] enabled
>   console: [    0.000000] Memory policy: Data cache writeback
>   console: [    0.000000] cma: Reserved 8 MiB at 0x1b800000
>   console: [    0.000000] Built 1 zonelists, mobility grouping on.  Total pages: 113680
>   console: [    0.000000] Kernel command line: printk.time=0 earlycon=pl011,0x20201000 console=ttyAMA0
>   PASS (12.93 s)
>   RESULTS    : PASS 1 | ERROR 0 | FAIL 0 | SKIP 0 | WARN 0 | INTERRUPT 0 | CANCEL 0
>   JOB TIME   : 13.18 s
> 
> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>

Reviewed-by: Luc Michel <luc.michel@greensocs.com>

> ---
>  tests/acceptance/boot_linux_console.py | 12 ++++++++++++
>  1 file changed, 12 insertions(+)
> 
> diff --git a/tests/acceptance/boot_linux_console.py b/tests/acceptance/boot_linux_console.py
> index a1b6e70d3f..c8eabae695 100644
> --- a/tests/acceptance/boot_linux_console.py
> +++ b/tests/acceptance/boot_linux_console.py
> @@ -355,13 +355,16 @@ def do_test_arm_raspi(self, version, uart_model):
>          """
>          serial_kernel_cmdline = {
>              'pl011': {
> +                1: 'earlycon=pl011,0x20201000 console=ttyAMA0',
>                  2: 'earlycon=pl011,0x3f201000 console=ttyAMA0',
>              },
>          }
>          kernel = {
> +            1: '/boot/kernel.img',
>              2: '/boot/kernel7.img',
>          }
>          dtb = {
> +            1: '/boot/bcm2708-rpi-b.dtb',
>              2: '/boot/bcm2709-rpi-2-b.dtb',
>          }
>          deb_url = ('http://archive.raspberrypi.org/debian/'
> @@ -382,6 +385,15 @@ def do_test_arm_raspi(self, version, uart_model):
>          console_pattern = 'Kernel command line: %s' % kernel_command_line
>          self.wait_for_console_pattern(console_pattern)
>  
> +    def test_arm_raspi1_uart0(self):
> +        """
> +        :avocado: tags=arch:arm
> +        :avocado: tags=machine:raspi1
> +        :avocado: tags=cpu:arm1176
> +        :avocado: tags=device:pl011
> +        """
> +        self.do_test_arm_raspi(1, 'pl011')
> +
>      def test_arm_raspi2_uart0(self):
>          """
>          :avocado: tags=arch:arm
> 


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

* Re: [PATCH 4/8] tests/acceptance/boot_linux_console: Test the raspi0 console
  2020-02-15 19:22 ` [PATCH 4/8] tests/acceptance/boot_linux_console: Test the raspi0 console Philippe Mathieu-Daudé
@ 2020-02-17  8:27   ` Luc Michel
  0 siblings, 0 replies; 17+ messages in thread
From: Luc Michel @ 2020-02-17  8:27 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé, qemu-devel
  Cc: Peter Maydell, Andrew Baumann, Igor Mammedov

On 2/15/20 8:22 PM, Philippe Mathieu-Daudé wrote:
>   $ avocado --show=app,console run -t machine:raspi0 tests/acceptance/
>   JOB ID     : af8e017486290758bff39c986934134199af3556
>   JOB LOG    : avocado/job-results/job-2020-02-05T23.53-af8e017/job.log
>    (1/1) tests/acceptance/boot_linux_console.py:BootLinuxConsole.test_arm_raspi0_uart0:
>   console: [    0.000000] Booting Linux on physical CPU 0x0
>   console: [    0.000000] Linux version 4.14.98+ (dom@dom-XPS-13-9370) (gcc version 4.9.3 (crosstool-NG crosstool-ng-1.22.0-88-g8460611)) #1200 Tue Feb 12 20:11:02 GMT 2019
>   console: [    0.000000] CPU: ARMv6-compatible processor [410fb767] revision 7 (ARMv7), cr=00c5387d
>   console: [    0.000000] CPU: VIPT aliasing data cache, unknown instruction cache
>   console: [    0.000000] OF: fdt: Machine model: Raspberry Pi Zero W
>   console: [    0.000000] earlycon: pl11 at MMIO 0x20201000 (options '')
>   console: [    0.000000] bootconsole [pl11] enabled
>   console: [    0.000000] Memory policy: Data cache writeback
>   console: [    0.000000] cma: Reserved 8 MiB at 0x1b800000
>   console: [    0.000000] Built 1 zonelists, mobility grouping on.  Total pages: 113680
>   console: [    0.000000] Kernel command line: printk.time=0 earlycon=pl011,0x20201000 console=ttyAMA0
>   PASS (12.59 s)
>   RESULTS    : PASS 1 | ERROR 0 | FAIL 0 | SKIP 0 | WARN 0 | INTERRUPT 0 | CANCEL 0
>   JOB TIME   : 12.88 s
> 
> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>

Reviewed-by: Luc Michel <luc.michel@greensocs.com>

> ---
>  tests/acceptance/boot_linux_console.py | 12 ++++++++++++
>  1 file changed, 12 insertions(+)
> 
> diff --git a/tests/acceptance/boot_linux_console.py b/tests/acceptance/boot_linux_console.py
> index c8eabae695..bd3f0fc852 100644
> --- a/tests/acceptance/boot_linux_console.py
> +++ b/tests/acceptance/boot_linux_console.py
> @@ -355,15 +355,18 @@ def do_test_arm_raspi(self, version, uart_model):
>          """
>          serial_kernel_cmdline = {
>              'pl011': {
> +                0: 'earlycon=pl011,0x20201000 console=ttyAMA0',
>                  1: 'earlycon=pl011,0x20201000 console=ttyAMA0',
>                  2: 'earlycon=pl011,0x3f201000 console=ttyAMA0',
>              },
>          }
>          kernel = {
> +            0: '/boot/kernel.img',
>              1: '/boot/kernel.img',
>              2: '/boot/kernel7.img',
>          }
>          dtb = {
> +            0: '/boot/bcm2708-rpi-0-w.dtb',
>              1: '/boot/bcm2708-rpi-b.dtb',
>              2: '/boot/bcm2709-rpi-2-b.dtb',
>          }
> @@ -385,6 +388,15 @@ def do_test_arm_raspi(self, version, uart_model):
>          console_pattern = 'Kernel command line: %s' % kernel_command_line
>          self.wait_for_console_pattern(console_pattern)
>  
> +    def test_arm_raspi0_uart0(self):
> +        """
> +        :avocado: tags=arch:arm
> +        :avocado: tags=machine:raspi0
> +        :avocado: tags=cpu:arm1176
> +        :avocado: tags=device:pl011
> +        """
> +        self.do_test_arm_raspi(0, 'pl011')
> +
>      def test_arm_raspi1_uart0(self):
>          """
>          :avocado: tags=arch:arm
> 


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

* Re: [PATCH 5/8] tests/acceptance/boot_linux_console: Test the raspi1 AUX console
  2020-02-15 19:22 ` [PATCH 5/8] tests/acceptance/boot_linux_console: Test the raspi1 AUX console Philippe Mathieu-Daudé
@ 2020-02-17  8:28   ` Luc Michel
  0 siblings, 0 replies; 17+ messages in thread
From: Luc Michel @ 2020-02-17  8:28 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé, qemu-devel
  Cc: Peter Maydell, Andrew Baumann, Igor Mammedov

On 2/15/20 8:22 PM, Philippe Mathieu-Daudé wrote:
>   $ avocado --show=app,console run -t device:bcm2835_aux tests/acceptance/
>   JOB ID     : a8846d69d52da701681b1d17f80ef299009fd078
>   JOB LOG    : avocado/job-results/job-2020-02-05T23.44-a8846d6/job.log
>    (1/3) tests/acceptance/boot_linux_console.py:BootLinuxConsole.test_arm_raspi0_uart1:
>   console: [    0.000000] Booting Linux on physical CPU 0x0
>   console: [    0.000000] Linux version 4.14.98+ (dom@dom-XPS-13-9370) (gcc version 4.9.3 (crosstool-NG crosstool-ng-1.22.0-88-g8460611)) #1200 Tue Feb 12 20:11:02 GMT 2019
>   console: [    0.000000] CPU: ARMv6-compatible processor [410fb767] revision 7 (ARMv7), cr=00c5387d
>   console: [    0.000000] CPU: VIPT aliasing data cache, unknown instruction cache
>   console: [    0.000000] OF: fdt: Machine model: Raspberry Pi Zero W
>   console: [    0.000000] earlycon: uart8250 at MMIO32 0x20215040 (options '')
>   console: [    0.000000] bootconsole [uart8250] enabled
>   console: [    0.000000] Memory policy: Data cache writeback
>   console: [    0.000000] cma: Reserved 8 MiB at 0x1b800000
>   console: [    0.000000] Built 1 zonelists, mobility grouping on.  Total pages: 113680
>   console: [    0.000000] Kernel command line: printk.time=0 earlycon=uart8250,mmio32,0x20215040 console=ttyS1,115200
>   PASS (13.31 s)
>    (2/3) tests/acceptance/boot_linux_console.py:BootLinuxConsole.test_arm_raspi1_uart1:
>   console: [    0.000000] Booting Linux on physical CPU 0x0
>   console: [    0.000000] Linux version 4.14.98+ (dom@dom-XPS-13-9370) (gcc version 4.9.3 (crosstool-NG crosstool-ng-1.22.0-88-g8460611)) #1200 Tue Feb 12 20:11:02 GMT 2019
>   console: [    0.000000] CPU: ARMv6-compatible processor [410fb767] revision 7 (ARMv7), cr=00c5387d
>   console: [    0.000000] CPU: VIPT aliasing data cache, unknown instruction cache
>   console: [    0.000000] OF: fdt: Machine model: Raspberry Pi Model B
>   console: [    0.000000] earlycon: uart8250 at MMIO32 0x20215040 (options '')
>   console: [    0.000000] bootconsole [uart8250] enabled
>   console: [    0.000000] Memory policy: Data cache writeback
>   console: [    0.000000] cma: Reserved 8 MiB at 0x1b800000
>   console: [    0.000000] Built 1 zonelists, mobility grouping on.  Total pages: 113680
>   console: [    0.000000] Kernel command line: printk.time=0 earlycon=uart8250,mmio32,0x20215040 console=ttyS1,115200
>   PASS (13.39 s)
>    (3/3) tests/acceptance/boot_linux_console.py:BootLinuxConsole.test_arm_raspi2_uart1:
>   console: [    0.000000] Booting Linux on physical CPU 0xf00
>   console: [    0.000000] Linux version 4.14.98-v7+ (dom@dom-XPS-13-9370) (gcc version 4.9.3 (crosstool-NG crosstool-ng-1.22.0-88-g8460611)) #1200 SMP Tue Feb 12 20:27:48 GMT 2019
>   console: [    0.000000] CPU: ARMv7 Processor [410fc075] revision 5 (ARMv7), cr=10c5387d
>   console: [    0.000000] CPU: div instructions available: patching division code
>   console: [    0.000000] CPU: PIPT / VIPT nonaliasing data cache, VIPT aliasing instruction cache
>   console: [    0.000000] OF: fdt: Machine model: Raspberry Pi 2 Model B
>   console: [    0.000000] earlycon: uart8250 at MMIO32 0x3f215040 (options '')
>   console: [    0.000000] bootconsole [uart8250] enabled
>   console: [    0.000000] Memory policy: Data cache writealloc
>   console: [    0.000000] cma: Reserved 8 MiB at 0x3b800000
>   console: [    0.000000] percpu: Embedded 17 pages/cpu @baf2e000 s38720 r8192 d22720 u69632
>   console: [    0.000000] Built 1 zonelists, mobility grouping on.  Total pages: 243600
>   console: [    0.000000] Kernel command line: printk.time=0 earlycon=uart8250,mmio32,0x3f215040 console=ttyS1,115200
>   PASS (12.46 s)
>   RESULTS    : PASS 3 | ERROR 0 | FAIL 0 | SKIP 0 | WARN 0 | INTERRUPT 0 | CANCEL 0
>   JOB TIME   : 39.60 s
> 
> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>

Reviewed-by: Luc Michel <luc.michel@greensocs.com>

> ---
>  tests/acceptance/boot_linux_console.py | 37 +++++++++++++++++++++++++-
>  1 file changed, 36 insertions(+), 1 deletion(-)
> 
> diff --git a/tests/acceptance/boot_linux_console.py b/tests/acceptance/boot_linux_console.py
> index bd3f0fc852..3d442b6cd1 100644
> --- a/tests/acceptance/boot_linux_console.py
> +++ b/tests/acceptance/boot_linux_console.py
> @@ -359,6 +359,14 @@ def do_test_arm_raspi(self, version, uart_model):
>                  1: 'earlycon=pl011,0x20201000 console=ttyAMA0',
>                  2: 'earlycon=pl011,0x3f201000 console=ttyAMA0',
>              },
> +            'bcm2835_aux': {
> +                0: 'earlycon=uart8250,mmio32,0x20215040 console=ttyS1,115200',
> +                1: 'earlycon=uart8250,mmio32,0x20215040 console=ttyS1,115200',
> +                2: 'earlycon=uart8250,mmio32,0x3f215040 console=ttyS1,115200',
> +            },
> +        }
> +        uart_id = {
> +            'pl011': 0, 'bcm2835_aux': 1,
>          }
>          kernel = {
>              0: '/boot/kernel.img',
> @@ -378,7 +386,7 @@ def do_test_arm_raspi(self, version, uart_model):
>          kernel_path = self.extract_from_deb(deb_path, kernel[version])
>          dtb_path = self.extract_from_deb(deb_path, dtb[version])
>  
> -        self.vm.set_console()
> +        self.vm.set_console(console_index=uart_id[uart_model])
>          kernel_command_line = (self.KERNEL_COMMON_COMMAND_LINE +
>                                 serial_kernel_cmdline[uart_model][version])
>          self.vm.add_args('-kernel', kernel_path,
> @@ -397,6 +405,15 @@ def test_arm_raspi0_uart0(self):
>          """
>          self.do_test_arm_raspi(0, 'pl011')
>  
> +    def test_arm_raspi0_uart1(self):
> +        """
> +        :avocado: tags=arch:arm
> +        :avocado: tags=machine:raspi0
> +        :avocado: tags=cpu:arm1176
> +        :avocado: tags=device:bcm2835_aux
> +        """
> +        self.do_test_arm_raspi(0, 'bcm2835_aux')
> +
>      def test_arm_raspi1_uart0(self):
>          """
>          :avocado: tags=arch:arm
> @@ -406,6 +423,15 @@ def test_arm_raspi1_uart0(self):
>          """
>          self.do_test_arm_raspi(1, 'pl011')
>  
> +    def test_arm_raspi1_uart1(self):
> +        """
> +        :avocado: tags=arch:arm
> +        :avocado: tags=machine:raspi1
> +        :avocado: tags=cpu:arm1176
> +        :avocado: tags=device:bcm2835_aux
> +        """
> +        self.do_test_arm_raspi(1, 'bcm2835_aux')
> +
>      def test_arm_raspi2_uart0(self):
>          """
>          :avocado: tags=arch:arm
> @@ -415,6 +441,15 @@ def test_arm_raspi2_uart0(self):
>          """
>          self.do_test_arm_raspi(2, 'pl011')
>  
> +    def test_arm_raspi2_uart1(self):
> +        """
> +        :avocado: tags=arch:arm
> +        :avocado: tags=machine:raspi2
> +        :avocado: tags=cpu:cortex-a7
> +        :avocado: tags=device:bcm2835_aux
> +        """
> +        self.do_test_arm_raspi(2, 'bcm2835_aux')
> +
>      def test_arm_exynos4210_initrd(self):
>          """
>          :avocado: tags=arch:arm
> 


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

* Re: [PATCH 6/8] tests/boot_linux_console: Test booting U-Boot on the Raspberry Pi 2
  2020-02-15 19:22 ` [PATCH 6/8] tests/boot_linux_console: Test booting U-Boot on the Raspberry Pi 2 Philippe Mathieu-Daudé
@ 2020-02-17  8:28   ` Luc Michel
  0 siblings, 0 replies; 17+ messages in thread
From: Luc Michel @ 2020-02-17  8:28 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé, qemu-devel
  Cc: Peter Maydell, Andrew Baumann, Igor Mammedov

On 2/15/20 8:22 PM, Philippe Mathieu-Daudé wrote:
> This test runs U-Boot on the Raspberry Pi 2.
> It is very simple and fast:
> 
>   $ avocado --show=app,console run -t raspi2 -t u-boot tests/acceptance/
>   JOB LOG    : avocado/job-results/job-2020-01-20T23.40-2424777/job.log
>    (1/1) tests/acceptance/boot_linux_console.py:BootLinuxConsole.test_arm_raspi2_uboot:
>   console: MMC:   sdhci@7e300000: 0
>   console: Loading Environment from FAT... Card did not respond to voltage select!
>   console: In:    serial
>   console: Out:   vidconsole
>   console: Err:   vidconsole
>   console: Net:   No ethernet found.
>   console: starting USB...
>   console: USB0:   Port not available.
>   console: Hit any key to stop autoboot:  0
>   console: U-Boot>
>   console: U-Boot> bdinfo
>   console: arch_number = 0x00000000
>   console: boot_params = 0x00000100
>   console: DRAM bank   = 0x00000000
>   console: -> start    = 0x00000000
>   console: -> size     = 0x3c000000
>   console: baudrate    = 115200 bps
>   console: TLB addr    = 0x3bff0000
>   console: relocaddr   = 0x3bf64000
>   console: reloc off   = 0x3bf5c000
>   console: irq_sp      = 0x3bb5fec0
>   console: sp start    = 0x3bb5feb0
>   console: Early malloc usage: 2a4 / 400
>   console: fdt_blob    = 0x3bfbdfb0
>   console: U-Boot> version
>   console: U-Boot 2019.01+dfsg-7 (May 14 2019 - 02:07:44 +0000)
>   console: gcc (Debian 8.3.0-7) 8.3.0
>   console: GNU ld (GNU Binutils for Debian) 2.31.1
>   console: U-Boot> reset
>   console: resetting ...
>   PASS (0.46 s)
> 
> U-Boot is built by the Debian project, see:
> https://wiki.debian.org/InstallingDebianOn/Allwinner#Creating_a_bootable_SD_Card_with_u-boot
> 
> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>

Reviewed-by: Luc Michel <luc.michel@greensocs.com>

> ---
>  tests/acceptance/boot_linux_console.py | 28 ++++++++++++++++++++++++++
>  1 file changed, 28 insertions(+)
> 
> diff --git a/tests/acceptance/boot_linux_console.py b/tests/acceptance/boot_linux_console.py
> index 3d442b6cd1..3b1952b2df 100644
> --- a/tests/acceptance/boot_linux_console.py
> +++ b/tests/acceptance/boot_linux_console.py
> @@ -16,6 +16,7 @@
>  from avocado import skipUnless
>  from avocado_qemu import Test
>  from avocado_qemu import exec_command_and_wait_for_pattern
> +from avocado_qemu import interrupt_interactive_console_until_pattern
>  from avocado_qemu import wait_for_console_pattern
>  from avocado.utils import process
>  from avocado.utils import archive
> @@ -575,6 +576,33 @@ def test_arm_cubieboard_sata(self):
>          exec_command_and_wait_for_pattern(self, 'reboot',
>                                                  'reboot: Restarting system')
>  
> +    def test_arm_raspi2_uboot(self):
> +        """
> +        :avocado: tags=arch:arm
> +        :avocado: tags=machine:raspi2
> +        :avocado: tags=u-boot
> +        """
> +        deb_url = ('https://snapshot.debian.org/archive/debian/'
> +                   '20190514T084354Z/pool/main/u/u-boot/'
> +                   'u-boot-rpi_2019.01%2Bdfsg-7_armhf.deb')
> +        deb_hash = 'ad858cf3afe623b6c3fa2e20dcdd1768fcb9ae83'
> +        deb_path = self.fetch_asset(deb_url, asset_hash=deb_hash)
> +        uboot_path = '/usr/lib/u-boot/rpi_2/uboot.elf'
> +        uboot_path = self.extract_from_deb(deb_path, uboot_path)
> +
> +        self.vm.set_console()
> +        self.vm.add_args('-kernel', uboot_path,
> +                         # VideoCore starts CPU with only 1 core enabled
> +                         '-global', 'bcm2836.enabled-cpus=1',
> +                         '-no-reboot')
> +        self.vm.launch()
> +        interrupt_interactive_console_until_pattern(self,
> +                                       'Hit any key to stop autoboot:',
> +                                       'Config file not found')
> +        exec_command_and_wait_for_pattern(self, 'bdinfo', 'U-Boot')
> +        exec_command_and_wait_for_pattern(self, 'version', 'U-Boot')
> +        exec_command_and_wait_for_pattern(self, 'reset', 'resetting ...')
> +
>      def test_s390x_s390_ccw_virtio(self):
>          """
>          :avocado: tags=arch:s390x
> 


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

* Re: [PATCH 7/8] tests/boot_linux_console: Test booting U-Boot on the Raspberry Pi 3
  2020-02-15 19:22 ` [PATCH 7/8] tests/boot_linux_console: Test booting U-Boot on the Raspberry Pi 3 Philippe Mathieu-Daudé
@ 2020-02-17  8:28   ` Luc Michel
  0 siblings, 0 replies; 17+ messages in thread
From: Luc Michel @ 2020-02-17  8:28 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé, qemu-devel
  Cc: Peter Maydell, Andrew Baumann, Igor Mammedov

On 2/15/20 8:22 PM, Philippe Mathieu-Daudé wrote:
> This test runs U-Boot on the Raspberry Pi 3.
> It is very simple and fast:
> 
>   $ avocado --show=app,console run -t raspi3 -t u-boot tests/acceptance/
>   JOB LOG    : avocado/job-results/job-2020-01-20T23.40-2424777/job.log
>    (1/1) tests/acceptance/boot_linux_console.py:BootLinuxConsole.test_aarch64_raspi3_uboot:
>   console: MMC:   mmc@7e202000: 0, sdhci@7e300000: 1
>   console: Loading Environment from FAT... WARNING at drivers/mmc/bcm2835_sdhost.c:410/bcm2835_send_command()!
>   console: WARNING at drivers/mmc/bcm2835_sdhost.c:410/bcm2835_send_command()!
>   console: Card did not respond to voltage select!
>   console: In:    serial
>   console: Out:   vidconsole
>   console: Err:   vidconsole
>   console: Net:   No ethernet found.
>   console: starting USB...
>   console: Bus usb@7e980000: Port not available.
>   console: Hit any key to stop autoboot:  0
>   console: U-Boot>
>   console: U-Boot>
>   console: U-Boot> bdinfo
>   console: arch_number = 0x0000000000000000
>   console: boot_params = 0x0000000000000100
>   console: DRAM bank   = 0x0000000000000000
>   console: -> start    = 0x0000000000000000
>   console: -> size     = 0x000000003c000000
>   console: baudrate    = 115200 bps
>   console: TLB addr    = 0x000000003bff0000
>   console: relocaddr   = 0x000000003bf57000
>   console: reloc off   = 0x000000003bed7000
>   console: irq_sp      = 0x000000003bb52dd0
>   console: sp start    = 0x000000003bb52dd0
>   console: FB base     = 0x0000000000000000
>   console: Early malloc usage: 7b0 / 2000
>   console: fdt_blob    = 0x000000003bfbf200
>   console: U-Boot> version
>   console: U-Boot 2020.01+dfsg-1 (Jan 08 2020 - 08:19:44 +0000)
>   console: gcc (Debian 9.2.1-22) 9.2.1 20200104
>   console: GNU ld (GNU Binutils for Debian) 2.33.1
>   console: U-Boot> reset
>   console: resetting ...
>   PASS (1.79 s)
> 
> U-Boot is built by the Debian project, see:
> https://wiki.debian.org/InstallingDebianOn/Allwinner#Creating_a_bootable_SD_Card_with_u-boot
> 
> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>

Reviewed-by: Luc Michel <luc.michel@greensocs.com>

> ---
>  tests/acceptance/boot_linux_console.py | 25 +++++++++++++++++++++++++
>  1 file changed, 25 insertions(+)
> 
> diff --git a/tests/acceptance/boot_linux_console.py b/tests/acceptance/boot_linux_console.py
> index 3b1952b2df..989db7d461 100644
> --- a/tests/acceptance/boot_linux_console.py
> +++ b/tests/acceptance/boot_linux_console.py
> @@ -603,6 +603,31 @@ def test_arm_raspi2_uboot(self):
>          exec_command_and_wait_for_pattern(self, 'version', 'U-Boot')
>          exec_command_and_wait_for_pattern(self, 'reset', 'resetting ...')
>  
> +    def test_aarch64_raspi3_uboot(self):
> +        """
> +        :avocado: tags=arch:aarch64
> +        :avocado: tags=machine:raspi3
> +        :avocado: tags=u-boot
> +        """
> +        deb_url = ('https://snapshot.debian.org/archive/debian/'
> +                   '20200108T145233Z/pool/main/u/u-boot/'
> +                   'u-boot-rpi_2020.01%2Bdfsg-1_arm64.deb')
> +        deb_hash = 'f394386e02469d52f2eb3c07a2325b1c95aeb00b'
> +        deb_path = self.fetch_asset(deb_url, asset_hash=deb_hash)
> +        uboot_path = '/usr/lib/u-boot/rpi_3/u-boot.bin'
> +        uboot_path = self.extract_from_deb(deb_path, uboot_path)
> +
> +        self.vm.set_console(console_index=1)
> +        self.vm.add_args('-kernel', uboot_path,
> +                         '-no-reboot')
> +        self.vm.launch()
> +        interrupt_interactive_console_until_pattern(self,
> +                                       'Hit any key to stop autoboot:',
> +                                       'Config file not found')
> +        exec_command_and_wait_for_pattern(self, 'bdinfo', 'U-Boot')
> +        exec_command_and_wait_for_pattern(self, 'version', 'U-Boot')
> +        exec_command_and_wait_for_pattern(self, 'reset', 'resetting ...')
> +
>      def test_s390x_s390_ccw_virtio(self):
>          """
>          :avocado: tags=arch:s390x
> 


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

* Re: [PATCH 8/8] tests/acceptance: Count Raspberry Pi logos displayed on framebuffer
  2020-02-15 19:22 ` [PATCH 8/8] tests/acceptance: Count Raspberry Pi logos displayed on framebuffer Philippe Mathieu-Daudé
@ 2020-02-17  8:29   ` Luc Michel
  0 siblings, 0 replies; 17+ messages in thread
From: Luc Michel @ 2020-02-17  8:29 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé, qemu-devel
  Cc: Peter Maydell, Andrew Baumann, Igor Mammedov

On 2/15/20 8:22 PM, Philippe Mathieu-Daudé wrote:
> Add a test that verifies that each core properly displays the
> Raspberry Pi logo on the framebuffer device.
> 
> We simply follow the OpenCV "Template Matching with Multiple Objects"
> tutorial, replacing Lionel Messi by a raspberrry:
> https://docs.opencv.org/4.2.0/d4/dc6/tutorial_py_template_matching.html
> 
> When OpenCV and NumPy are installed, this test can be run using:
> 
>   $ avocado --show=app,framebuffer run -t device:bcm2835-fb tests/acceptance/
>   JOB ID     : 9bbbc54c0a6fa180348d0b5305507f76852b4da2
>   JOB LOG    : avocado/job-results/job-2020-01-31T23.48-9bbbc54/job.log
>    (1/1) tests/acceptance/boot_linux_console.py:BootLinuxConsole.test_arm_raspi2_framebuffer_logo:
>   framebuffer: found raspberry at position (x, y) = (0, 0)
>   framebuffer: found raspberry at position (x, y) = (71, 0)
>   framebuffer: found raspberry at position (x, y) = (142, 0)
>   framebuffer: found raspberry at position (x, y) = (213, 0)
>   PASS (11.06 s)
>   RESULTS    : PASS 1 | ERROR 0 | FAIL 0 | SKIP 0 | WARN 0 | INTERRUPT 0 | CANCEL 0
>   JOB TIME   : 11.39 s
> 
> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>

Reviewed-by: Luc Michel <luc.michel@greensocs.com>

> ---
> The resulting match can be visualised at https://pasteboard.co/ISzNHtx.png
> ---
>  tests/acceptance/boot_linux_console.py | 62 ++++++++++++++++++++++++++
>  1 file changed, 62 insertions(+)
> 
> diff --git a/tests/acceptance/boot_linux_console.py b/tests/acceptance/boot_linux_console.py
> index 989db7d461..7c960051a6 100644
> --- a/tests/acceptance/boot_linux_console.py
> +++ b/tests/acceptance/boot_linux_console.py
> @@ -12,6 +12,7 @@
>  import lzma
>  import gzip
>  import shutil
> +import logging
>  
>  from avocado import skipUnless
>  from avocado_qemu import Test
> @@ -22,6 +23,19 @@
>  from avocado.utils import archive
>  
>  
> +NUMPY_AVAILABLE = True
> +try:
> +    import numpy as np
> +except ImportError:
> +    NUMPY_AVAILABLE = False
> +
> +CV2_AVAILABLE = True
> +try:
> +    import cv2
> +except ImportError:
> +    CV2_AVAILABLE = False
> +
> +
>  class BootLinuxConsole(Test):
>      """
>      Boots a Linux kernel and checks that the console is operational and the
> @@ -451,6 +465,54 @@ def test_arm_raspi2_uart1(self):
>          """
>          self.do_test_arm_raspi(2, 'bcm2835_aux')
>  
> +    @skipUnless(NUMPY_AVAILABLE, 'Python NumPy not installed')
> +    @skipUnless(CV2_AVAILABLE, 'Python OpenCV not installed')
> +    def test_arm_raspi2_framebuffer_logo(self):
> +        """
> +        :avocado: tags=arch:arm
> +        :avocado: tags=machine:raspi2
> +        :avocado: tags=device:bcm2835-fb
> +        """
> +        screendump_path = os.path.join(self.workdir, 'screendump.pbm')
> +        rpilogo_url = ('https://github.com/raspberrypi/linux/raw/'
> +                       'raspberrypi-kernel_1.20190517-1/'
> +                       'drivers/video/logo/logo_linux_clut224.ppm')
> +        rpilogo_hash = 'fff3cc20c6030acce0953147f9baac43f44ed6b0'
> +        rpilogo_path = self.fetch_asset(rpilogo_url, asset_hash=rpilogo_hash)
> +        deb_url = ('http://archive.raspberrypi.org/debian/'
> +                   'pool/main/r/raspberrypi-firmware/'
> +                   'raspberrypi-kernel_1.20190215-1_armhf.deb')
> +        deb_hash = 'cd284220b32128c5084037553db3c482426f3972'
> +        deb_path = self.fetch_asset(deb_url, asset_hash=deb_hash)
> +        kernel_path = self.extract_from_deb(deb_path, '/boot/kernel7.img')
> +        dtb_path = self.extract_from_deb(deb_path, '/boot/bcm2709-rpi-2-b.dtb')
> +
> +        self.vm.set_console()
> +        kernel_command_line = (self.KERNEL_COMMON_COMMAND_LINE +
> +                               'earlycon=pl011,0x3f201000 console=ttyAMA0')
> +        self.vm.add_args('-kernel', kernel_path,
> +                         '-dtb', dtb_path,
> +                         '-append', kernel_command_line)
> +        self.vm.launch()
> +        framebuffer_ready = 'Console: switching to colour frame buffer device'
> +        wait_for_console_pattern(self, framebuffer_ready)
> +        self.vm.command('human-monitor-command', command_line='stop')
> +        self.vm.command('human-monitor-command',
> +                        command_line='screendump %s' % screendump_path)
> +        logger = logging.getLogger('framebuffer')
> +
> +        cpu_cores_count = 4
> +        match_threshold = 0.95
> +        screendump_bgr = cv2.imread(screendump_path, cv2.IMREAD_COLOR)
> +        rpilogo_bgr = cv2.imread(rpilogo_path, cv2.IMREAD_COLOR)
> +        result = cv2.matchTemplate(screendump_bgr, rpilogo_bgr,
> +                                   cv2.TM_CCOEFF_NORMED)
> +        loc = np.where(result >= match_threshold)
> +        rpilogo_count = 0
> +        for rpilogo_count, pt in enumerate(zip(*loc[::-1]), start=1):
> +            logger.debug('found raspberry at position (x, y) = %s', pt)
> +        self.assertGreaterEqual(rpilogo_count, cpu_cores_count)
> +
>      def test_arm_exynos4210_initrd(self):
>          """
>          :avocado: tags=arch:arm
> 


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

end of thread, other threads:[~2020-02-17  8:43 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-02-15 19:22 [PATCH 0/8] hw/arm: Add raspi[0123] acceptance tests Philippe Mathieu-Daudé
2020-02-15 19:22 ` [PATCH 1/8] tests/acceptance/boot_linux_console: Use raspi console model as key Philippe Mathieu-Daudé
2020-02-17  8:25   ` Luc Michel
2020-02-15 19:22 ` [PATCH 2/8] tests/acceptance/boot_linux_console: Add raspi version=2 parameter Philippe Mathieu-Daudé
2020-02-17  8:26   ` Luc Michel
2020-02-15 19:22 ` [PATCH 3/8] tests/acceptance/boot_linux_console: Test the raspi1 console Philippe Mathieu-Daudé
2020-02-17  8:27   ` Luc Michel
2020-02-15 19:22 ` [PATCH 4/8] tests/acceptance/boot_linux_console: Test the raspi0 console Philippe Mathieu-Daudé
2020-02-17  8:27   ` Luc Michel
2020-02-15 19:22 ` [PATCH 5/8] tests/acceptance/boot_linux_console: Test the raspi1 AUX console Philippe Mathieu-Daudé
2020-02-17  8:28   ` Luc Michel
2020-02-15 19:22 ` [PATCH 6/8] tests/boot_linux_console: Test booting U-Boot on the Raspberry Pi 2 Philippe Mathieu-Daudé
2020-02-17  8:28   ` Luc Michel
2020-02-15 19:22 ` [PATCH 7/8] tests/boot_linux_console: Test booting U-Boot on the Raspberry Pi 3 Philippe Mathieu-Daudé
2020-02-17  8:28   ` Luc Michel
2020-02-15 19:22 ` [PATCH 8/8] tests/acceptance: Count Raspberry Pi logos displayed on framebuffer Philippe Mathieu-Daudé
2020-02-17  8:29   ` Luc Michel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).