test/py: spi: Rephrase the warning/error messages

Rephrasing the error and warning messages to be more meaningful and
clear.

Signed-off-by: Love Kumar <love.kumar@amd.com>
This commit is contained in:
Love Kumar 2024-11-15 18:38:00 +05:30 committed by Tom Rini
parent c04999d999
commit 92e1c2bf9e

View file

@ -75,7 +75,7 @@ def get_params_spi(u_boot_console):
''' Get SPI device test parameters from boardenv file ''' ''' Get SPI device test parameters from boardenv file '''
f = u_boot_console.config.env.get('env__spi_device_test', None) f = u_boot_console.config.env.get('env__spi_device_test', None)
if not f: if not f:
pytest.skip('No env file to read for SPI family device test') pytest.skip('No SPI test device configured')
bus = f.get('bus', 0) bus = f.get('bus', 0)
cs = f.get('chip_select', 0) cs = f.get('chip_select', 0)
@ -84,7 +84,7 @@ def get_params_spi(u_boot_console):
timeout = f.get('timeout', None) timeout = f.get('timeout', None)
if not part_name: if not part_name:
pytest.skip('No env file to read SPI family flash part name') pytest.skip('No SPI test device configured')
return bus, cs, mode, part_name, timeout return bus, cs, mode, part_name, timeout
@ -92,7 +92,7 @@ def spi_find_freq_range(u_boot_console):
'''Find out minimum and maximum frequnecies that SPI device can operate''' '''Find out minimum and maximum frequnecies that SPI device can operate'''
f = u_boot_console.config.env.get('env__spi_device_test', None) f = u_boot_console.config.env.get('env__spi_device_test', None)
if not f: if not f:
pytest.skip('No env file to read for SPI family device test') pytest.skip('No SPI test device configured')
min_f = f.get('min_freq', None) min_f = f.get('min_freq', None)
max_f = f.get('max_freq', None) max_f = f.get('max_freq', None)
@ -116,21 +116,21 @@ def spi_pre_commands(u_boot_console, freq):
pytest.fail('No SPI device available') pytest.fail('No SPI device available')
if not part_name in output: if not part_name in output:
pytest.fail('SPI flash part name not recognized') pytest.fail('Not recognized the SPI flash part name')
m = re.search('page size (.+?) Bytes', output) m = re.search('page size (.+?) Bytes', output)
if m: if m:
try: try:
page_size = int(m.group(1)) page_size = int(m.group(1))
except ValueError: except ValueError:
pytest.fail('SPI page size not recognized') pytest.fail('Not recognized the SPI page size')
m = re.search('erase size (.+?) KiB', output) m = re.search('erase size (.+?) KiB', output)
if m: if m:
try: try:
erase_size = int(m.group(1)) erase_size = int(m.group(1))
except ValueError: except ValueError:
pytest.fail('SPI erase size not recognized') pytest.fail('Not recognized the SPI erase size')
erase_size *= 1024 erase_size *= 1024
@ -139,7 +139,7 @@ def spi_pre_commands(u_boot_console, freq):
try: try:
total_size = int(m.group(1)) total_size = int(m.group(1))
except ValueError: except ValueError:
pytest.fail('SPI total size not recognized') pytest.fail('Not recognized the SPI total size')
total_size *= 1024 * 1024 total_size *= 1024 * 1024
@ -149,7 +149,7 @@ def spi_pre_commands(u_boot_console, freq):
flash_part = m.group(1) flash_part = m.group(1)
assert flash_part == part_name assert flash_part == part_name
except ValueError: except ValueError:
pytest.fail('SPI flash part not recognized') pytest.fail('Not recognized the SPI flash part')
global SPI_DATA global SPI_DATA
SPI_DATA = { SPI_DATA = {
@ -574,7 +574,7 @@ def test_spi_lock_unlock(u_boot_console):
min_f, max_f, loop = spi_find_freq_range(u_boot_console) min_f, max_f, loop = spi_find_freq_range(u_boot_console)
flashes = u_boot_console.config.env.get('env__spi_lock_unlock', False) flashes = u_boot_console.config.env.get('env__spi_lock_unlock', False)
if not flashes: if not flashes:
pytest.skip('No supported flash list for lock/unlock provided') pytest.skip('No SPI test device configured for lock/unlock')
i = 0 i = 0
while i < loop: while i < loop: