Skip to contentSkip to conversation

tests/acceptance: Test NetBSD 5.1 on the Jazz Magnum machine

PATCH In review Philippe Mathieu-Daudé 3 participants 5 messages Jul 5, 2021 – Jul 7, 2021

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 tests/acceptance: Test NetBSD 5.1 on the Jazz Magnum machine

Test NetBSD 5.1 on the Jazz Magnum machine. As the firmware is not redistributable, it has to be extracted from the floppy configuration disk coming with a Mips Magnum 4000 system, then the NTPROM_BIN_PATH environment variable has to be set. For convenience a NVRAM pre- initialized to boot NetBSD is included. The test can be run as:

  $ NTPROM_BIN_PATH=/path/to/ntprom.bin \
    avocado --show=app,console \
    run -t machine:magnum tests/acceptance/
  Fetching asset from tests/acceptance/machine_mips_jazz.py:MipsJazz.test_magnum_netbsd_5_1
   (1/1) tests/acceptance/machine_mips_jazz.py:MipsJazz.test_magnum_netbsd_5_1:
  console: EISA Bus 0 Initialization In Progress... Direct Memory Access (DMA) System Control Port B Timer 1 OK.
  console: ARC Multiboot Version 174 (SGI Version 2.6)
  console: Copyright (c) 1991,1992  Microsoft Corporation
  console: Actions:
  console: Start Windows NT
  console: Run a program
  console: Run setup
  console: Use the arrow keys to select.
  console: Press Enter to choose.
  console: Program to run:
  console: scsi(0)cdrom(2)fdisk(0)boot scsi(0)cdrom(2)fdisk(0)netbsd
  console: NetBSD/arc Bootstrap, Revision 1.1
  console: ([email protected], Sat Nov  6 14:06:36 UTC 2010)
  console: devopen: scsi(0)cdrom(2)fdisk(0) type disk file netbsd
  console: NetBSD 5.1 (RAMDISK) #0: Sat Nov  6 14:17:36 UTC 2010
  console: [email protected]:/home/builds/ab/netbsd-5-1-RELEASE/arc/201011061943Z-obj/home/builds/ab/netbsd-5-1-RELEASE/src/sys/arch/arc/compile/RAMDISK
  console: MIPS Magnum
  console: total memory = 128 MB
  console: avail memory = 117 MB
  console: mainbus0 (root)
  console: cpu0 at mainbus0: MIPS R4000 CPU (0x400) Rev. 0.0 with MIPS R4010 FPC Rev. 0.0
  console: cpu0: 8KB/16B direct-mapped L1 Instruction cache, 48 TLB entries
  console: cpu0: 8KB/16B direct-mapped write-back L1 Data cache
  console: jazzio0 at mainbus0
  console: timer0 at jazzio0 addr 0xe0000228
  console: mcclock0 at jazzio0 addr 0xe0004000: mc146818 compatible time-of-day clock
  console: LPT1 at jazzio0 addr 0xe0008000 intr 0 not configured
  console: fdc0 at jazzio0 addr 0xe0003000 intr 1
  console: fd0 at fdc0 drive 1: 1.44MB, 80 cyl, 2 head, 18 sec
  console: MAGNUM at jazzio0 addr 0xe000c000 intr 2 not configured
  console: VXL at jazzio0 addr 0xe0800000 intr 3 not configured
  console: sn0 at jazzio0 addr 0xe0001000 intr 4: SONIC Ethernet
  console: sn0: Ethernet address 00:00:00:00:00:00
  console: asc0 at jazzio0 addr 0xe0002000 intr 5: NCR53C94, 25MHz, SCSI ID 7
  console: scsibus0 at asc0: 8 targets, 8 luns per target
  console: pckbc0 at jazzio0 addr 0xe0005000 intr 6
  console: pckbd0 at pckbc0 (kbd slot)
  console: wskbd0 at pckbd0 (mux ignored)
  console: pms at jazzio0 addr 0xe0005000 intr 7 not configured
  console: com0 at jazzio0 addr 0xe0006000 intr 8: ns16550a, working fifo
  console: com0: txfifo disabled
  console: com0: console
  console: com1 at jazzio0 addr 0xe0007000 intr 9: ns16550a, working fifo
  console: com1: txfifo disabled
  console: jazzisabr0 at mainbus0
  console: isa0 at jazzisabr0
  console: isapnp0 at isa0 port 0x279: ISA Plug 'n Play device support
  console: scsibus0: waiting 2 seconds for devices to settle...
  console: cd0 at scsibus0 target 2 lun 0: <QEMU, QEMU CD-ROM, 2.5+> cdrom removable
  console: boot device: <unknown>
  console: root on md0a dumps on md0b
  console: root file system type: ffs
  console: WARNING: preposterous TOD clock time
  console: WARNING: using filesystem time
  console: WARNING: CHECK AND RESET THE DATE!
  console: erase ^H, werase ^W, kill ^U, intr ^C, status ^T
  console: Terminal type? [vt100]
  console: Erase is backspace.
  console: S
  console: (I)nstall, (S)hell or (H)alt ?
  console: #
  console: # ifconfig sn0 10.0.2.3/24
  console: # # #
  console: # ping -c 3 10.0.2.2
  console: # # # # # PING 10.0.2.2 (10.0.2.2): 56 data bytes
  console: 64 bytes from 10.0.2.2: icmp_seq=0 ttl=255 time=12.526 ms
  console: 64 bytes from 10.0.2.2: icmp_seq=1 ttl=255 time=2.324 ms
  console: 64 bytes from 10.0.2.2: icmp_seq=2 ttl=255 time=0.608 ms
  console: ----10.0.2.2 PING Statistics----
  console: 3 packets transmitted, 3 packets received, 0.0% packet loss
  console: shutdown -r now
  console: round-trip min/avg/max/stddev = 0.608/5.153/12.526/6.443 ms
  console: # Shutdown NOW!
  console: shutdown: [pid 14]
  console: # sh: /usr/bin/wall: not found
  console: reboot by root:
  console: System shutdown time has arrived
  console: About to run shutdown hooks...
  console: .: Can't open /etc/rc.shutdown
  console: Done running shutdown hooks.
  console: syncing disks... done
  console: unmounting file systems... done
  console: rebooting...
  PASS (39.06 s)
  RESULTS    : PASS 1 | ERROR 0 | FAIL 0 | SKIP 0 | WARN 0 | INTERRUPT 0 | CANCEL 0
  JOB TIME   : 39.54 s
