Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: qemu toolchain path #312

Merged
merged 2 commits into from
Oct 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion pytest-embedded-idf/pytest_embedded_idf/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,15 @@ class IdfApp(App):
"""

XTENSA_TARGETS: ClassVar[List[str]] = ['esp32', 'esp32s2', 'esp32s3']
RISCV32_TARGETS: ClassVar[List[str]] = ['esp32c3', 'esp32h2', 'esp32c2', 'esp32c6']
RISCV32_TARGETS: ClassVar[List[str]] = [
'esp32c3',
'esp32c2',
'esp32c6',
'esp32c5',
'esp32p4',
'esp32h2',
'esp32c61',
]

FLASH_ARGS_FILENAME = 'flash_args'
FLASH_PROJECT_ARGS_FILENAME = 'flash_project_args'
Expand Down
6 changes: 5 additions & 1 deletion pytest-embedded-qemu/pytest_embedded_qemu/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,7 @@ class QemuApp(IdfApp):
"""

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

# the qemu version shouldn't change in the same session
_QEMU_VERSION = None
Expand All @@ -162,9 +163,12 @@ def __init__(
if self.encrypt:
self.encrypted_image_path = os.path.join(self.binary_path, ENCRYPTED_IMAGE_FN)

self.qemu_prog_path = kwargs.get('qemu_prog_path', 'qemu-system-xtensa')
self.create_image()

@property
def qemu_prog_path(self) -> str:
return self.QEMU_PROG_FMT.format('xtensa' if self.is_xtensa else 'riscv32')

@property
def qemu_version(self) -> Version:
"""
Expand Down
8 changes: 3 additions & 5 deletions pytest-embedded-qemu/pytest_embedded_qemu/qemu.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import asyncio
import logging
import os
import shlex
import socket
Expand All @@ -21,7 +22,6 @@ class Qemu(DuplicateStdoutPopen):
SOURCE = 'QEMU'

QEMU_PROG_PATH = 'qemu-system-xtensa'
QEMU_PROG_FMT = 'qemu-system-{}'

QEMU_DEFAULT_ARGS = '-nographic -machine esp32'
QEMU_DEFAULT_FMT = '-nographic -machine {}'
Expand Down Expand Up @@ -90,11 +90,9 @@ def __init__(
@property
def qemu_prog_name(self):
if self.app:
try:
return self.QEMU_PROG_FMT.format('xtensa' if self.app.is_xtensa else 'riscv32')
except AttributeError:
pass
return self.app.qemu_prog_path

logging.warning('App not set, use default qemu program name "%s"', self.QEMU_DEFAULT_PROG_PATH)
return self.QEMU_PROG_PATH

@property
Expand Down
Loading