Skip to contentSkip to conversation

tests/functional: Add a test for the Arduino UNO machine

PATCH In review Thomas Huth 2 participants 2 messages Jun 3, 2025 – Jun 4, 2025 Arm/Amlogic Meson SoC support

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 tests/functional: Add a test for the Arduino UNO machine

From: Thomas Huth <[email protected]>

Check whether we can run a kernel that prints something to the serial console.

---
 MAINTAINERS                      |  3 ++-
 tests/functional/meson.build     |  1 +
 tests/functional/test_avr_uno.py | 32 ++++++++++++++++++++++++++++++++
 3 files changed, 35 insertions(+), 1 deletion(-)
 create mode 100755 tests/functional/test_avr_uno.py
MAINTAINERS +2 -1
index 0d1023635ee..eb56bc0ad1d 100644
@@ -219,7 +219,7 @@ S: Maintained
 F: docs/system/target-avr.rst
 F: gdb-xml/avr-cpu.xml
 F: target/avr/
-F: tests/functional/test_avr_mega2560.py
+F: tests/functional/test_avr_*.py
 
 Hexagon TCG CPUs
 M: Brian Cain <[email protected]>
@@ -1237,6 +1237,7 @@ Arduino
 M: Philippe Mathieu-Daudé <[email protected]>
 S: Maintained
 F: hw/avr/arduino.c
+F: tests/functional/test_avr_uno.py
 
 HP-PARISC Machines
 ------------------
tests/functional/meson.build +1 -0
index 0de1caa0f72..3c50bde9349 100644
@@ -151,6 +151,7 @@ tests_arm_linuxuser_thorough = [
 
 tests_avr_system_thorough = [
   'avr_mega2560',
+  'avr_uno',
 ]
 
 tests_hppa_system_quick = [
tests/functional/test_avr_uno.py new file +32 -0
new file mode 100755
index 00000000000..adb3b73da4f
@@ -0,0 +1,32 @@
+#!/usr/bin/env python3
+#
+# QEMU AVR Arduino UNO functional test
+#
+# SPDX-License-Identifier: GPL-2.0-or-later
+
+from qemu_test import QemuSystemTest, Asset, wait_for_console_pattern
+
+
+class UnoMachine(QemuSystemTest):
+
+    ASSET_UNO = Asset(
+        ('https://github.com/RahulRNandan/LED_Blink_AVR/raw/'
+         'c6d602cbb974a193/build/main.elf'),
+        '3009a4e2cf5c5b65142f538abdf66d4dc6bc6beab7e552fff9ae314583761b72')
+
+    def test_uno(self):
+        """
+        The binary constantly prints out 'LED Blink'
+        """
+        self.set_machine('arduino-uno')
+        rom_path = self.ASSET_UNO.fetch()
+
+        self.vm.add_args('-bios', rom_path)
+        self.vm.set_console()
+        self.vm.launch()
+
+        wait_for_console_pattern(self, 'LED Blink')
+
+
+if __name__ == '__main__':
+    QemuSystemTest.main()
Signature · 1 line
2.49.0
Reviewed-by on v1 1/1
#1 lore raw
Quoted 74 lines · Thomas Huth

From: Thomas Huth <[email protected]>

Check whether we can run a kernel that prints something to the serial console.

---
  MAINTAINERS                      |  3 ++-
  tests/functional/meson.build     |  1 +
  tests/functional/test_avr_uno.py | 32 ++++++++++++++++++++++++++++++++
  3 files changed, 35 insertions(+), 1 deletion(-)

create mode 100755 tests/functional/test_avr_uno.py

MAINTAINERS +2 -1
index 0d1023635ee..eb56bc0ad1d 100644
@@ -219,7 +219,7 @@ S: Maintained
  F: docs/system/target-avr.rst
  F: gdb-xml/avr-cpu.xml
  F: target/avr/
-F: tests/functional/test_avr_mega2560.py
+F: tests/functional/test_avr_*.py
 
  Hexagon TCG CPUs
  M: Brian Cain <[email protected]>
@@ -1237,6 +1237,7 @@ Arduino
  M: Philippe Mathieu-Daudé <[email protected]>
  S: Maintained
  F: hw/avr/arduino.c
+F: tests/functional/test_avr_uno.py
 
  HP-PARISC Machines
  ------------------
tests/functional/meson.build +1 -0
index 0de1caa0f72..3c50bde9349 100644
@@ -151,6 +151,7 @@ tests_arm_linuxuser_thorough = [
 
  tests_avr_system_thorough = [
    'avr_mega2560',
+  'avr_uno',
  ]
 
  tests_hppa_system_quick = [
tests/functional/test_avr_uno.py new file +22 -0
new file mode 100755
index 00000000000..adb3b73da4f
@@ -0,0 +1,32 @@
+#!/usr/bin/env python3
+#
+# QEMU AVR Arduino UNO functional test
+#
+# SPDX-License-Identifier: GPL-2.0-or-later
+
+from qemu_test import QemuSystemTest, Asset, wait_for_console_pattern
+
+
+class UnoMachine(QemuSystemTest):
+
+    ASSET_UNO = Asset(
+        ('https://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_RahulRNandan_LED-5FBlink-5FAVR_raw_&d=DwIDaQ&c=s883GpUCOChKOHiocYtGcg&r=c23RpsaH4D2MKyD3EPJTDa0BAxz6tV8aUJqVSoytEiY&m=530NWSnMpE_NPXBxuADIlm0sMstPhW77cROz21WCPe3qMNFYpc8YLkcGuSuKkEQb&s=vKvgS1S-708MYmvw6As7RxsfFDGwddkmpsk4T3J6if0&e= '
+         'c6d602cbb974a193/build/main.elf'),
+        '3009a4e2cf5c5b65142f538abdf66d4dc6bc6beab7e552fff9ae314583761b72')
+
+    def test_uno(self):
+        """
+        The binary constantly prints out 'LED Blink'
+        """
+        self.set_machine('arduino-uno')
+        rom_path = self.ASSET_UNO.fetch()

tests/functional/test_avr_uno.py line 32

Quoted 10 lines
tests/functional/test_avr_uno.py new file +10 -0
+
+        self.vm.add_args('-bios', rom_path)
+        self.vm.set_console()
+        self.vm.launch()
+
+        wait_for_console_pattern(self, 'LED Blink')
+
+
+if __name__ == '__main__':
+    QemuSystemTest.main()

ATB,

Mark.