---
 .../machine_mips_jazz.d/nvram.bin.xz          | Bin 0 -> 700 bytes
 tests/acceptance/machine_mips_jazz.py         |  96 ++++++++++++++++++
 2 files changed, 96 insertions(+)
 create mode 100644 tests/acceptance/machine_mips_jazz.d/nvram.bin.xz
 create mode 100644 tests/acceptance/machine_mips_jazz.py
tests/acceptance/machine_mips_jazz.d/nvram.bin.xz new file binary +0 -0
new file mode 100644
index 0000000000000000000000000000000000000000..4648bb31a75bd1a6ee06818a1bf0f2109203ced3
GIT binary patch
tests/acceptance/machine_mips_jazz.py new file +96 -0

96 lines not on this page · raw message

Signature · 1 line
2.31.1
#1 lore raw
Quoted 163 lines · Philippe Mathieu-Daudé

Test NetBSD 5.1 on the Jazz Magnum machine. As the firmware is not redistributable, it has to be extracted from the floppy configuration disk coming with a Mips Magnum 4000 system, then the NTPROM_BIN_PATH environment variable has to be set. For convenience a NVRAM pre- initialized to boot NetBSD is included. The test can be run as:

  $ NTPROM_BIN_PATH=/path/to/ntprom.bin \
    avocado --show=app,console \
    run -t machine:magnum tests/acceptance/
  Fetching asset from tests/acceptance/machine_mips_jazz.py:MipsJazz.test_magnum_netbsd_5_1
   (1/1) tests/acceptance/machine_mips_jazz.py:MipsJazz.test_magnum_netbsd_5_1:
  console: EISA Bus 0 Initialization In Progress... Direct Memory Access (DMA) System Control Port B Timer 1 OK.
  console: ARC Multiboot Version 174 (SGI Version 2.6)
  console: Copyright (c) 1991,1992  Microsoft Corporation
  console: Actions:
  console: Start Windows NT
  console: Run a program
  console: Run setup
  console: Use the arrow keys to select.
  console: Press Enter to choose.
  console: Program to run:
  console: scsi(0)cdrom(2)fdisk(0)boot scsi(0)cdrom(2)fdisk(0)netbsd
  console: NetBSD/arc Bootstrap, Revision 1.1
  console: ([email protected], Sat Nov  6 14:06:36 UTC 2010)
  console: devopen: scsi(0)cdrom(2)fdisk(0) type disk file netbsd
  console: NetBSD 5.1 (RAMDISK) #0: Sat Nov  6 14:17:36 UTC 2010
  console: [email protected]:/home/builds/ab/netbsd-5-1-RELEASE/arc/201011061943Z-obj/home/builds/ab/netbsd-5-1-RELEASE/src/sys/arch/arc/compile/RAMDISK
  console: MIPS Magnum
  console: total memory = 128 MB
  console: avail memory = 117 MB
  console: mainbus0 (root)
  console: cpu0 at mainbus0: MIPS R4000 CPU (0x400) Rev. 0.0 with MIPS R4010 FPC Rev. 0.0
  console: cpu0: 8KB/16B direct-mapped L1 Instruction cache, 48 TLB entries
  console: cpu0: 8KB/16B direct-mapped write-back L1 Data cache
  console: jazzio0 at mainbus0
  console: timer0 at jazzio0 addr 0xe0000228
  console: mcclock0 at jazzio0 addr 0xe0004000: mc146818 compatible time-of-day clock
  console: LPT1 at jazzio0 addr 0xe0008000 intr 0 not configured
  console: fdc0 at jazzio0 addr 0xe0003000 intr 1
  console: fd0 at fdc0 drive 1: 1.44MB, 80 cyl, 2 head, 18 sec
  console: MAGNUM at jazzio0 addr 0xe000c000 intr 2 not configured
  console: VXL at jazzio0 addr 0xe0800000 intr 3 not configured
  console: sn0 at jazzio0 addr 0xe0001000 intr 4: SONIC Ethernet
  console: sn0: Ethernet address 00:00:00:00:00:00
  console: asc0 at jazzio0 addr 0xe0002000 intr 5: NCR53C94, 25MHz, SCSI ID 7
  console: scsibus0 at asc0: 8 targets, 8 luns per target
  console: pckbc0 at jazzio0 addr 0xe0005000 intr 6
  console: pckbd0 at pckbc0 (kbd slot)
  console: wskbd0 at pckbd0 (mux ignored)
  console: pms at jazzio0 addr 0xe0005000 intr 7 not configured
  console: com0 at jazzio0 addr 0xe0006000 intr 8: ns16550a, working fifo
  console: com0: txfifo disabled
  console: com0: console
  console: com1 at jazzio0 addr 0xe0007000 intr 9: ns16550a, working fifo
  console: com1: txfifo disabled
  console: jazzisabr0 at mainbus0
  console: isa0 at jazzisabr0
  console: isapnp0 at isa0 port 0x279: ISA Plug 'n Play device support
  console: scsibus0: waiting 2 seconds for devices to settle...
  console: cd0 at scsibus0 target 2 lun 0: <QEMU, QEMU CD-ROM, 2.5+> cdrom removable
  console: boot device: <unknown>
  console: root on md0a dumps on md0b
  console: root file system type: ffs
  console: WARNING: preposterous TOD clock time
  console: WARNING: using filesystem time
  console: WARNING: CHECK AND RESET THE DATE!
  console: erase ^H, werase ^W, kill ^U, intr ^C, status ^T
  console: Terminal type? [vt100]
  console: Erase is backspace.
  console: S
  console: (I)nstall, (S)hell or (H)alt ?
  console: #
  console: # ifconfig sn0 10.0.2.3/24
  console: # # #
  console: # ping -c 3 10.0.2.2
  console: # # # # # PING 10.0.2.2 (10.0.2.2): 56 data bytes
  console: 64 bytes from 10.0.2.2: icmp_seq=0 ttl=255 time=12.526 ms
  console: 64 bytes from 10.0.2.2: icmp_seq=1 ttl=255 time=2.324 ms
  console: 64 bytes from 10.0.2.2: icmp_seq=2 ttl=255 time=0.608 ms
  console: ----10.0.2.2 PING Statistics----
  console: 3 packets transmitted, 3 packets received, 0.0% packet loss
  console: shutdown -r now
  console: round-trip min/avg/max/stddev = 0.608/5.153/12.526/6.443 ms
  console: # Shutdown NOW!
  console: shutdown: [pid 14]
  console: # sh: /usr/bin/wall: not found
  console: reboot by root:
  console: System shutdown time has arrived
  console: About to run shutdown hooks...
  console: .: Can't open /etc/rc.shutdown
  console: Done running shutdown hooks.
  console: syncing disks... done
  console: unmounting file systems... done
  console: rebooting...
  PASS (39.06 s)
  RESULTS    : PASS 1 | ERROR 0 | FAIL 0 | SKIP 0 | WARN 0 | INTERRUPT 0 | CANCEL 0
  JOB TIME   : 39.54 s
---
 .../machine_mips_jazz.d/nvram.bin.xz          | Bin 0 -> 700 bytes
 tests/acceptance/machine_mips_jazz.py         |  96 ++++++++++++++++++
 2 files changed, 96 insertions(+)
 create mode 100644 tests/acceptance/machine_mips_jazz.d/nvram.bin.xz
 create mode 100644 tests/acceptance/machine_mips_jazz.py
tests/acceptance/machine_mips_jazz.d/nvram.bin.xz new file binary +0 -0
new file mode 100644
index 0000000000000000000000000000000000000000..4648bb31a75bd1a6ee06818a1bf0f2109203ced3
GIT binary patch
tests/acceptance/machine_mips_jazz.py new file +27 -0
new file mode 100644
index 00000000000..0b6640edc12
@@ -0,0 +1,96 @@
+# Functional tests for the Jazz machines.
+#
+# Copyright (c) 2021 Philippe Mathieu-Daudé <[email protected]>
+#
+# This work is licensed under the terms of the GNU GPL, version 2 or later.
+# See the COPYING file in the top-level directory.
+#
+# SPDX-License-Identifier: GPL-2.0-or-later
+
+import os
+import lzma
+import shutil
+
+from avocado import skipUnless
+from avocado_qemu import Test
+from avocado_qemu import exec_command
+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 tesseract_utils import tesseract_available, tesseract_ocr
+
+class MipsJazz(Test):
+
+    timeout = 60
+
+    @skipUnless(os.getenv('NTPROM_BIN_PATH'), 'NTPROM_BIN_PATH not available')

tests/acceptance/machine_mips_jazz.py line 37

Quoted 10 lines
tests/acceptance/machine_mips_jazz.py new file +10 -0
+    def test_magnum_netbsd_5_1(self):
+        """
+        :avocado: tags=arch:mips64el
+        :avocado: tags=machine:magnum
+        :avocado: tags=os:netbsd
+        :avocado: tags=device:sonic
+        :avocado: tags=device:esp
+        """
+        drive_url = ('http://archive.netbsd.org/pub/NetBSD-archive/'
+                     'NetBSD-5.1/iso/arccd-5.1.iso')

This can be updated to NetBSD 9.2 (the regressions in NetBSD have been fixed).

tests/acceptance/machine_mips_jazz.py line 46

Quoted 9 lines
tests/acceptance/machine_mips_jazz.py new file +9 -0
+        drive_hash = ('c91a57fb373636247d1f1ce283a610ba529e208604a'
+                      'f2a9e0237551fb3d25459c7697775af8c8d35a9764e'
+                      'fca87cfb591f363643e93417cfdb8857215ceb405e')
+        drive_path = self.fetch_asset(drive_url, asset_hash=drive_hash,
+                                      algorithm='sha512')
+        ntprom_hash = '316de17820192c89b8ee6d9936ab8364a739ca53'
+        ntprom_path = self.fetch_asset('file://' + os.getenv('NTPROM_BIN_PATH'),
+                                       asset_hash=ntprom_hash, algorithm='sha1')
+        nvram_size = 8200

This nvram_size setting can be omitted now that Mark's recent patches have resolved the SONIC PROM issues in mainline.

You would need the extra 8 bytes of NVRAM only if you wanted to alter the stored MAC address after starting the guest. The configuration function in the ARC firmware allows for that but this test doesn't need it.

tests/acceptance/machine_mips_jazz.py line 47

Quoted 1 line
tests/acceptance/machine_mips_jazz.py new file +1 -0
+        nvram_path = 'nvram.bin'

Does the test work when nvram.bin is uninitialized by the ARC firmware?

