]> git.ipfire.org Git - thirdparty/u-boot.git/commitdiff
test: Let pytest indicate skipped C unit tests
authorHeinrich Schuchardt <xypron.glpk@gmx.de>
Sun, 23 Nov 2025 22:56:53 +0000 (23:56 +0100)
committerTom Rini <trini@konsulko.com>
Fri, 5 Dec 2025 14:54:44 +0000 (08:54 -0600)
We invoke the ut command in test_ut.py. Currently we only check for
failures. Instead we should also indicate if sub-tests were skipped.

With this change we will get output like the following for skipped tests:

test/py/tests/test_ut.py ..sssss......ss..............s.sssss.s.s...
================================ short test summary info ================================
SKIPPED [1] test/py/tests/test_ut.py:597: Test addrmap addrmap_test_basic has 1 skipped sub-test(s).
SKIPPED [1] test/py/tests/test_ut.py:597: Test bdinfo bdinfo_test_eth has 4 skipped sub-test(s).

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
test/py/tests/test_ut.py

index cdf54adc6008c21d67eec466c3245c75208a2ec9..6d535b5206dda9655a3c08e7353fcecf3def0a99 100644 (file)
@@ -11,6 +11,7 @@ import collections
 import gzip
 import os
 import os.path
+import re
 import pytest
 
 import utils
@@ -589,3 +590,9 @@ def test_ut(ubman, ut_subtest):
     else:
         output = ubman.run_command('ut ' + ut_subtest)
     assert output.endswith('failures: 0')
+    lastline = output.splitlines()[-1]
+    if "skipped: 0," not in lastline:
+        match = re.search(r'skipped:\s*(\d+),', lastline)
+        if match:
+            count = match.group(1)
+            pytest.skip(f'Test {ut_subtest} has {count} skipped sub-test(s).')