mirror of
				https://source.denx.de/u-boot/u-boot.git
				synced 2025-11-04 10:21:25 +01:00 
			
		
		
		
	Add xxd command to print file content as hexdump to standard out Reviewed-by: Simon Glass <sjg@chromium.org> Signed-off-by: Roger Knecht <rknecht@pm.me>
		
			
				
	
	
		
			24 lines
		
	
	
		
			666 B
		
	
	
	
		
			Python
		
	
	
	
	
	
			
		
		
	
	
			24 lines
		
	
	
		
			666 B
		
	
	
	
		
			Python
		
	
	
	
	
	
# SPDX-License-Identifier:      GPL-2.0+
 | 
						|
 | 
						|
""" Unit test for xxd command
 | 
						|
"""
 | 
						|
 | 
						|
import pytest
 | 
						|
 | 
						|
@pytest.mark.boardspec('sandbox')
 | 
						|
@pytest.mark.buildconfigspec('cmd_xxd')
 | 
						|
def test_xxd(u_boot_console, xxd_data):
 | 
						|
    """ Unit test for xxd
 | 
						|
 | 
						|
    Args:
 | 
						|
        u_boot_console -- U-Boot console
 | 
						|
        xxd_data -- Path to the disk image used for testing.
 | 
						|
    """
 | 
						|
    response = u_boot_console.run_command_list([
 | 
						|
        f'host bind 0 {xxd_data}',
 | 
						|
        'xxd host 0 hello'])
 | 
						|
 | 
						|
    assert '00000000: 68 65 6c 6c 6f 20 77 6f 72 6c 64 0a 00 01 02 03  hello world.....\r\r\n' + \
 | 
						|
           '00000010: 04 05                                            ..' \
 | 
						|
           in response
 |