Quoted 10 lines
tests/acceptance/machine_mips_jazz.py new file +10 -0
+        nvram_xz_hash = '3d4565124ff2369706b97e1d0ef127a68c23d418'
+        nvram_xz_path = os.path.dirname(os.path.abspath(__file__)) \
+                        + '/machine_mips_jazz.d/nvram.bin.xz'
+        nvram_xz_path = self.fetch_asset('file://' + nvram_xz_path,
+                                         asset_hash=nvram_xz_hash,
+                                         algorithm='sha1')
+
+        with lzma.open(nvram_xz_path, 'rb') as f_in:
+            with open(nvram_path, 'wb') as f_out:
+                shutil.copyfileobj(f_in, f_out)

tests/acceptance/machine_mips_jazz.py line 67

Quoted 10 lines
tests/acceptance/machine_mips_jazz.py new file +10 -0
+                f_out.seek(nvram_size)
+                f_out.write(b'\0')
+
+        self.vm.set_console()
+        self.vm.add_args('-bios', ntprom_path,
+                         '-drive', 'if=scsi,unit=2,media=cdrom,format=raw,file='
+                                   + drive_path,
+                         '-global', 'ds1225y.filename=' + nvram_path,
+                         '-global', 'ds1225y.size=' + str(nvram_size),
+                         '-nic', 'user,model=dp83932,mac=00:00:00:02:03:04')

Perhaps the default MAC address (from the SONIC PROM) would be more appropriate? Alternatively, if you want to check that '00:00:00:02:03:04' actually got used, you can do this:

erase ^H, werase ^W, kill ^U, intr ^C, status ^T
Terminal type? [vt100]
Erase is backspace.
(I)nstall, (S)hell or (H)alt ? s

# ifconfig
sn0: flags=0x8802<BROADCAST,SIMPLEX,MULTICAST> mtu 1500
        ec_capabilities=1<VLAN_MTU>
        ec_enabled=0
        address: 00:00:00:02:03:04
lo0: flags=0x8048<LOOPBACK,RUNNING,MULTICAST> mtu 33160
# 
Quoted 30 lines
tests/acceptance/machine_mips_jazz.py new file +29 -0
+        self.vm.launch()
+
+        console_pattern = 'ARC Multiboot Version 174 (SGI Version 2.6)'
+        wait_for_console_pattern(self, console_pattern)
+
+        wait_for_console_pattern(self, 'Use the arrow keys to select.')
+        exec_command(self, '\x1b[B') # Cursor Control 'Down'
+
+        program = 'scsi(0)cdrom(2)fdisk(0)boot scsi(0)cdrom(2)fdisk(0)netbsd'
+        exec_command(self, program)
+        wait_for_console_pattern(self, 'NetBSD/arc Bootstrap, Revision 1.1')
+
+        # Terminal type? [vt100]
+        console_pattern = 'erase ^H, werase ^W, kill ^U, intr ^C, status ^T'
+        wait_for_console_pattern(self, console_pattern)
+
+        # (I)nstall, (S)hell or (H)alt
+        exec_command_and_wait_for_pattern(self, '', 'Erase is backspace.')
+        exec_command(self, 'S')
+        interrupt_interactive_console_until_pattern(self, '#')
+
+        exec_command(self, 'ifconfig sn0 10.0.2.3/24')
+        interrupt_interactive_console_until_pattern(self, '#')
+
+        exec_command_and_wait_for_pattern(self, 'ping -c 3 10.0.2.2',
+                '3 packets transmitted, 3 packets received, 0.0% packet loss')
+
+        exec_command_and_wait_for_pattern(self, 'shutdown -r now',
+                                          'rebooting...')
#2 lore raw
Quoted 41 lines · Finn Thain
Quoted 39 lines · Philippe Mathieu-Daudé

Test NetBSD 5.1 on the Jazz Magnum machine. As the firmware is not redistributable, it has to be extracted from the floppy configuration disk coming with a Mips Magnum 4000 system, then the NTPROM_BIN_PATH environment variable has to be set. For convenience a NVRAM pre- initialized to boot NetBSD is included. The test can be run as:

  $ NTPROM_BIN_PATH=/path/to/ntprom.bin \
    avocado --show=app,console \
    run -t machine:magnum tests/acceptance/
  Fetching asset from tests/acceptance/machine_mips_jazz.py:MipsJazz.test_magnum_netbsd_5_1
   (1/1) tests/acceptance/machine_mips_jazz.py:MipsJazz.test_magnum_netbsd_5_1:
  console: EISA Bus 0 Initialization In Progress... Direct Memory Access (DMA) System Control Port B Timer 1 OK.
  console: ARC Multiboot Version 174 (SGI Version 2.6)
  console: Copyright (c) 1991,1992  Microsoft Corporation
  console: Actions:
  console: Start Windows NT
  console: Run a program
  console: Run setup
  console: Use the arrow keys to select.
  console: Press Enter to choose.
  console: Program to run:
  console: scsi(0)cdrom(2)fdisk(0)boot scsi(0)cdrom(2)fdisk(0)netbsd
  console: NetBSD/arc Bootstrap, Revision 1.1
  console: ([email protected], Sat Nov  6 14:06:36 UTC 2010)
  console: devopen: scsi(0)cdrom(2)fdisk(0) type disk file netbsd
  console: NetBSD 5.1 (RAMDISK) #0: Sat Nov  6 14:17:36 UTC 2010
  console: [email protected]:/home/builds/ab/netbsd-5-1-RELEASE/arc/201011061943Z-obj/home/builds/ab/netbsd-5-1-RELEASE/src/sys/arch/arc/compile/RAMDISK
  console: MIPS Magnum
