From 752c3769874596d012cd8325099d2ae20123f989 Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Sun, 9 Feb 2025 09:07:14 -0700 Subject: test/py: Shorten u_boot_console This fixture name is quite long and results in lots of verbose code. We know this is U-Boot so the 'u_boot_' part is not necessary. But it is also a bit of a misnomer, since it provides access to all the information available to tests. It is not just the console. It would be too confusing to use con as it would be confused with config and it is probably too short. So shorten it to 'ubman'. Signed-off-by: Simon Glass Link: https://lore.kernel.org/u-boot/CAFLszTgPa4aT_J9h9pqeTtLCVn4x2JvLWRcWRD8NaN3uoSAtyA@mail.gmail.com/ --- test/py/tests/test_source.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'test/py/tests/test_source.py') diff --git a/test/py/tests/test_source.py b/test/py/tests/test_source.py index bbc311df6d1..30160d06dc6 100644 --- a/test/py/tests/test_source.py +++ b/test/py/tests/test_source.py @@ -9,9 +9,9 @@ import u_boot_utils as util @pytest.mark.buildconfigspec('cmd_echo') @pytest.mark.buildconfigspec('cmd_source') @pytest.mark.buildconfigspec('fit') -def test_source(u_boot_console): +def test_source(ubman): # Compile our test script image - cons = u_boot_console + cons = ubman mkimage = os.path.join(cons.config.build_dir, 'tools/mkimage') its = os.path.join(cons.config.source_dir, 'test/py/tests/source.its') fit = os.path.join(cons.config.build_dir, 'source.itb') -- cgit v1.2.3 From d9ed4b75add4b4ccc37cf32b54cd9c77f48e3396 Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Sun, 9 Feb 2025 09:07:15 -0700 Subject: test/py: Drop u_boot_ prefix on test files We know this is U-Boot so the prefix serves no purpose other than to make things longer and harder to read. Drop it and rename the files. Signed-off-by: Simon Glass Reviewed-by: Mattijs Korpershoek # test_android / test_dfu --- test/py/tests/test_source.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'test/py/tests/test_source.py') diff --git a/test/py/tests/test_source.py b/test/py/tests/test_source.py index 30160d06dc6..60013e438ba 100644 --- a/test/py/tests/test_source.py +++ b/test/py/tests/test_source.py @@ -3,7 +3,7 @@ import os import pytest -import u_boot_utils as util +import utils as util @pytest.mark.boardspec('sandbox') @pytest.mark.buildconfigspec('cmd_echo') -- cgit v1.2.3 From dd693ecb60384049dd8c3f6a36331c1a70b6558f Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Sun, 9 Feb 2025 09:07:16 -0700 Subject: test/py: Drop importing utils as util Now that we have a shorter name, we don't need this sort of thing. Drop it. Signed-off-by: Simon Glass Reviewed-by: Mattijs Korpershoek # test_android --- test/py/tests/test_source.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'test/py/tests/test_source.py') diff --git a/test/py/tests/test_source.py b/test/py/tests/test_source.py index 60013e438ba..f0437aa15ca 100644 --- a/test/py/tests/test_source.py +++ b/test/py/tests/test_source.py @@ -3,7 +3,7 @@ import os import pytest -import utils as util +import utils @pytest.mark.boardspec('sandbox') @pytest.mark.buildconfigspec('cmd_echo') @@ -15,7 +15,7 @@ def test_source(ubman): mkimage = os.path.join(cons.config.build_dir, 'tools/mkimage') its = os.path.join(cons.config.source_dir, 'test/py/tests/source.its') fit = os.path.join(cons.config.build_dir, 'source.itb') - util.run_and_log(cons, (mkimage, '-f', its, fit)) + utils.run_and_log(cons, (mkimage, '-f', its, fit)) cons.run_command(f'host load hostfs - $loadaddr {fit}') assert '2' in cons.run_command('source') -- cgit v1.2.3 From d08653d3699c1aafada3418c9f74b887bfb21a65 Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Sun, 9 Feb 2025 09:07:17 -0700 Subject: test/py: Drop assigning ubman to cons Now that we have a shorter name, we don't need this sort of thing. Just use ubman instead. Signed-off-by: Simon Glass --- test/py/tests/test_source.py | 41 ++++++++++++++++++++--------------------- 1 file changed, 20 insertions(+), 21 deletions(-) (limited to 'test/py/tests/test_source.py') diff --git a/test/py/tests/test_source.py b/test/py/tests/test_source.py index f0437aa15ca..970d8c79869 100644 --- a/test/py/tests/test_source.py +++ b/test/py/tests/test_source.py @@ -11,27 +11,26 @@ import utils @pytest.mark.buildconfigspec('fit') def test_source(ubman): # Compile our test script image - cons = ubman - mkimage = os.path.join(cons.config.build_dir, 'tools/mkimage') - its = os.path.join(cons.config.source_dir, 'test/py/tests/source.its') - fit = os.path.join(cons.config.build_dir, 'source.itb') - utils.run_and_log(cons, (mkimage, '-f', its, fit)) - cons.run_command(f'host load hostfs - $loadaddr {fit}') + mkimage = os.path.join(ubman.config.build_dir, 'tools/mkimage') + its = os.path.join(ubman.config.source_dir, 'test/py/tests/source.its') + fit = os.path.join(ubman.config.build_dir, 'source.itb') + utils.run_and_log(ubman, (mkimage, '-f', its, fit)) + ubman.run_command(f'host load hostfs - $loadaddr {fit}') - assert '2' in cons.run_command('source') - assert '1' in cons.run_command('source :') - assert '1' in cons.run_command('source :script-1') - assert '2' in cons.run_command('source :script-2') - assert 'Fail' in cons.run_command('source :not-a-script || echo Fail') - assert '2' in cons.run_command('source \\#') - assert '1' in cons.run_command('source \\#conf-1') - assert '2' in cons.run_command('source \\#conf-2') + assert '2' in ubman.run_command('source') + assert '1' in ubman.run_command('source :') + assert '1' in ubman.run_command('source :script-1') + assert '2' in ubman.run_command('source :script-2') + assert 'Fail' in ubman.run_command('source :not-a-script || echo Fail') + assert '2' in ubman.run_command('source \\#') + assert '1' in ubman.run_command('source \\#conf-1') + assert '2' in ubman.run_command('source \\#conf-2') - cons.run_command('fdt addr $loadaddr') - cons.run_command('fdt rm /configurations default') - assert '1' in cons.run_command('source') - assert 'Fail' in cons.run_command('source \\# || echo Fail') + ubman.run_command('fdt addr $loadaddr') + ubman.run_command('fdt rm /configurations default') + assert '1' in ubman.run_command('source') + assert 'Fail' in ubman.run_command('source \\# || echo Fail') - cons.run_command('fdt rm /images default') - assert 'Fail' in cons.run_command('source || echo Fail') - assert 'Fail' in cons.run_command('source \\# || echo Fail') + ubman.run_command('fdt rm /images default') + assert 'Fail' in ubman.run_command('source || echo Fail') + assert 'Fail' in ubman.run_command('source \\# || echo Fail') -- cgit v1.2.3