diff mbox series

[6/6] tests/avocado: Add tests booting YAMON ROM on MIPS Malta machines

Message ID 20230104133935.4639-7-philmd@linaro.org
State Superseded
Headers show
Series hw/mips/gt64xxx_pci: Fix endianness swap on big-endian hosts | expand

Commit Message

Philippe Mathieu-Daudé Jan. 4, 2023, 1:39 p.m. UTC
Add quick tests booting YAMON:

  $ avocado --show=app,console run -t machine:malta tests/avocado/machine_mips_malta.py
   (1/2) tests/avocado/machine_mips_malta.py:MaltaMachine.test_mipsel_malta_yamon:
  console: YAMON ROM Monitor, Revision 02.22.
  console: Copyright (c) 1999-2007 MIPS Technologies, Inc. - All Rights Reserved.
  console: For a list of available commands, type 'help'.
  console: Compilation time =              May 24 2013  12:16:34 (pburton)
  console: Board type/revision =           0x02 (Malta) / 0x00
  console: Core board type/revision =      0x01 (CoreLV) / 0x00
  console: System controller/revision =    Galileo / GT_64120A-B-0
  console: FPGA revision =                 0x0000
  console: MAC address =                   ff.ff.ff.ff.ff.ff
  console: Board S/N =                     0123456789
  console: PCI bus frequency =             33.33 MHz
  console: Processor Company ID/options =  0x01 (MIPS Technologies, Inc.) / 0x00
  console: Processor ID/revision =         0x93 (MIPS 24Kf) / 0x00
  console: Endianness =                    Little
  console: CPU/Bus frequency =             333 MHz / 419 MHz
  console: Coherency =                     None
  console: Flash memory size =             4 MByte
  console: SDRAM size =                    128 MByte
  console: First free SDRAM address =      0x800c32f0
  console: WARNING: Environment variable flash area is invalid!
  console: HINT   : Perform "erase -e"
  console: YAMON>
  PASS (1.88 s)
   (2/2) tests/avocado/machine_mips_malta.py:MaltaMachine.test_mips64el_malta_yamon:
  ...
  console: System controller/revision =    Galileo / GT_64120A-B-0
  console: Processor Company ID/options =  0x01 (MIPS Technologies, Inc.) / 0x00
  console: Processor ID/revision =         0x82 (MIPS 20Kc) / 0xa0
  ...
  console: YAMON>
  PASS (1.89 s)
  RESULTS    : PASS 2 | ERROR 0 | FAIL 0 | SKIP 0 | WARN 0 | INTERRUPT 0 | CANCEL 0
  JOB TIME   : 4.57 s

YAMON does some endian-swapped acceses on the ISD<->PCI CFG/DATA
registers. These tests are useful to debug cross-endianness issues,
in particular on big-endian host.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
 tests/avocado/machine_mips_malta.py | 52 ++++++++++++++++++++++++++---
 1 file changed, 48 insertions(+), 4 deletions(-)

Comments

Philippe Mathieu-Daudé Jan. 4, 2023, 2:12 p.m. UTC | #1
On 4/1/23 14:39, Philippe Mathieu-Daudé wrote:
> Add quick tests booting YAMON:
> 
>    $ avocado --show=app,console run -t machine:malta tests/avocado/machine_mips_malta.py
>     (1/2) tests/avocado/machine_mips_malta.py:MaltaMachine.test_mipsel_malta_yamon:
>    console: YAMON ROM Monitor, Revision 02.22.
>    console: Copyright (c) 1999-2007 MIPS Technologies, Inc. - All Rights Reserved.
>    console: For a list of available commands, type 'help'.
>    console: Compilation time =              May 24 2013  12:16:34 (pburton)
>    console: Board type/revision =           0x02 (Malta) / 0x00
>    console: Core board type/revision =      0x01 (CoreLV) / 0x00
>    console: System controller/revision =    Galileo / GT_64120A-B-0
>    console: FPGA revision =                 0x0000
>    console: MAC address =                   ff.ff.ff.ff.ff.ff
>    console: Board S/N =                     0123456789
>    console: PCI bus frequency =             33.33 MHz
>    console: Processor Company ID/options =  0x01 (MIPS Technologies, Inc.) / 0x00
>    console: Processor ID/revision =         0x93 (MIPS 24Kf) / 0x00
>    console: Endianness =                    Little
>    console: CPU/Bus frequency =             333 MHz / 419 MHz
>    console: Coherency =                     None
>    console: Flash memory size =             4 MByte
>    console: SDRAM size =                    128 MByte
>    console: First free SDRAM address =      0x800c32f0
>    console: WARNING: Environment variable flash area is invalid!
>    console: HINT   : Perform "erase -e"
>    console: YAMON>
>    PASS (1.88 s)
>     (2/2) tests/avocado/machine_mips_malta.py:MaltaMachine.test_mips64el_malta_yamon:
>    ...
>    console: System controller/revision =    Galileo / GT_64120A-B-0
>    console: Processor Company ID/options =  0x01 (MIPS Technologies, Inc.) / 0x00
>    console: Processor ID/revision =         0x82 (MIPS 20Kc) / 0xa0
>    ...
>    console: YAMON>
>    PASS (1.89 s)
>    RESULTS    : PASS 2 | ERROR 0 | FAIL 0 | SKIP 0 | WARN 0 | INTERRUPT 0 | CANCEL 0
>    JOB TIME   : 4.57 s
> 
> YAMON does some endian-swapped acceses on the ISD<->PCI CFG/DATA
> registers. These tests are useful to debug cross-endianness issues,
> in particular on big-endian host.
> 
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> ---
>   tests/avocado/machine_mips_malta.py | 52 ++++++++++++++++++++++++++---
>   1 file changed, 48 insertions(+), 4 deletions(-)

