master
py 62 lines 2.35 KB
Raw
1 #!/usr/bin/env python3
2 #
3 # Functional test that boots the ASPEED machines
4 #
5 # SPDX-License-Identifier: GPL-2.0-or-later
6
7 from qemu_test import Asset
8 from aspeed import AspeedTest
9
10 from qemu_test import wait_for_console_pattern, exec_command
11 from qemu_test import exec_command_and_wait_for_pattern
12
13 class AST2600Machine(AspeedTest):
14
15 ASSET_SDK_V1103_AST2600 = Asset(
16 'https://github.com/AspeedTech-BMC/openbmc/releases/download/v11.03/ast2600-default-image.tar.gz',
17 '47e3656a14bf7a4de28d3dfbf48bc2325443bc42d270f3bc82646f92f6dea165')
18
19 def test_arm_ast2600_otp_blockdev_device(self):
20 self.vm.set_machine("ast2600-evb")
21 self.require_netdev('user')
22
23 image_path = self.archive_extract(self.ASSET_SDK_V1103_AST2600)
24 otp_img = self.generate_otpmem_image()
25
26 self.vm.set_console()
27 self.vm.add_args(
28 "-blockdev", f"driver=file,filename={otp_img},node-name=otp",
29 "-global", "aspeed-otp.drive=otp",
30 )
31 self.vm.add_args('-drive', 'file=' +
32 self.scratch_file("ast2600-default-image", "image-bmc") +
33 ',if=mtd,format=raw',
34 '-net', 'nic', '-net', 'user', '-snapshot')
35 self.vm.launch()
36
37 # Set OTP value via uboot command
38 wait_for_console_pattern(self, 'Hit any key to stop autoboot:')
39 exec_command_and_wait_for_pattern(self, '\012', 'ast#')
40 exec_command_and_wait_for_pattern(self,
41 'otp pb strap o 0x30 1', 'ast#')
42 # Validate OTP value in uboot stage
43 exec_command_and_wait_for_pattern(self,
44 'otp read strap 0x30', '0x30 1')
45 exec_command_and_wait_for_pattern(self, 'boot',
46 "ast2600-default login:")
47 exec_command_and_wait_for_pattern(self, 'root', 'Password:')
48 exec_command_and_wait_for_pattern(self, '0penBmc',
49 'root@ast2600-default:~#')
50 # Validate OTP value in BMC stage
51 exec_command_and_wait_for_pattern(self,
52 'otp read strap 0x30', '0x30 1')
53 exec_command_and_wait_for_pattern(self,
54 'reboot', 'Hit any key to stop autoboot')
55 exec_command_and_wait_for_pattern(self, '\012', 'ast#')
56 # Validate OTP value in uboot stage
57 exec_command_and_wait_for_pattern(self,
58 'otp read strap 0x30', '0x30 1')
59
60
61 if __name__ == '__main__':
62 AspeedTest.main()