test: hook up test of allowing control DTB to act as FIT image

Add a test demonstrating how one can embed various scripts in the
control DTB.

Verify that the source command can be used with ${fdtcontroladdr} by
itself (invoking the default script), and with :<node-name>
suffix. Check that the scripts themselves can invoke "sibling"
scripts. Also verify that without CONTROL_DTB_AS_FIT set, the control
DTB is not accepted by the source command.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Rasmus Villemoes <rv@rasmusvillemoes.dk>
This commit is contained in:
Rasmus Villemoes
2026-06-11 07:56:45 -06:00
committed by Tom Rini
parent a6369b8bb2
commit c8a636af67
6 changed files with 67 additions and 0 deletions
+31
View File
@@ -34,3 +34,34 @@ def test_source(ubman):
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')
@pytest.mark.boardspec('sandbox')
@pytest.mark.buildconfigspec('cmd_echo')
@pytest.mark.buildconfigspec('cmd_source')
@pytest.mark.buildconfigspec('fit')
@pytest.mark.buildconfigspec('control_dtb_as_fit')
def test_source_control_dtb(ubman):
output = ubman.run_command('source ${fdtcontroladdr}')
assert '* default script' in output
output = ubman.run_command('source ${fdtcontroladdr}:boot')
assert '* default script' in output
output = ubman.run_command('source ${fdtcontroladdr}:outer')
assert '* outer 1' in output
assert '* inner' in output
assert '* outer 2' in output
output = ubman.run_command('source ${fdtcontroladdr}:inner')
assert '* outer' not in output
assert '* inner' in output
assert 'Fail' in ubman.run_command('source ${fdtcontroladdr}:no-such-script || echo Fail')
@pytest.mark.buildconfigspec('cmd_echo')
@pytest.mark.buildconfigspec('cmd_source')
@pytest.mark.buildconfigspec('fit')
@pytest.mark.notbuildconfigspec('control_dtb_as_fit')
def test_source_reject_control_dtb(ubman):
assert 'Fail' in ubman.run_command('source ${fdtcontroladdr} || echo Fail')
assert 'Fail' in ubman.run_command('source ${fdtcontroladdr}:boot || echo Fail')