summaryrefslogtreecommitdiff
path: root/test/py/tests/test_suite.py
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2025-02-07 11:30:59 -0700
committerTom Rini <trini@konsulko.com>2025-02-11 20:12:36 -0600
commit540bf7881a1a1c79c4d256b68396ae699e3a3157 (patch)
tree18e2f1f00fc092846ea9f6daa783a7c1afb48fe5 /test/py/tests/test_suite.py
parentd45fc8b2cd44a8836a76b462cc7af3e40a2e4227 (diff)
test: Do flag-processing in the correct place
At present the 'ut' command handles its flags in a strange way, in that they must come after the subcommand. So, we must use 'ut bloblist -r2' to run the bloblist tests twice. This is an artefact of the way tests were run, through subcommands. It is now possible to correct this, by doing flag-processing before running the suite. Update the code to handle this, so that 'ut -r2 bloblist' works. Update the 'test_suite' test to check the new arguments. Add a sanity-check for -I while we are here. Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'test/py/tests/test_suite.py')
-rw-r--r--test/py/tests/test_suite.py20
1 files changed, 17 insertions, 3 deletions
diff --git a/test/py/tests/test_suite.py b/test/py/tests/test_suite.py
index d0025a7ba30..9ddc883394b 100644
--- a/test/py/tests/test_suite.py
+++ b/test/py/tests/test_suite.py
@@ -135,7 +135,7 @@ def xtest_suite(u_boot_console, u_boot_config):
- The number of suites matches that reported by the 'ut info'
- Where available, the number of tests is each suite matches that
- reported by 'ut info -s'
+ reported by 'ut -s info'
- The total number of tests adds up to the total that are actually run
with 'ut all'
- All suites are run with 'ut all'
@@ -167,7 +167,7 @@ def xtest_suite(u_boot_console, u_boot_config):
# Run 'ut info' and compare with the log results
with cons.log.section('Check suite test-counts'):
- output = cons.run_command('ut info -s')
+ output = cons.run_command('ut -s info')
suite_count, total_test_count, test_count = process_ut_info(cons,
output)
@@ -191,4 +191,18 @@ def xtest_suite(u_boot_console, u_boot_config):
# Run three suites
with cons.log.section('Check multiple suites'):
output = cons.run_command('ut bloblist,setexpr,mem')
- assert 'Suites run: 3' in output
+ assert 'Suites run: 3' in output
+
+ # Run a particular test
+ with cons.log.section('Check single test'):
+ output = cons.run_command('ut bloblist reloc')
+ assert 'Test: reloc: bloblist.c' in output
+
+ # Run tests multiple times
+ with cons.log.section('Check multiple runs'):
+ output = cons.run_command('ut -r2 bloblist')
+ lines = output.splitlines()
+ run = len([line for line in lines if 'Test:' in line])
+ count = re.search(r'Tests run: (\d*)', lines[-1]).group(1)
+
+ assert run == 2 * int(count)