@samitouri / QOSamiQemu / commits / 49aecf3900

tests/functional/aarch64: add raspi4b full-RAM regression test

Guards against the bug fixed in the previous commit: boots raspi4b's default 2 GiB configuration and checks that the guest actually sees close to that (>1.9M kB), not the ~921 MiB the bug left it capped at. Deliberately checks a threshold rather than the exact byte count of either figure, since the precise number depends on how this specific pinned kernel accounts for its own early reservations; the threshold is comfortably between the two (943524 kB broken, 1905824 kB fixed, confirmed by hand against this exact kernel/initrd). Folded into the existing test_arm_raspi4_initrd test rather than a new standalone boot, since it needs no machine state that test isn't already setting up, and the functional-test suite is already slow enough from how many separate guest boots it runs. Signed-off-by: Marcelo Manzo <marcelomanzo@gmail.com> Message-id: 20260811143539.7835-3-marcelomanzo@gmail.com Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>

Marcelo Manzo committed Aug 11, 2026 at 10:35 UTC 49aecf39008ebeb86127b5055cefa17d68370b20
1 file changed +17
tests/functional/aarch64/test_raspi4.py
+17
@@ -86,6 +86,23 @@ class Aarch64Raspi4Machine(LinuxKernelTest):
86 'BCM2835')
87 exec_command_and_wait_for_pattern(self, 'cat /proc/iomem',
88 'cprman@7e101000')
89 +
90 + # We used to get the RAM size wrong; guard against a regression
91 + # (see git history for details).
92 + mem_total_kb = None
93 + cmd_output = exec_command_and_wait_for_pattern(
94 + self, 'cat /proc/meminfo', 'MemAvailable')
95 + for line in cmd_output.decode('ascii', errors='replace').splitlines():
96 + if line.startswith('MemTotal:'):
97 + mem_total_kb = int(line.split()[1])
98 + break
99 + self.assertIsNotNone(mem_total_kb, 'MemTotal line not found')
100 + self.assertGreater(mem_total_kb, 1900000,
101 + 'guest RAM (%d kB) is far below the ~1.9 GiB '
102 + 'expected for a 2 GiB raspi4b -- the second '
103 + 'memory node above the 1 GiB peripheral hole '
104 + 'is probably not being added' % mem_total_kb)
105 +
106 exec_command_and_wait_for_pattern(self, 'halt', 'reboot: System halted')
107 # TODO: Raspberry Pi4 doesn't shut down properly with recent kernels
108 # Wait for VM to shut down gracefully