pytest-embedded-qemu

class pytest_embedded_qemu.app.IdfFlashImageMaker(app: ~pytest_embedded_qemu.app.QemuApp, image_path: str, *, qemu_version: ~packaging.version.Version = <Version('8.0.0')>)

Bases: object

Create a single image for QEMU based on the IdfApp’s partition table and all the flash files.

RISCV_FLASH_BIN_SIZES: ClassVar[List[Tuple[int, str]]] = [(262144, '256KB'), (524288, '512KB'), (1048576, '1MB'), (2097152, '2MB'), (4194304, '4MB'), (8388608, '8MB'), (16777216, '16MB'), (33554432, '32MB'), (67108864, '64MB'), (134217728, '128MB')]
XTENSA_FLASH_BIN_SIZES: ClassVar[List[Tuple[int, str]]] = [(2097152, '2MB'), (4194304, '4MB'), (8388608, '8MB'), (16777216, '16MB')]
make_bin() None

Create a single image file for qemu.

property qemu_flash_size: str

Get QEMU flash size.

If flash_size is set to keep or detect, the size will be automatically detected. Otherwise, the size will be taken from flash_size settings.

Returns:

QEMU flash size

Warning

QEMU < 8.0.0 only support 4MB flash image size for xtensa.

class pytest_embedded_qemu.app.QemuApp(msg_queue: MessageQueue, qemu_image_path: Optional[str] = None, skip_regenerate_image: Optional[bool] = False, encrypt: Optional[bool] = False, keyfile: Optional[str] = None, **kwargs)

Bases: IdfApp

QEMU App class

image_path

QEMU flash-able bin path

Type:

str

QEMU_PROG_FMT = 'qemu-system-{}'
QEMU_VERSION_REGEX = re.compile('QEMU emulator version (\\d+\\.\\d+\\.\\d+)')
create_image() None

Create the image, if it doesn’t exist.

property qemu_prog_path: str
property qemu_version: Version

Get QEMU version

Returns:

QEMU version

class pytest_embedded_qemu.dut.QemuDut(*args, **kwargs)

Bases: Dut

QEMU dut class

hard_reset()
write(s: AnyStr) None

Write to the MessageQueue instance

class pytest_embedded_qemu.qemu.Qemu(qemu_image_path: Optional[str] = None, qemu_prog_path: Optional[str] = None, qemu_cli_args: Optional[str] = None, qemu_extra_args: Optional[str] = None, app: Optional[QemuApp] = None, **kwargs)

Bases: DuplicateStdoutPopen

QEMU class

QEMU_DEFAULT_ARGS = '-nographic -machine esp32'
QEMU_DEFAULT_FMT = '-nographic -machine {}'
QEMU_DEFAULT_QMP_FMT = '-qmp tcp:127.0.0.1:{},server,wait=off'
QEMU_PROG_PATH = 'qemu-system-xtensa'
QEMU_SERIAL_TCP_FMT = '-serial tcp::{},server,nowait'
QEMU_STRAP_MODE_FMT = '-global driver=esp32.gpio,property=strap_mode,value={}'
SOURCE = 'QEMU'
property qemu_default_args
property qemu_prog_name
qmp_execute_cmd(execute, arguments=None)
take_screenshot(image_path)