2023-12-18 10:17:08 -06:00
|
|
|
"""Create the test fixtures and other data.
|
|
|
|
|
2024-01-02 15:15:55 -06:00
|
|
|
SPDX-FileCopyrightText: © 2023 Brian S. Stephan <bss@incorporeal.org>
|
2023-12-18 10:17:08 -06:00
|
|
|
SPDX-License-Identifier: MIT
|
|
|
|
"""
|
2023-06-20 20:01:22 -05:00
|
|
|
import os
|
|
|
|
|
|
|
|
import pytest
|
|
|
|
|
|
|
|
HERE = os.path.dirname(os.path.abspath(__file__))
|
|
|
|
|
|
|
|
|
2023-06-28 11:47:48 -05:00
|
|
|
@pytest.fixture
|
|
|
|
def config_binary():
|
|
|
|
"""Read in a test GP2040-CE configuration, Protobuf serialized binary form with footer."""
|
|
|
|
filename = os.path.join(HERE, 'test-files', 'test-config.bin')
|
|
|
|
with open(filename, 'rb') as file:
|
|
|
|
content = file.read()
|
|
|
|
|
|
|
|
yield content
|
|
|
|
|
|
|
|
|
2023-06-26 15:22:01 -05:00
|
|
|
@pytest.fixture
|
|
|
|
def firmware_binary():
|
|
|
|
"""Read in a test GP2040-CE firmware binary file."""
|
|
|
|
filename = os.path.join(HERE, 'test-files', 'test-firmware.bin')
|
|
|
|
with open(filename, 'rb') as file:
|
|
|
|
content = file.read()
|
|
|
|
|
|
|
|
yield content
|
|
|
|
|
|
|
|
|
2023-06-20 20:01:22 -05:00
|
|
|
@pytest.fixture
|
|
|
|
def storage_dump():
|
2023-11-06 23:55:01 -06:00
|
|
|
"""Read in a test storage dump file (101FC000-10200000) of a GP2040-CE board."""
|
2023-06-20 20:01:22 -05:00
|
|
|
filename = os.path.join(HERE, 'test-files', 'test-storage-area.bin')
|
|
|
|
with open(filename, 'rb') as file:
|
|
|
|
content = file.read()
|
|
|
|
|
|
|
|
yield content
|
2023-06-21 15:20:21 -05:00
|
|
|
|
|
|
|
|
|
|
|
@pytest.fixture
|
|
|
|
def whole_board_dump():
|
|
|
|
"""Read in a test whole board dump file of a GP2040-CE board."""
|
|
|
|
filename = os.path.join(HERE, 'test-files', 'test-whole-board.bin')
|
|
|
|
with open(filename, 'rb') as file:
|
|
|
|
content = file.read()
|
|
|
|
|
|
|
|
yield content
|