(quoted diff) +10 -0
+class MipsJazz(Test):
+
+    timeout = 60
+
+    @skipUnless(os.getenv('NTPROM_BIN_PATH'), 'NTPROM_BIN_PATH not available')
+    def test_magnum_netbsd_5_1(self):
+        """
+        :avocado: tags=arch:mips64el
+        :avocado: tags=machine:magnum
+        :avocado: tags=os:netbsd
Quoted 8 lines

Review

Quoted 5 lines
(quoted diff) +5 -0
+        :avocado: tags=device:sonic
+        :avocado: tags=device:esp
+        """
+        drive_url = ('http://archive.netbsd.org/pub/NetBSD-archive/'
+                     'NetBSD-5.1/iso/arccd-5.1.iso')

This can be updated to NetBSD 9.2 (the regressions in NetBSD have been fixed).

Indeed, with this change:

-- >8 --

(quoted diff) +0 -0

b/tests/acceptance/machine_mips_jazz.py
index 0b6640edc12..54968959372 100644

tests/acceptance/machine_mips_jazz.py +4 -6
@@ -33,13 +33,11 @@ def test_magnum_netbsd_5_1(self):
         :avocado: tags=device:sonic
         :avocado: tags=device:esp
         """
-        drive_url = ('http://archive.netbsd.org/pub/NetBSD-archive/'
-                     'NetBSD-5.1/iso/arccd-5.1.iso')
-        drive_hash = ('c91a57fb373636247d1f1ce283a610ba529e208604a'
-                      'f2a9e0237551fb3d25459c7697775af8c8d35a9764e'
-                      'fca87cfb591f363643e93417cfdb8857215ceb405e')
+        drive_url = ('http://cdn.netbsd.org/pub/NetBSD/'
+                     'NetBSD-9.2/images/NetBSD-9.2-arc.iso')
+        drive_hash = '409c61aee5459e762cdb120d2591ed2e'
         drive_path = self.fetch_asset(drive_url, asset_hash=drive_hash,
-                                      algorithm='sha512')
+                                      algorithm='md5')
         ntprom_hash = '316de17820192c89b8ee6d9936ab8364a739ca53'
         ntprom_path = self.fetch_asset('file://' +

os.getenv('NTPROM_BIN_PATH'),
asset_hash=ntprom_hash,
algorithm='sha1')
---

I get:

console: [ 1.0000000] NetBSD 9.2 (RAMDISK) #0: Wed May 12 13:15:55 UTC
2021
console: [ 1.0000000]
[email protected]:/usr/src/sys/arch/arc/compile/RAMDISK
console: [ 1.0000000] MIPS Magnum
...
console: # [ 6.1232105]
pmap_tlb_update_addr(0x87eb5f60,0x69a000,0x1ee59e, 0)
...
console: [ 20.2174752] rebooting...
PASS (48.98 s)

Quoted 3 lines
Quoted 1 line

+ nvram_path = 'nvram.bin'

Does the test work when nvram.bin is uninitialized by the ARC firmware?

No, because the serial is not used by default.

Quoted 8 lines

Perhaps the default MAC address (from the SONIC PROM) would be more appropriate? Alternatively, if you want to check that '00:00:00:02:03:04' actually got used, you can do this:

erase ^H, werase ^W, kill ^U, intr ^C, status ^T
Terminal type? [vt100]
Erase is backspace.
(I)nstall, (S)hell or (H)alt ? s

Quoted 7 lines
# ifconfig
sn0: flags=0x8802<BROADCAST,SIMPLEX,MULTICAST> mtu 1500
        ec_capabilities=1<VLAN_MTU>
        ec_enabled=0
        address: 00:00:00:02:03:04
lo0: flags=0x8048<LOOPBACK,RUNNING,MULTICAST> mtu 33160
# 

I noticed it was not working, maybe I'm missing one of Mark's patches.

Thanks for the review,

Phil.

#3 lore raw
Quoted 117 lines · Philippe Mathieu-Daudé
Quoted 41 lines · Finn Thain
Quoted 39 lines · Philippe Mathieu-Daudé

Test NetBSD 5.1 on the Jazz Magnum machine. As the firmware is not redistributable, it has to be extracted from the floppy configuration disk coming with a Mips Magnum 4000 system, then the NTPROM_BIN_PATH environment variable has to be set. For convenience a NVRAM pre- initialized to boot NetBSD is included. The test can be run as:

  $ NTPROM_BIN_PATH=/path/to/ntprom.bin \
    avocado --show=app,console \
    run -t machine:magnum tests/acceptance/
  Fetching asset from tests/acceptance/machine_mips_jazz.py:MipsJazz.test_magnum_netbsd_5_1
   (1/1) tests/acceptance/machine_mips_jazz.py:MipsJazz.test_magnum_netbsd_5_1:
  console: EISA Bus 0 Initialization In Progress... Direct Memory Access (DMA) System Control Port B Timer 1 OK.
  console: ARC Multiboot Version 174 (SGI Version 2.6)
  console: Copyright (c) 1991,1992  Microsoft Corporation
  console: Actions:
  console: Start Windows NT
  console: Run a program
  console: Run setup
  console: Use the arrow keys to select.
  console: Press Enter to choose.
  console: Program to run:
  console: scsi(0)cdrom(2)fdisk(0)boot scsi(0)cdrom(2)fdisk(0)netbsd
  console: NetBSD/arc Bootstrap, Revision 1.1
  console: ([email protected], Sat Nov  6 14:06:36 UTC 2010)
  console: devopen: scsi(0)cdrom(2)fdisk(0) type disk file netbsd
  console: NetBSD 5.1 (RAMDISK) #0: Sat Nov  6 14:17:36 UTC 2010
  console: [email protected]:/home/builds/ab/netbsd-5-1-RELEASE/arc/201011061943Z-obj/home/builds/ab/netbsd-5-1-RELEASE/src/sys/arch/arc/compile/RAMDISK
  console: MIPS Magnum
(quoted diff) +10 -0
+class MipsJazz(Test):
+
+    timeout = 60
+
+    @skipUnless(os.getenv('NTPROM_BIN_PATH'), 'NTPROM_BIN_PATH not available')
+    def test_magnum_netbsd_5_1(self):
+        """
+        :avocado: tags=arch:mips64el
+        :avocado: tags=machine:magnum
+        :avocado: tags=os:netbsd
Quoted 8 lines

