Heinrich Schuchardt | 393fcf7 | 2023-07-31 22:01:21 +0200 | [diff] [blame] | 1 | # SPDX-License-Identifier: GPL-2.0+ |
| 2 | |
| 3 | """ Unit test for semihosting |
| 4 | """ |
| 5 | |
| 6 | import pytest |
| 7 | |
| 8 | @pytest.mark.buildconfigspec('semihosting') |
Simon Glass | ddba520 | 2025-02-09 09:07:14 -0700 | [diff] [blame] | 9 | def test_semihosting_hostfs(ubman, semihosting_data): |
Heinrich Schuchardt | 393fcf7 | 2023-07-31 22:01:21 +0200 | [diff] [blame] | 10 | """ Unit test for semihosting |
| 11 | |
| 12 | Args: |
Simon Glass | ddba520 | 2025-02-09 09:07:14 -0700 | [diff] [blame] | 13 | ubman -- U-Boot console |
Heinrich Schuchardt | 393fcf7 | 2023-07-31 22:01:21 +0200 | [diff] [blame] | 14 | semihosting_data -- Path to the disk image used for testing. |
| 15 | """ |
Simon Glass | ddba520 | 2025-02-09 09:07:14 -0700 | [diff] [blame] | 16 | response = ubman.run_command( |
Heinrich Schuchardt | 393fcf7 | 2023-07-31 22:01:21 +0200 | [diff] [blame] | 17 | f'load hostfs - $loadaddr {semihosting_data}') |
| 18 | assert '11 bytes read' in response |
| 19 | |
Simon Glass | ddba520 | 2025-02-09 09:07:14 -0700 | [diff] [blame] | 20 | response = ubman.run_command( |
Heinrich Schuchardt | 393fcf7 | 2023-07-31 22:01:21 +0200 | [diff] [blame] | 21 | 'crc32 $loadaddr $filesize') |
| 22 | assert '==> 60cfccfc' in response |
| 23 | |
Simon Glass | ddba520 | 2025-02-09 09:07:14 -0700 | [diff] [blame] | 24 | ubman.run_command( |
Heinrich Schuchardt | 393fcf7 | 2023-07-31 22:01:21 +0200 | [diff] [blame] | 25 | f'save hostfs - $loadaddr {semihosting_data} 11 11') |
| 26 | |
Simon Glass | ddba520 | 2025-02-09 09:07:14 -0700 | [diff] [blame] | 27 | response = ubman.run_command( |
Heinrich Schuchardt | 393fcf7 | 2023-07-31 22:01:21 +0200 | [diff] [blame] | 28 | f'load hostfs - $loadaddr {semihosting_data} 4 13') |
| 29 | assert '4 bytes read' in response |
| 30 | |
Simon Glass | ddba520 | 2025-02-09 09:07:14 -0700 | [diff] [blame] | 31 | response = ubman.run_command( |
Heinrich Schuchardt | 393fcf7 | 2023-07-31 22:01:21 +0200 | [diff] [blame] | 32 | 'crc32 $loadaddr $filesize') |
| 33 | assert '==> e29063ea' in response |