Roger Knecht | f841bb8 | 2022-09-03 13:15:04 +0000 | [diff] [blame] | 1 | # SPDX-License-Identifier: GPL-2.0+ |
| 2 | |
| 3 | """ Unit test for xxd command |
| 4 | """ |
| 5 | |
| 6 | import pytest |
| 7 | |
| 8 | @pytest.mark.boardspec('sandbox') |
| 9 | @pytest.mark.buildconfigspec('cmd_xxd') |
Simon Glass | ddba520 | 2025-02-09 09:07:14 -0700 | [diff] [blame] | 10 | def test_xxd(ubman, xxd_data): |
Roger Knecht | f841bb8 | 2022-09-03 13:15:04 +0000 | [diff] [blame] | 11 | """ Unit test for xxd |
| 12 | |
| 13 | Args: |
Simon Glass | ddba520 | 2025-02-09 09:07:14 -0700 | [diff] [blame] | 14 | ubman -- U-Boot console |
Roger Knecht | f841bb8 | 2022-09-03 13:15:04 +0000 | [diff] [blame] | 15 | xxd_data -- Path to the disk image used for testing. |
| 16 | """ |
Simon Glass | ddba520 | 2025-02-09 09:07:14 -0700 | [diff] [blame] | 17 | response = ubman.run_command_list([ |
Roger Knecht | f841bb8 | 2022-09-03 13:15:04 +0000 | [diff] [blame] | 18 | f'host bind 0 {xxd_data}', |
| 19 | 'xxd host 0 hello']) |
| 20 | |
| 21 | assert '00000000: 68 65 6c 6c 6f 20 77 6f 72 6c 64 0a 00 01 02 03 hello world.....\r\r\n' + \ |
| 22 | '00000010: 04 05 ..' \ |
| 23 | in response |