Review

Quoted 5 lines
(quoted diff) +5 -0
+        :avocado: tags=device:sonic
+        :avocado: tags=device:esp
+        """
+        drive_url = ('http://archive.netbsd.org/pub/NetBSD-archive/'
+                     'NetBSD-5.1/iso/arccd-5.1.iso')

This can be updated to NetBSD 9.2 (the regressions in NetBSD have been fixed).

Indeed, with this change:

-- >8 --

tests/acceptance/machine_mips_jazz.py +4 -6
index 0b6640edc12..54968959372 100644
@@ -33,13 +33,11 @@ def test_magnum_netbsd_5_1(self):
         :avocado: tags=device:sonic
         :avocado: tags=device:esp
         """
-        drive_url = ('http://archive.netbsd.org/pub/NetBSD-archive/'
-                     'NetBSD-5.1/iso/arccd-5.1.iso')
-        drive_hash = ('c91a57fb373636247d1f1ce283a610ba529e208604a'
-                      'f2a9e0237551fb3d25459c7697775af8c8d35a9764e'
-                      'fca87cfb591f363643e93417cfdb8857215ceb405e')
+        drive_url = ('http://cdn.netbsd.org/pub/NetBSD/'
+                     'NetBSD-9.2/images/NetBSD-9.2-arc.iso')
+        drive_hash = '409c61aee5459e762cdb120d2591ed2e'
         drive_path = self.fetch_asset(drive_url, asset_hash=drive_hash,
-                                      algorithm='sha512')
+                                      algorithm='md5')
         ntprom_hash = '316de17820192c89b8ee6d9936ab8364a739ca53'
         ntprom_path = self.fetch_asset('file://' +
 os.getenv('NTPROM_BIN_PATH'),

asset_hash=ntprom_hash,
algorithm='sha1')
---

I get:

console: [ 1.0000000] NetBSD 9.2 (RAMDISK) #0: Wed May 12 13:15:55 UTC
2021
console: [ 1.0000000]
[email protected]:/usr/src/sys/arch/arc/compile/RAMDISK
console: [ 1.0000000] MIPS Magnum
...
console: # [ 6.1232105]
pmap_tlb_update_addr(0x87eb5f60,0x69a000,0x1ee59e, 0)
...
console: [ 20.2174752] rebooting...
PASS (48.98 s)

Quoted 3 lines
Quoted 1 line

+ nvram_path = 'nvram.bin'

Does the test work when nvram.bin is uninitialized by the ARC firmware?

No, because the serial is not used by default.

Quoted 8 lines

Perhaps the default MAC address (from the SONIC PROM) would be more appropriate? Alternatively, if you want to check that '00:00:00:02:03:04' actually got used, you can do this:

erase ^H, werase ^W, kill ^U, intr ^C, status ^T
Terminal type? [vt100]
Erase is backspace.
(I)nstall, (S)hell or (H)alt ? s

Quoted 7 lines
# ifconfig
sn0: flags=0x8802<BROADCAST,SIMPLEX,MULTICAST> mtu 1500
        ec_capabilities=1<VLAN_MTU>
        ec_enabled=0
        address: 00:00:00:02:03:04
lo0: flags=0x8048<LOOPBACK,RUNNING,MULTICAST> mtu 33160
# 
Quoted 2 lines

I noticed it was not working, maybe I'm missing one of Mark's patches.

That's strange. The MAC address is correct on mainline (as at 711c0418c8, at least) for NetBSD and Linux guests hosted on my x86 machine.

Quoted 4 lines

Thanks for the review,

Phil.

#4 lore raw
In reply to Philippe Mathieu-Daudé
Quoted 163 lines · Philippe Mathieu-Daudé

