diff options
author | Heinrich Schuchardt <heinrich.schuchardt@canonical.com> | 2023-07-31 22:01:21 +0200 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2023-08-14 17:55:53 -0400 |
commit | f7ee9f3d362a05cc3f7e04d0ceb373c2aea80de6 (patch) | |
tree | 2dc33f99bfaeb1eb7017847cd3f88c6c3a227a4f /test/py/tests/test_semihosting/conftest.py | |
parent | cf159fe0b659b9cc594915ec1415d0e72dbda38a (diff) |
test: unit test for semihosting
Provide a unit test for semihosting testing reading and writing a file.
Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Sean Anderson <sean.anderson@seco.com>
Diffstat (limited to 'test/py/tests/test_semihosting/conftest.py')
-rw-r--r-- | test/py/tests/test_semihosting/conftest.py | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/test/py/tests/test_semihosting/conftest.py b/test/py/tests/test_semihosting/conftest.py new file mode 100644 index 0000000000..b00d8f4ea9 --- /dev/null +++ b/test/py/tests/test_semihosting/conftest.py @@ -0,0 +1,23 @@ +# SPDX-License-Identifier: GPL-2.0-or-later + +"""Fixture for semihosting command test +""" + +import os +import pytest + +@pytest.fixture(scope='session') +def semihosting_data(u_boot_config): + """Set up a file system to be used in semihosting tests + + Args: + u_boot_config -- U-Boot configuration. + """ + image_path = u_boot_config.persistent_data_dir + '/semihosting.txt' + + with open(image_path, 'w', encoding = 'utf-8') as file: + file.write('Das U-Boot\n') + + yield image_path + + os.remove(image_path) |