Add functional test for Boston AIA board. The P8700 RISC-V based CPU by MIPS supports it at the moment.
Signed-off-by: Chao-ying Fu <c...@mips.com> Signed-off-by: Djordje Todorovic <djordje.todoro...@htecgroup.com> --- tests/functional/meson.build | 1 + tests/functional/test_riscv64_boston.py | 78 +++++++++++++++++++++++++ 2 files changed, 79 insertions(+) create mode 100755 tests/functional/test_riscv64_boston.py diff --git a/tests/functional/meson.build b/tests/functional/meson.build index 52b4706cfe..317e085bfb 100644 --- a/tests/functional/meson.build +++ b/tests/functional/meson.build @@ -259,6 +259,7 @@ tests_riscv32_system_thorough = [ tests_riscv64_system_quick = [ 'migration', 'riscv_opensbi', + 'riscv64_boston', ] tests_riscv64_system_thorough = [ diff --git a/tests/functional/test_riscv64_boston.py b/tests/functional/test_riscv64_boston.py new file mode 100755 index 0000000000..eb5dd07b79 --- /dev/null +++ b/tests/functional/test_riscv64_boston.py @@ -0,0 +1,78 @@ +#!/usr/bin/env python3 +# +# Boston board test for RISC-V P8700 processor by MIPS +# +# Copyright (c) 2025 MIPS +# +# SPDX-License-Identifier: LGPL-2.1-or-later +# + +from qemu_test import QemuSystemTest + +class RiscvBostonTest(QemuSystemTest): + """ + Test the boston-aia board with P8700 processor + """ + + timeout = 10 + + def test_boston_memory_constraints(self): + """ + Test that boston-aia board enforces memory size constraints + """ + # Test invalid memory size + self.set_machine('boston-aia') + self.vm.add_args('-cpu', 'mips-p8700') + self.vm.add_args('-m', '512M') # Invalid size + self.vm.add_args('-nographic') + self.vm.set_qmp_monitor(enabled=False) + self.vm.launch() + self.vm.wait() + + # Should fail due to invalid memory size + self.assertEqual(self.vm.exitcode(), 1) + log = self.vm.get_log() + self.assertIn("Memory size must be 1GB, 2GB, 3GB, or 4GB", log) + + def test_boston_requires_kernel(self): + """ + Test that boston-aia board requires a kernel or bios + """ + self.set_machine('boston-aia') + self.vm.add_args('-cpu', 'mips-p8700') + self.vm.add_args('-m', '1G') # Valid size + self.vm.add_args('-nographic') + # No kernel or bios specified + self.vm.set_qmp_monitor(enabled=False) + self.vm.launch() + self.vm.wait() + + # Should fail due to missing kernel/bios + self.assertEqual(self.vm.exitcode(), 1) + log = self.vm.get_log() + self.assertIn("Please provide either a -kernel or -bios argument", log) + + def test_boston_cpu_count(self): + """ + Test various CPU counts for boston-aia board + """ + cpu_counts = [1, 2, 4, 8] + + for cpus in cpu_counts: + with self.subTest(cpus=cpus): + self.set_machine('boston-aia') + self.vm.add_args('-cpu', 'mips-p8700') + self.vm.add_args('-smp', str(cpus)) + self.vm.add_args('-m', '1G') + self.vm.add_args('-nographic') + self.vm.set_qmp_monitor(enabled=False) + self.vm.launch() + self.vm.wait() + + # Board should fail due to missing kernel, not CPU count + self.assertEqual(self.vm.exitcode(), 1) + log = self.vm.get_log() + self.assertIn("Please provide either a -kernel or -bios argument", log) + +if __name__ == '__main__': + QemuSystemTest.main() -- 2.34.1