Test NetBSD 5.1 on the Jazz Magnum machine. As the firmware is not redistributable, it has to be extracted from the floppy configuration disk coming with a Mips Magnum 4000 system, then the NTPROM_BIN_PATH environment variable has to be set. For convenience a NVRAM pre- initialized to boot NetBSD is included. The test can be run as:

   $ NTPROM_BIN_PATH=/path/to/ntprom.bin \
     avocado --show=app,console \
     run -t machine:magnum tests/acceptance/
   Fetching asset from tests/acceptance/machine_mips_jazz.py:MipsJazz.test_magnum_netbsd_5_1
    (1/1) tests/acceptance/machine_mips_jazz.py:MipsJazz.test_magnum_netbsd_5_1:
   console: EISA Bus 0 Initialization In Progress... Direct Memory Access (DMA) System Control Port B Timer 1 OK.
   console: ARC Multiboot Version 174 (SGI Version 2.6)
   console: Copyright (c) 1991,1992  Microsoft Corporation
   console: Actions:
   console: Start Windows NT
   console: Run a program
   console: Run setup
   console: Use the arrow keys to select.
   console: Press Enter to choose.
   console: Program to run:
   console: scsi(0)cdrom(2)fdisk(0)boot scsi(0)cdrom(2)fdisk(0)netbsd
   console: NetBSD/arc Bootstrap, Revision 1.1
   console: ([email protected], Sat Nov  6 14:06:36 UTC 2010)
   console: devopen: scsi(0)cdrom(2)fdisk(0) type disk file netbsd
   console: NetBSD 5.1 (RAMDISK) #0: Sat Nov  6 14:17:36 UTC 2010
   console: [email protected]:/home/builds/ab/netbsd-5-1-RELEASE/arc/201011061943Z-obj/home/builds/ab/netbsd-5-1-RELEASE/src/sys/arch/arc/compile/RAMDISK
   console: MIPS Magnum
   console: total memory = 128 MB
   console: avail memory = 117 MB
   console: mainbus0 (root)
   console: cpu0 at mainbus0: MIPS R4000 CPU (0x400) Rev. 0.0 with MIPS R4010 FPC Rev. 0.0
   console: cpu0: 8KB/16B direct-mapped L1 Instruction cache, 48 TLB entries
   console: cpu0: 8KB/16B direct-mapped write-back L1 Data cache
   console: jazzio0 at mainbus0
   console: timer0 at jazzio0 addr 0xe0000228
   console: mcclock0 at jazzio0 addr 0xe0004000: mc146818 compatible time-of-day clock
   console: LPT1 at jazzio0 addr 0xe0008000 intr 0 not configured
   console: fdc0 at jazzio0 addr 0xe0003000 intr 1
   console: fd0 at fdc0 drive 1: 1.44MB, 80 cyl, 2 head, 18 sec
   console: MAGNUM at jazzio0 addr 0xe000c000 intr 2 not configured
   console: VXL at jazzio0 addr 0xe0800000 intr 3 not configured
   console: sn0 at jazzio0 addr 0xe0001000 intr 4: SONIC Ethernet
   console: sn0: Ethernet address 00:00:00:00:00:00
   console: asc0 at jazzio0 addr 0xe0002000 intr 5: NCR53C94, 25MHz, SCSI ID 7
   console: scsibus0 at asc0: 8 targets, 8 luns per target
   console: pckbc0 at jazzio0 addr 0xe0005000 intr 6
   console: pckbd0 at pckbc0 (kbd slot)
   console: wskbd0 at pckbd0 (mux ignored)
   console: pms at jazzio0 addr 0xe0005000 intr 7 not configured
   console: com0 at jazzio0 addr 0xe0006000 intr 8: ns16550a, working fifo
   console: com0: txfifo disabled
   console: com0: console
   console: com1 at jazzio0 addr 0xe0007000 intr 9: ns16550a, working fifo
   console: com1: txfifo disabled
   console: jazzisabr0 at mainbus0
   console: isa0 at jazzisabr0
   console: isapnp0 at isa0 port 0x279: ISA Plug 'n Play device support
   console: scsibus0: waiting 2 seconds for devices to settle...
   console: cd0 at scsibus0 target 2 lun 0: <QEMU, QEMU CD-ROM, 2.5+> cdrom removable
   console: boot device: <unknown>
   console: root on md0a dumps on md0b
   console: root file system type: ffs
   console: WARNING: preposterous TOD clock time
   console: WARNING: using filesystem time
   console: WARNING: CHECK AND RESET THE DATE!
   console: erase ^H, werase ^W, kill ^U, intr ^C, status ^T
   console: Terminal type? [vt100]
   console: Erase is backspace.
   console: S
   console: (I)nstall, (S)hell or (H)alt ?
   console: #
   console: # ifconfig sn0 10.0.2.3/24
   console: # # #
   console: # ping -c 3 10.0.2.2
   console: # # # # # PING 10.0.2.2 (10.0.2.2): 56 data bytes
   console: 64 bytes from 10.0.2.2: icmp_seq=0 ttl=255 time=12.526 ms
   console: 64 bytes from 10.0.2.2: icmp_seq=1 ttl=255 time=2.324 ms
   console: 64 bytes from 10.0.2.2: icmp_seq=2 ttl=255 time=0.608 ms
   console: ----10.0.2.2 PING Statistics----
   console: 3 packets transmitted, 3 packets received, 0.0% packet loss
   console: shutdown -r now
   console: round-trip min/avg/max/stddev = 0.608/5.153/12.526/6.443 ms
   console: # Shutdown NOW!
   console: shutdown: [pid 14]
   console: # sh: /usr/bin/wall: not found
   console: reboot by root:
   console: System shutdown time has arrived
   console: About to run shutdown hooks...
   console: .: Can't open /etc/rc.shutdown
   console: Done running shutdown hooks.
   console: syncing disks... done
   console: unmounting file systems... done
   console: rebooting...
   PASS (39.06 s)
   RESULTS    : PASS 1 | ERROR 0 | FAIL 0 | SKIP 0 | WARN 0 | INTERRUPT 0 | CANCEL 0
   JOB TIME   : 39.54 s
---
  .../machine_mips_jazz.d/nvram.bin.xz          | Bin 0 -> 700 bytes
  tests/acceptance/machine_mips_jazz.py         |  96 ++++++++++++++++++
  2 files changed, 96 insertions(+)

create mode 100644 tests/acceptance/machine_mips_jazz.d/nvram.bin.xz create mode 100644 tests/acceptance/machine_mips_jazz.py

tests/acceptance/machine_mips_jazz.d/nvram.bin.xz new file binary +0 -0
new file mode 100644
index 0000000000000000000000000000000000000000..4648bb31a75bd1a6ee06818a1bf0f2109203ced3
GIT binary patch
tests/acceptance/machine_mips_jazz.py new file +27 -0
new file mode 100644
index 00000000000..0b6640edc12
@@ -0,0 +1,96 @@
+# Functional tests for the Jazz machines.
+#
+# Copyright (c) 2021 Philippe Mathieu-Daudé <[email protected]>
+#
+# This work is licensed under the terms of the GNU GPL, version 2 or later.
+# See the COPYING file in the top-level directory.
+#
+# SPDX-License-Identifier: GPL-2.0-or-later
+
+import os
+import lzma
+import shutil
+
+from avocado import skipUnless
+from avocado_qemu import Test
+from avocado_qemu import exec_command
+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 tesseract_utils import tesseract_available, tesseract_ocr
+
+class MipsJazz(Test):
+
+    timeout = 60
+
+    @skipUnless(os.getenv('NTPROM_BIN_PATH'), 'NTPROM_BIN_PATH not available')

