Heinrich Schuchardt | 393fcf7 | 2023-07-31 22:01:21 +0200 | [diff] [blame^] | 1 | # SPDX-License-Identifier: GPL-2.0-or-later |
| 2 | |
| 3 | """Fixture for semihosting command test |
| 4 | """ |
| 5 | |
| 6 | import os |
| 7 | import pytest |
| 8 | |
| 9 | @pytest.fixture(scope='session') |
| 10 | def semihosting_data(u_boot_config): |
| 11 | """Set up a file system to be used in semihosting tests |
| 12 | |
| 13 | Args: |
| 14 | u_boot_config -- U-Boot configuration. |
| 15 | """ |
| 16 | image_path = u_boot_config.persistent_data_dir + '/semihosting.txt' |
| 17 | |
| 18 | with open(image_path, 'w', encoding = 'utf-8') as file: |
| 19 | file.write('Das U-Boot\n') |
| 20 | |
| 21 | yield image_path |
| 22 | |
| 23 | os.remove(image_path) |