> +class MaltaMachine(QemuSystemTest):
> +
> +    def do_test_yamon(self):

Not important but this block ... -->

> +        """
> +        :avocado: tags=arch:mipsel
> +        :avocado: tags=arch:mips64el
> +        :avocado: tags=machine:malta
> +        """

  <-- ... shouldn't be here.

> +        rom_url = ('http://www.imgtec.com/tools/mips-tools/downloads/'
> +                   'yamon/yamon-bin-02.22.zip')
> +        rom_hash = '8da7ecddbc5312704b8b324341ee238189bde480'
> +        zip_path = self.fetch_asset(rom_url, asset_hash=rom_hash)
> +
> +        archive.extract(zip_path, self.workdir)
> +        yamon_path = os.path.join(self.workdir, 'yamon-02.22.bin')
> +
> +        self.vm.set_console()
> +        self.vm.add_args('-bios', yamon_path)
> +        self.vm.launch()
> +
> +        prompt =  'YAMON>'
> +        pattern = 'YAMON ROM Monitor'
> +        interrupt_interactive_console_until_pattern(self, pattern, prompt)
> +        wait_for_console_pattern(self, prompt)
> +        self.vm.shutdown()
> +
> +    def test_mipsel_malta_yamon(self):
> +        """
> +        :avocado: tags=arch:mipsel
> +        :avocado: tags=machine:malta
> +        :avocado: tags=endian:little
> +        """
> +        self.do_test_yamon()
> +
> +    def test_mips64el_malta_yamon(self):
> +        """
> +        :avocado: tags=arch:mips64el
> +        :avocado: tags=machine:malta
> +        :avocado: tags=endian:little
> +        """
> +        self.do_test_yamon()
diff mbox series

Patch

diff --git a/tests/avocado/machine_mips_malta.py b/tests/avocado/machine_mips_malta.py
index f1895d59f3..a3b0b55305 100644
--- a/tests/avocado/machine_mips_malta.py
+++ b/tests/avocado/machine_mips_malta.py
@@ -11,11 +11,13 @@ 
 import gzip
 import logging
 
-from avocado import skipUnless
-from avocado_qemu import QemuSystemTest
-from avocado_qemu import wait_for_console_pattern
-from avocado.utils import archive
 from avocado import skipIf
+from avocado import skipUnless
+from avocado.utils import archive
+from avocado_qemu import QemuSystemTest
+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
 
 
 NUMPY_AVAILABLE = True
@@ -118,3 +120,45 @@  def test_mips_malta_i6400_framebuffer_logo_8cores(self):
         :avocado: tags=mips:smp
         """
         self.do_test_i6400_framebuffer_logo(8)
+
+class MaltaMachine(QemuSystemTest):
+
+    def do_test_yamon(self):
+        """
+        :avocado: tags=arch:mipsel
+        :avocado: tags=arch:mips64el
+        :avocado: tags=machine:malta
+        """
+        rom_url = ('http://www.imgtec.com/tools/mips-tools/downloads/'
+                   'yamon/yamon-bin-02.22.zip')
+        rom_hash = '8da7ecddbc5312704b8b324341ee238189bde480'
+        zip_path = self.fetch_asset(rom_url, asset_hash=rom_hash)
+
+        archive.extract(zip_path, self.workdir)
+        yamon_path = os.path.join(self.workdir, 'yamon-02.22.bin')
+
+        self.vm.set_console()
+        self.vm.add_args('-bios', yamon_path)
+        self.vm.launch()
+
+        prompt =  'YAMON>'
+        pattern = 'YAMON ROM Monitor'
+        interrupt_interactive_console_until_pattern(self, pattern, prompt)
+        wait_for_console_pattern(self, prompt)
+        self.vm.shutdown()
+
+    def test_mipsel_malta_yamon(self):
+        """
+        :avocado: tags=arch:mipsel
+        :avocado: tags=machine:malta
+        :avocado: tags=endian:little
+        """
+        self.do_test_yamon()
+
+    def test_mips64el_malta_yamon(self):
+        """
+        :avocado: tags=arch:mips64el
+        :avocado: tags=machine:malta
+        :avocado: tags=endian:little
+        """
+        self.do_test_yamon()