tests/acceptance/machine_mips_jazz.py line 37

Quoted 10 lines
tests/acceptance/machine_mips_jazz.py new file +10 -0
+    def test_magnum_netbsd_5_1(self):
+        """
+        :avocado: tags=arch:mips64el
+        :avocado: tags=machine:magnum
+        :avocado: tags=os:netbsd
+        :avocado: tags=device:sonic
+        :avocado: tags=device:esp
+        """
+        drive_url = ('http://archive.netbsd.org/pub/NetBSD-archive/'
+                     'NetBSD-5.1/iso/arccd-5.1.iso')

Is there a particular reason while the old version of NetBSD is being used? I'm currently testing NetBSD/arc using the latest NetBSD-9.2-arc.iso.

Quoted 19 lines
tests/acceptance/machine_mips_jazz.py new file +19 -0
+        drive_hash = ('c91a57fb373636247d1f1ce283a610ba529e208604a'
+                      'f2a9e0237551fb3d25459c7697775af8c8d35a9764e'
+                      'fca87cfb591f363643e93417cfdb8857215ceb405e')
+        drive_path = self.fetch_asset(drive_url, asset_hash=drive_hash,
+                                      algorithm='sha512')
+        ntprom_hash = '316de17820192c89b8ee6d9936ab8364a739ca53'
+        ntprom_path = self.fetch_asset('file://' + os.getenv('NTPROM_BIN_PATH'),
+                                       asset_hash=ntprom_hash, algorithm='sha1')
+        nvram_size = 8200
+        nvram_path = 'nvram.bin'
+        nvram_xz_hash = '3d4565124ff2369706b97e1d0ef127a68c23d418'
+        nvram_xz_path = os.path.dirname(os.path.abspath(__file__)) \
+                        + '/machine_mips_jazz.d/nvram.bin.xz'
+        nvram_xz_path = self.fetch_asset('file://' + nvram_xz_path,
+                                         asset_hash=nvram_xz_hash,
+                                         algorithm='sha1')
+
+        with lzma.open(nvram_xz_path, 'rb') as f_in:
+            with open(nvram_path, 'wb') as f_out:

tests/acceptance/machine_mips_jazz.py line 66

Quoted 10 lines
tests/acceptance/machine_mips_jazz.py new file +10 -0
+                shutil.copyfileobj(f_in, f_out)
+                f_out.seek(nvram_size)
+                f_out.write(b'\0')
+
+        self.vm.set_console()
+        self.vm.add_args('-bios', ntprom_path,
+                         '-drive', 'if=scsi,unit=2,media=cdrom,format=raw,file='
+                                   + drive_path,
+                         '-global', 'ds1225y.filename=' + nvram_path,
+                         '-global', 'ds1225y.size=' + str(nvram_size),

You can drop the ds1225y.size=8200 parameter since that was a workaround for older QEMU versions that didn't have PROM support (see https://lists.gnu.org/archive/html/qemu-devel/2021-06/msg06951.html). The current version of QEMU will expose the MAC address provided by -nic via the PROM directly.

Also given that you are using "Run a program" you may not even need an nvram file once this option has been removed.

tests/acceptance/machine_mips_jazz.py line 74

Quoted 8 lines
tests/acceptance/machine_mips_jazz.py new file +8 -0
+                         '-nic', 'user,model=dp83932,mac=00:00:00:02:03:04')
+        self.vm.launch()
+
+        console_pattern = 'ARC Multiboot Version 174 (SGI Version 2.6)'
+        wait_for_console_pattern(self, console_pattern)
+
+        wait_for_console_pattern(self, 'Use the arrow keys to select.')
+        exec_command(self, '\x1b[B') # Cursor Control 'Down'

Probably worth mentioning this is the "Run a program" option in the comment?

Quoted 12 lines
tests/acceptance/machine_mips_jazz.py new file +11 -0
+        program = 'scsi(0)cdrom(2)fdisk(0)boot scsi(0)cdrom(2)fdisk(0)netbsd'
+        exec_command(self, program)
+        wait_for_console_pattern(self, 'NetBSD/arc Bootstrap, Revision 1.1')
+
+        # Terminal type? [vt100]
+        console_pattern = 'erase ^H, werase ^W, kill ^U, intr ^C, status ^T'
+        wait_for_console_pattern(self, console_pattern)
+
+        # (I)nstall, (S)hell or (H)alt
+        exec_command_and_wait_for_pattern(self, '', 'Erase is backspace.')
+        exec_command(self, 'S')

tests/acceptance/machine_mips_jazz.py line 96

Quoted 10 lines
tests/acceptance/machine_mips_jazz.py new file +10 -0
+        interrupt_interactive_console_until_pattern(self, '#')
+
+        exec_command(self, 'ifconfig sn0 10.0.2.3/24')
+        interrupt_interactive_console_until_pattern(self, '#')
+
+        exec_command_and_wait_for_pattern(self, 'ping -c 3 10.0.2.2',
+                '3 packets transmitted, 3 packets received, 0.0% packet loss')
+
+        exec_command_and_wait_for_pattern(self, 'shutdown -r now',
+                                          'rebooting...')

Otherwise seems good to me.

ATB,

Mark.