]> Git Repo - J-u-boot.git/blob - test/py/tests/test_source.py
Subtree merge tag 'v6.9-dts' of devicetree-rebasing repo [1] into dts/upstream
[J-u-boot.git] / test / py / tests / test_source.py
1 # SPDX-License-Identifier: GPL-2.0+
2 # Copyright (C) 2022 Sean Anderson <[email protected]>
3
4 import os
5 import pytest
6 import u_boot_utils as util
7
8 @pytest.mark.boardspec('sandbox')
9 @pytest.mark.buildconfigspec('cmd_echo')
10 @pytest.mark.buildconfigspec('cmd_source')
11 @pytest.mark.buildconfigspec('fit')
12 def test_source(u_boot_console):
13     # Compile our test script image
14     cons = u_boot_console
15     mkimage = os.path.join(cons.config.build_dir, 'tools/mkimage')
16     its = os.path.join(cons.config.source_dir, 'test/py/tests/source.its')
17     fit = os.path.join(cons.config.build_dir, 'source.itb')
18     util.run_and_log(cons, (mkimage, '-f', its, fit))
19     cons.run_command(f'host load hostfs - $loadaddr {fit}')
20
21     assert '2' in cons.run_command('source')
22     assert '1' in cons.run_command('source :')
23     assert '1' in cons.run_command('source :script-1')
24     assert '2' in cons.run_command('source :script-2')
25     assert 'Fail' in cons.run_command('source :not-a-script || echo Fail')
26     assert '2' in cons.run_command('source \\#')
27     assert '1' in cons.run_command('source \\#conf-1')
28     assert '2' in cons.run_command('source \\#conf-2')
29
30     cons.run_command('fdt addr $loadaddr')
31     cons.run_command('fdt rm /configurations default')
32     assert '1' in cons.run_command('source')
33     assert 'Fail' in cons.run_command('source \\# || echo Fail')
34
35     cons.run_command('fdt rm /images default')
36     assert 'Fail' in cons.run_command('source || echo Fail')
37     assert 'Fail' in cons.run_command('source \\# || echo Fail')
This page took 0.027489 seconds and 4 git commands to generate.