pytest-embedded-espemu 2.9.2__tar.gz → 2.10.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- pytest_embedded_espemu-2.10.0/PKG-INFO +67 -0
- pytest_embedded_espemu-2.10.0/README.md +36 -0
- {pytest_embedded_espemu-2.9.2 → pytest_embedded_espemu-2.10.0}/pyproject.toml +2 -2
- {pytest_embedded_espemu-2.9.2 → pytest_embedded_espemu-2.10.0}/pytest_embedded_espemu/__init__.py +5 -1
- {pytest_embedded_espemu-2.9.2 → pytest_embedded_espemu-2.10.0}/pytest_embedded_espemu/app.py +38 -1
- {pytest_embedded_espemu-2.9.2 → pytest_embedded_espemu-2.10.0}/pytest_embedded_espemu/dut.py +8 -0
- pytest_embedded_espemu-2.10.0/pytest_embedded_espemu/espemu.py +277 -0
- pytest_embedded_espemu-2.10.0/pytest_embedded_espemu/serial.py +82 -0
- {pytest_embedded_espemu-2.9.2 → pytest_embedded_espemu-2.10.0}/tests/test_espemu.py +30 -0
- pytest_embedded_espemu-2.10.0/tests/test_serial_fixture_check.py +34 -0
- pytest_embedded_espemu-2.9.2/PKG-INFO +0 -50
- pytest_embedded_espemu-2.9.2/README.md +0 -19
- pytest_embedded_espemu-2.9.2/pytest_embedded_espemu/espemu.py +0 -76
- {pytest_embedded_espemu-2.9.2 → pytest_embedded_espemu-2.10.0}/LICENSE +0 -0
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: pytest-embedded-espemu
|
|
3
|
+
Version: 2.10.0
|
|
4
|
+
Summary: Make pytest-embedded plugin work with esp-emu.
|
|
5
|
+
Author: Espressif Systems
|
|
6
|
+
Requires-Python: >=3.10
|
|
7
|
+
Description-Content-Type: text/markdown
|
|
8
|
+
Classifier: Development Status :: 4 - Beta
|
|
9
|
+
Classifier: Framework :: Pytest
|
|
10
|
+
Classifier: Intended Audience :: Developers
|
|
11
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
12
|
+
Classifier: Operating System :: OS Independent
|
|
13
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
14
|
+
Classifier: Programming Language :: Python :: 3
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
20
|
+
Classifier: Programming Language :: Python
|
|
21
|
+
Classifier: Topic :: Software Development :: Testing
|
|
22
|
+
License-File: LICENSE
|
|
23
|
+
Requires-Dist: pytest-embedded~=2.10.0
|
|
24
|
+
Requires-Dist: pytest-embedded-idf~=2.10.0 ; extra == "idf"
|
|
25
|
+
Project-URL: changelog, https://github.com/espressif/pytest-embedded/blob/main/CHANGELOG.md
|
|
26
|
+
Project-URL: documentation, https://docs.espressif.com/projects/pytest-embedded/en/latest/
|
|
27
|
+
Project-URL: homepage, https://github.com/espressif/pytest-embedded
|
|
28
|
+
Project-URL: repository, https://github.com/espressif/pytest-embedded
|
|
29
|
+
Provides-Extra: idf
|
|
30
|
+
|
|
31
|
+
### pytest-embedded-espemu
|
|
32
|
+
|
|
33
|
+
A `pytest-embedded` service for running tests on [esp-emu](https://github.com/espressif/esp-emulator), Espressif's lightweight emulator for ESP RISC-V series SoCs, without real hardware.
|
|
34
|
+
|
|
35
|
+
Supported targets: `esp32c3`, `esp32c5`, `esp32c6`, `esp32h2`, `esp32p4`, `esp32s31`.
|
|
36
|
+
|
|
37
|
+
#### Service Activation
|
|
38
|
+
|
|
39
|
+
Activate this service by passing `espemu` to `--embedded-services`. Typically combined with `idf`:
|
|
40
|
+
|
|
41
|
+
```shell
|
|
42
|
+
pytest --embedded-services idf,espemu --target esp32c3 --app-path /path/to/app
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
#### Extra Functionalities
|
|
46
|
+
|
|
47
|
+
- **Automatic Merged Binary**: Automatically generates a merged flash binary from the build artifacts using `esptool merge-bin`.
|
|
48
|
+
- **Unity Test Support**: Fully supports Unity test menus and automated test cases from `pytest-embedded-idf`.
|
|
49
|
+
- **Fast Execution**: Lightweight software emulation running UART0 directly on standard I/O.
|
|
50
|
+
|
|
51
|
+
#### CLI Options
|
|
52
|
+
|
|
53
|
+
- `--espemu-image-path`: Path to an existing merged flash binary instead of generating one. Default: `<app_path>/<build_dir>/espemu_image.bin`.
|
|
54
|
+
- `--espemu-prog-path`: Path to the `esp-emu` executable. Default: `"esp-emu"`.
|
|
55
|
+
- `--espemu-cli-args`: Base arguments passed to `esp-emu`. Default: `None`.
|
|
56
|
+
- `--espemu-extra-args`: Extra arguments appended to the `esp-emu` command line (e.g. `--espemu-extra-args "--net user,restrict=yes"`). Default: `None`.
|
|
57
|
+
|
|
58
|
+
#### Quick Example
|
|
59
|
+
|
|
60
|
+
```python
|
|
61
|
+
from pytest_embedded import Dut
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
def test_espemu(dut: Dut):
|
|
65
|
+
dut.expect('Hello from esp-emu!')
|
|
66
|
+
```
|
|
67
|
+
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
### pytest-embedded-espemu
|
|
2
|
+
|
|
3
|
+
A `pytest-embedded` service for running tests on [esp-emu](https://github.com/espressif/esp-emulator), Espressif's lightweight emulator for ESP RISC-V series SoCs, without real hardware.
|
|
4
|
+
|
|
5
|
+
Supported targets: `esp32c3`, `esp32c5`, `esp32c6`, `esp32h2`, `esp32p4`, `esp32s31`.
|
|
6
|
+
|
|
7
|
+
#### Service Activation
|
|
8
|
+
|
|
9
|
+
Activate this service by passing `espemu` to `--embedded-services`. Typically combined with `idf`:
|
|
10
|
+
|
|
11
|
+
```shell
|
|
12
|
+
pytest --embedded-services idf,espemu --target esp32c3 --app-path /path/to/app
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
#### Extra Functionalities
|
|
16
|
+
|
|
17
|
+
- **Automatic Merged Binary**: Automatically generates a merged flash binary from the build artifacts using `esptool merge-bin`.
|
|
18
|
+
- **Unity Test Support**: Fully supports Unity test menus and automated test cases from `pytest-embedded-idf`.
|
|
19
|
+
- **Fast Execution**: Lightweight software emulation running UART0 directly on standard I/O.
|
|
20
|
+
|
|
21
|
+
#### CLI Options
|
|
22
|
+
|
|
23
|
+
- `--espemu-image-path`: Path to an existing merged flash binary instead of generating one. Default: `<app_path>/<build_dir>/espemu_image.bin`.
|
|
24
|
+
- `--espemu-prog-path`: Path to the `esp-emu` executable. Default: `"esp-emu"`.
|
|
25
|
+
- `--espemu-cli-args`: Base arguments passed to `esp-emu`. Default: `None`.
|
|
26
|
+
- `--espemu-extra-args`: Extra arguments appended to the `esp-emu` command line (e.g. `--espemu-extra-args "--net user,restrict=yes"`). Default: `None`.
|
|
27
|
+
|
|
28
|
+
#### Quick Example
|
|
29
|
+
|
|
30
|
+
```python
|
|
31
|
+
from pytest_embedded import Dut
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
def test_espemu(dut: Dut):
|
|
35
|
+
dut.expect('Hello from esp-emu!')
|
|
36
|
+
```
|
|
@@ -29,12 +29,12 @@ dynamic = ["version", "description"]
|
|
|
29
29
|
requires-python = ">=3.10"
|
|
30
30
|
|
|
31
31
|
dependencies = [
|
|
32
|
-
"pytest-embedded~=2.
|
|
32
|
+
"pytest-embedded~=2.10.0",
|
|
33
33
|
]
|
|
34
34
|
|
|
35
35
|
[project.optional-dependencies]
|
|
36
36
|
idf = [
|
|
37
|
-
"pytest-embedded-idf~=2.
|
|
37
|
+
"pytest-embedded-idf~=2.10.0",
|
|
38
38
|
]
|
|
39
39
|
|
|
40
40
|
[project.urls]
|
{pytest_embedded_espemu-2.9.2 → pytest_embedded_espemu-2.10.0}/pytest_embedded_espemu/__init__.py
RENAMED
|
@@ -5,15 +5,18 @@ import importlib
|
|
|
5
5
|
from pytest_embedded.utils import lazy_load
|
|
6
6
|
|
|
7
7
|
DEFAULT_IMAGE_FN = 'espemu_image.bin'
|
|
8
|
+
ENCRYPTED_IMAGE_FN = f'encrypted_{DEFAULT_IMAGE_FN}'
|
|
8
9
|
|
|
9
10
|
from .dut import EspEmuDut # noqa
|
|
10
11
|
from .espemu import EspEmu # noqa
|
|
12
|
+
from .serial import EspEmuSerial # noqa
|
|
11
13
|
|
|
12
14
|
__getattr__ = lazy_load(
|
|
13
15
|
importlib.import_module(__name__),
|
|
14
16
|
{
|
|
15
17
|
'EspEmu': EspEmu,
|
|
16
18
|
'EspEmuDut': EspEmuDut,
|
|
19
|
+
'EspEmuSerial': EspEmuSerial,
|
|
17
20
|
},
|
|
18
21
|
{
|
|
19
22
|
'EspEmuApp': '.app', # requires idf
|
|
@@ -23,9 +26,10 @@ __getattr__ = lazy_load(
|
|
|
23
26
|
|
|
24
27
|
__all__ = [
|
|
25
28
|
'DEFAULT_IMAGE_FN',
|
|
29
|
+
'ENCRYPTED_IMAGE_FN',
|
|
26
30
|
'EspEmu',
|
|
27
31
|
'EspEmuApp',
|
|
28
32
|
'EspEmuDut',
|
|
29
33
|
]
|
|
30
34
|
|
|
31
|
-
__version__ = '2.
|
|
35
|
+
__version__ = '2.10.0'
|
{pytest_embedded_espemu-2.9.2 → pytest_embedded_espemu-2.10.0}/pytest_embedded_espemu/app.py
RENAMED
|
@@ -6,7 +6,7 @@ import sys
|
|
|
6
6
|
from pytest_embedded.log import MessageQueue, live_print_call
|
|
7
7
|
from pytest_embedded_idf.app import IdfApp
|
|
8
8
|
|
|
9
|
-
from . import DEFAULT_IMAGE_FN
|
|
9
|
+
from . import DEFAULT_IMAGE_FN, ENCRYPTED_IMAGE_FN
|
|
10
10
|
|
|
11
11
|
|
|
12
12
|
class EspEmuApp(IdfApp):
|
|
@@ -22,6 +22,8 @@ class EspEmuApp(IdfApp):
|
|
|
22
22
|
msg_queue: MessageQueue,
|
|
23
23
|
espemu_image_path: str | None = None,
|
|
24
24
|
skip_regenerate_image: bool | None = False,
|
|
25
|
+
encrypt: bool | None = False,
|
|
26
|
+
keyfile: str | None = None,
|
|
25
27
|
**kwargs,
|
|
26
28
|
):
|
|
27
29
|
self._q = msg_queue
|
|
@@ -30,9 +32,39 @@ class EspEmuApp(IdfApp):
|
|
|
30
32
|
|
|
31
33
|
self.image_path = espemu_image_path or os.path.join(self.binary_path, DEFAULT_IMAGE_FN)
|
|
32
34
|
self.skip_regenerate_image = skip_regenerate_image
|
|
35
|
+
self.encrypt = encrypt
|
|
36
|
+
self.keyfile = keyfile
|
|
37
|
+
|
|
38
|
+
if self.encrypt:
|
|
39
|
+
self.encrypted_image_path = os.path.join(self.binary_path, ENCRYPTED_IMAGE_FN)
|
|
33
40
|
|
|
34
41
|
self.create_image()
|
|
35
42
|
|
|
43
|
+
def _write_encrypted_image(self, seek: int = 0) -> None:
|
|
44
|
+
"""
|
|
45
|
+
Encrypt the merged image with the flash encryption key, as the ROM would
|
|
46
|
+
have written it.
|
|
47
|
+
"""
|
|
48
|
+
with contextlib.redirect_stdout(self._q):
|
|
49
|
+
live_print_call(
|
|
50
|
+
[
|
|
51
|
+
sys.executable,
|
|
52
|
+
'-m',
|
|
53
|
+
'espsecure',
|
|
54
|
+
'encrypt-flash-data',
|
|
55
|
+
# every target the emulator supports encrypts flash with
|
|
56
|
+
# XTS-AES, not the scheme the original esp32 uses
|
|
57
|
+
'--aes-xts',
|
|
58
|
+
'--keyfile',
|
|
59
|
+
self.keyfile,
|
|
60
|
+
'--output',
|
|
61
|
+
self.encrypted_image_path,
|
|
62
|
+
'--address',
|
|
63
|
+
str(seek),
|
|
64
|
+
self.image_path,
|
|
65
|
+
],
|
|
66
|
+
)
|
|
67
|
+
|
|
36
68
|
def create_image(self) -> None:
|
|
37
69
|
"""
|
|
38
70
|
Create the image, if it doesn't exist.
|
|
@@ -65,3 +97,8 @@ class EspEmuApp(IdfApp):
|
|
|
65
97
|
],
|
|
66
98
|
cwd=self.binary_path,
|
|
67
99
|
)
|
|
100
|
+
|
|
101
|
+
if self.encrypt:
|
|
102
|
+
if self.keyfile is None or not os.path.exists(self.keyfile):
|
|
103
|
+
raise ValueError("Flash Encryption key file doesn't exist")
|
|
104
|
+
self._write_encrypted_image()
|
{pytest_embedded_espemu-2.9.2 → pytest_embedded_espemu-2.10.0}/pytest_embedded_espemu/dut.py
RENAMED
|
@@ -3,6 +3,7 @@ from typing import AnyStr
|
|
|
3
3
|
from pytest_embedded.dut import Dut
|
|
4
4
|
|
|
5
5
|
from .espemu import EspEmu
|
|
6
|
+
from .serial import EspEmuSerial
|
|
6
7
|
|
|
7
8
|
|
|
8
9
|
class EspEmuDut(Dut):
|
|
@@ -11,11 +12,13 @@ class EspEmuDut(Dut):
|
|
|
11
12
|
|
|
12
13
|
Attributes:
|
|
13
14
|
target (str): target chip type, taken from the app
|
|
15
|
+
serial (EspEmuSerial): `EspEmuSerial` instance
|
|
14
16
|
"""
|
|
15
17
|
|
|
16
18
|
def __init__(
|
|
17
19
|
self,
|
|
18
20
|
espemu: EspEmu,
|
|
21
|
+
serial: EspEmuSerial,
|
|
19
22
|
**kwargs,
|
|
20
23
|
) -> None:
|
|
21
24
|
self.espemu = espemu
|
|
@@ -27,6 +30,11 @@ class EspEmuDut(Dut):
|
|
|
27
30
|
# target is known here as well; keep it optional for other app classes.
|
|
28
31
|
self.target: str | None = getattr(self.app, 'target', None)
|
|
29
32
|
|
|
33
|
+
# `IdfSerial` is what ESP-IDF tests call for device state — a reset,
|
|
34
|
+
# an erase, an eFuse burn. Give them something that answers, so a test
|
|
35
|
+
# that needs one reports which operation it needed.
|
|
36
|
+
self.serial = serial
|
|
37
|
+
|
|
30
38
|
self._hard_reset_func = self.espemu._hard_reset
|
|
31
39
|
|
|
32
40
|
def write(self, s: AnyStr) -> None:
|
|
@@ -0,0 +1,277 @@
|
|
|
1
|
+
import functools
|
|
2
|
+
import logging
|
|
3
|
+
import os
|
|
4
|
+
import shlex
|
|
5
|
+
import socket
|
|
6
|
+
import subprocess
|
|
7
|
+
import time
|
|
8
|
+
import typing as t
|
|
9
|
+
|
|
10
|
+
from pytest_embedded.log import DuplicateStdoutPopen
|
|
11
|
+
|
|
12
|
+
if t.TYPE_CHECKING:
|
|
13
|
+
from .app import EspEmuApp
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
def send_control_command(port: int | None, command: str, timeout: float = 30) -> str:
|
|
17
|
+
"""Send one command to an esp-emu control channel and return its reply."""
|
|
18
|
+
if port is None:
|
|
19
|
+
raise NotImplementedError(
|
|
20
|
+
'this esp-emu build has no --control-tcp channel; a newer emulator is needed for device-state operations'
|
|
21
|
+
)
|
|
22
|
+
# The emulator binds the channel while it is starting, so a test whose
|
|
23
|
+
# first action is a device-state operation can arrive before it is
|
|
24
|
+
# listening. Retry until the deadline rather than fail the case.
|
|
25
|
+
deadline = time.time() + timeout
|
|
26
|
+
while True:
|
|
27
|
+
try:
|
|
28
|
+
sock = socket.create_connection(('127.0.0.1', port), timeout=timeout)
|
|
29
|
+
break
|
|
30
|
+
except ConnectionRefusedError:
|
|
31
|
+
if time.time() >= deadline:
|
|
32
|
+
raise
|
|
33
|
+
time.sleep(0.1)
|
|
34
|
+
with sock:
|
|
35
|
+
sock.sendall(f'{command}\n'.encode())
|
|
36
|
+
with sock.makefile('rb') as reader:
|
|
37
|
+
reply = reader.readline().decode().strip()
|
|
38
|
+
if reply.startswith('err:'):
|
|
39
|
+
raise RuntimeError(f'esp-emu rejected {command!r}: {reply}')
|
|
40
|
+
return reply
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
class EspEmu(DuplicateStdoutPopen):
|
|
44
|
+
"""
|
|
45
|
+
esp-emu class (https://github.com/espressif/esp-emulator)
|
|
46
|
+
|
|
47
|
+
The emulator runs with UART0 attached to stdio: its output streams
|
|
48
|
+
straight into the pexpect process and `write()` feeds the firmware's
|
|
49
|
+
UART RX via stdin. No sockets are involved.
|
|
50
|
+
"""
|
|
51
|
+
|
|
52
|
+
SOURCE = 'ESPEMU'
|
|
53
|
+
|
|
54
|
+
ESPEMU_PROG_PATH = 'esp-emu'
|
|
55
|
+
|
|
56
|
+
SUPPORTED_TARGETS: t.ClassVar[tuple] = ('esp32c3', 'esp32c5', 'esp32c6', 'esp32h2', 'esp32p4', 'esp32s31')
|
|
57
|
+
|
|
58
|
+
# esp-emu reads and writes a QEMU compatible eFuse image of this size. A
|
|
59
|
+
# blank one means "nothing burned", which is the state a test starts from
|
|
60
|
+
# unless it is given an image of its own.
|
|
61
|
+
EFUSE_IMAGE_SIZE = 336
|
|
62
|
+
|
|
63
|
+
# Boot to the ROM loader instead of the firmware, so esptool and espefuse
|
|
64
|
+
# can drive the emulator over the UART socket. There are no modem control
|
|
65
|
+
# lines on a socket, so the strap has to be set at launch.
|
|
66
|
+
DOWNLOAD_MODE_STRAP = '0x02'
|
|
67
|
+
|
|
68
|
+
def __init__(
|
|
69
|
+
self,
|
|
70
|
+
espemu_image_path: str | None = None,
|
|
71
|
+
espemu_prog_path: str | None = None,
|
|
72
|
+
espemu_cli_args: str | None = None,
|
|
73
|
+
espemu_extra_args: str | None = None,
|
|
74
|
+
espemu_efuse_path: str | None = None,
|
|
75
|
+
espemu_control_port: int | None = None,
|
|
76
|
+
app: t.Optional['EspEmuApp'] = None,
|
|
77
|
+
**kwargs,
|
|
78
|
+
):
|
|
79
|
+
"""
|
|
80
|
+
Args:
|
|
81
|
+
espemu_image_path: image path (merged flash binary)
|
|
82
|
+
espemu_prog_path: esp-emu program path
|
|
83
|
+
espemu_cli_args: esp-emu CLI arguments
|
|
84
|
+
espemu_extra_args: esp-emu CLI extra arguments, will be appended to `espemu_cli_args`
|
|
85
|
+
espemu_efuse_path: eFuse image the emulator reads at start and writes back on exit
|
|
86
|
+
espemu_control_port: port to serve the control channel on, from `pick_control_port`;
|
|
87
|
+
`None` runs without one
|
|
88
|
+
app: `EspEmuApp` instance, used to detect the target chip
|
|
89
|
+
"""
|
|
90
|
+
self.app = app
|
|
91
|
+
|
|
92
|
+
image_path = espemu_image_path
|
|
93
|
+
if not image_path and self.app:
|
|
94
|
+
image_path = self.app.image_path
|
|
95
|
+
if not image_path:
|
|
96
|
+
raise ValueError('Please specify --espemu-image-path or use the espemu service together with idf')
|
|
97
|
+
|
|
98
|
+
target = getattr(self.app, 'target', None)
|
|
99
|
+
if target not in self.SUPPORTED_TARGETS:
|
|
100
|
+
raise ValueError(
|
|
101
|
+
f'esp-emu does not support target {target!r}. Supported targets: {", ".join(self.SUPPORTED_TARGETS)}'
|
|
102
|
+
)
|
|
103
|
+
|
|
104
|
+
espemu_prog_path = espemu_prog_path or self.ESPEMU_PROG_PATH
|
|
105
|
+
|
|
106
|
+
self.espemu_prog_path = espemu_prog_path
|
|
107
|
+
self.image_path = image_path
|
|
108
|
+
self.target = target
|
|
109
|
+
self.efuse_path = espemu_efuse_path
|
|
110
|
+
|
|
111
|
+
efuse_args = []
|
|
112
|
+
if self.efuse_path:
|
|
113
|
+
self._create_efuse_image(self.efuse_path)
|
|
114
|
+
logging.debug('The eFuse image will be saved to: %s', self.efuse_path)
|
|
115
|
+
efuse_args = ['--efuse', self.efuse_path]
|
|
116
|
+
self.control_port = espemu_control_port
|
|
117
|
+
control_args = []
|
|
118
|
+
if self.control_port is not None:
|
|
119
|
+
control_args = ['--control-tcp', f'127.0.0.1:{self.control_port}']
|
|
120
|
+
|
|
121
|
+
cmd = [
|
|
122
|
+
espemu_prog_path,
|
|
123
|
+
'--chip',
|
|
124
|
+
target,
|
|
125
|
+
'--firmware',
|
|
126
|
+
image_path,
|
|
127
|
+
*efuse_args,
|
|
128
|
+
*control_args,
|
|
129
|
+
*shlex.split(espemu_cli_args or ''),
|
|
130
|
+
*shlex.split(espemu_extra_args or ''),
|
|
131
|
+
]
|
|
132
|
+
|
|
133
|
+
super().__init__(cmd=cmd, **kwargs)
|
|
134
|
+
|
|
135
|
+
@classmethod
|
|
136
|
+
def _create_efuse_image(cls, path: str) -> None:
|
|
137
|
+
"""Create a blank eFuse image, keeping one that already exists."""
|
|
138
|
+
if os.path.exists(path):
|
|
139
|
+
return
|
|
140
|
+
|
|
141
|
+
with open(path, 'wb') as f:
|
|
142
|
+
f.write(b'\x00' * cls.EFUSE_IMAGE_SIZE)
|
|
143
|
+
|
|
144
|
+
def execute_efuse_command(self, command: str) -> None:
|
|
145
|
+
"""
|
|
146
|
+
Run an espefuse command against the emulator.
|
|
147
|
+
|
|
148
|
+
A second emulator instance is started in download mode with its UART on
|
|
149
|
+
a socket, since the running one is booted into the firmware and a socket
|
|
150
|
+
carries no reset lines. The instance writes the eFuse image back on
|
|
151
|
+
exit, and the running emulator then reads it back over the control
|
|
152
|
+
channel, which resets it -- so the burn takes effect on the machine
|
|
153
|
+
under test as well as on the next start.
|
|
154
|
+
|
|
155
|
+
Args:
|
|
156
|
+
command: espefuse command line, e.g. "burn-custom-mac 00:11:22:33:44:55"
|
|
157
|
+
"""
|
|
158
|
+
import espefuse
|
|
159
|
+
|
|
160
|
+
if not self.efuse_path:
|
|
161
|
+
raise ValueError('No eFuse image set. Please use --espemu-efuse-path')
|
|
162
|
+
|
|
163
|
+
available_port = self._free_port()
|
|
164
|
+
|
|
165
|
+
child = subprocess.Popen(
|
|
166
|
+
[
|
|
167
|
+
self.espemu_prog_path,
|
|
168
|
+
'--chip',
|
|
169
|
+
self.target,
|
|
170
|
+
'--firmware',
|
|
171
|
+
self.image_path,
|
|
172
|
+
'--efuse',
|
|
173
|
+
self.efuse_path,
|
|
174
|
+
'--strap-mode',
|
|
175
|
+
self.DOWNLOAD_MODE_STRAP,
|
|
176
|
+
'--uart-tcp',
|
|
177
|
+
f'127.0.0.1:{available_port}',
|
|
178
|
+
],
|
|
179
|
+
stdout=subprocess.DEVNULL,
|
|
180
|
+
stderr=subprocess.DEVNULL,
|
|
181
|
+
)
|
|
182
|
+
try:
|
|
183
|
+
self._wait_for_port(available_port)
|
|
184
|
+
args = [arg for arg in shlex.split(command) if arg != '--do-not-confirm']
|
|
185
|
+
# espefuse registers a click result callback on its module-level
|
|
186
|
+
# group every time it is invoked, chaining onto the one already
|
|
187
|
+
# there. A suite that burns in a loop -- ESP-IDF's secure boot does
|
|
188
|
+
# so 1150 times -- overflows the stack somewhere past 950 calls.
|
|
189
|
+
# The callback only acts when one invocation carries several burn
|
|
190
|
+
# commands, which is never the case here.
|
|
191
|
+
espefuse.cli._result_callback = None
|
|
192
|
+
espefuse.main(
|
|
193
|
+
[
|
|
194
|
+
'--port',
|
|
195
|
+
f'socket://127.0.0.1:{available_port}',
|
|
196
|
+
'--chip',
|
|
197
|
+
self.target,
|
|
198
|
+
'--do-not-confirm',
|
|
199
|
+
*args,
|
|
200
|
+
]
|
|
201
|
+
)
|
|
202
|
+
finally:
|
|
203
|
+
child.terminate()
|
|
204
|
+
child.wait(timeout=10)
|
|
205
|
+
|
|
206
|
+
# The child wrote the burned image out as it exited, but this emulator
|
|
207
|
+
# still holds the eFuses it read at start, so a later reset would not
|
|
208
|
+
# see the burn. Read the new image into the running machine, which
|
|
209
|
+
# resets it -- the same thing a burn needs on hardware to take effect.
|
|
210
|
+
# A build without the command keeps the older behaviour: the burn is in
|
|
211
|
+
# the image for the next start, just not in the machine already up.
|
|
212
|
+
if self.control_port is not None and self.supports_efuse_load:
|
|
213
|
+
self.control_command(f'efuse-load {self.efuse_path}')
|
|
214
|
+
|
|
215
|
+
@staticmethod
|
|
216
|
+
def _wait_for_port(port: int, timeout: float = 30) -> None:
|
|
217
|
+
"""Wait until the emulator accepts connections on its UART socket."""
|
|
218
|
+
deadline = time.time() + timeout
|
|
219
|
+
while time.time() < deadline:
|
|
220
|
+
with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s:
|
|
221
|
+
s.settimeout(0.5)
|
|
222
|
+
if s.connect_ex(('127.0.0.1', port)) == 0:
|
|
223
|
+
return
|
|
224
|
+
time.sleep(0.1)
|
|
225
|
+
|
|
226
|
+
raise TimeoutError(f'esp-emu did not open its UART socket on port {port} within {timeout}s')
|
|
227
|
+
|
|
228
|
+
@staticmethod
|
|
229
|
+
def _free_port() -> int:
|
|
230
|
+
"""An unused local port for one of the emulator's sockets."""
|
|
231
|
+
with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s:
|
|
232
|
+
s.bind(('127.0.0.1', 0))
|
|
233
|
+
return int(s.getsockname()[1])
|
|
234
|
+
|
|
235
|
+
@classmethod
|
|
236
|
+
def pick_control_port(cls, prog_path: str | None = None) -> int | None:
|
|
237
|
+
"""
|
|
238
|
+
A free port for the control channel, or `None` if this build has none.
|
|
239
|
+
|
|
240
|
+
A chip reset has no in-band form — on hardware it is a DTR/RTS toggle
|
|
241
|
+
into EN, and pyserial's `socket://` handler ignores modem control
|
|
242
|
+
lines — so it goes over esp-emu's control channel. Older binaries do
|
|
243
|
+
not have the flag, and passing an unknown one makes them exit, so ask
|
|
244
|
+
first. Chosen before either the emulator or its serial exists, so both
|
|
245
|
+
can be handed the same port.
|
|
246
|
+
"""
|
|
247
|
+
if '--control-tcp' not in cls._help_text(prog_path or cls.ESPEMU_PROG_PATH):
|
|
248
|
+
return None
|
|
249
|
+
return cls._free_port()
|
|
250
|
+
|
|
251
|
+
@functools.cached_property
|
|
252
|
+
def supports_efuse_load(self) -> bool:
|
|
253
|
+
"""Whether this build takes `efuse-load`, which arrived after the channel did."""
|
|
254
|
+
return 'efuse-load' in self._help_text(self.espemu_prog_path)
|
|
255
|
+
|
|
256
|
+
@classmethod
|
|
257
|
+
def _help_text(cls, prog_path: str) -> str:
|
|
258
|
+
"""This esp-emu build's help, which is what says which flags and
|
|
259
|
+
control-channel commands it has. Empty if it cannot be run."""
|
|
260
|
+
try:
|
|
261
|
+
out = subprocess.run([prog_path, '--help'], capture_output=True, text=True, timeout=15)
|
|
262
|
+
except (OSError, subprocess.SubprocessError):
|
|
263
|
+
return ''
|
|
264
|
+
return out.stdout + out.stderr
|
|
265
|
+
|
|
266
|
+
def control_command(self, command: str, timeout: float = 30) -> str:
|
|
267
|
+
"""Send one command to this emulator's control channel and return its reply."""
|
|
268
|
+
return send_control_command(self.control_port, command, timeout)
|
|
269
|
+
|
|
270
|
+
def _hard_reset(self):
|
|
271
|
+
"""
|
|
272
|
+
Reset the emulated chip, the way a DTR/RTS toggle does on hardware.
|
|
273
|
+
|
|
274
|
+
The emulator process keeps running, so the dut's output stream, its
|
|
275
|
+
expect history and the log all continue across the reset.
|
|
276
|
+
"""
|
|
277
|
+
self.control_command('reset')
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import logging
|
|
2
|
+
import typing as t
|
|
3
|
+
|
|
4
|
+
from .espemu import send_control_command
|
|
5
|
+
|
|
6
|
+
if t.TYPE_CHECKING:
|
|
7
|
+
from pytest_embedded_idf.app import IdfApp
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
class EspEmuSerial:
|
|
11
|
+
"""
|
|
12
|
+
The device-state half of an emulated dut.
|
|
13
|
+
|
|
14
|
+
ESP-IDF tests reach the chip through two channels: the console stream
|
|
15
|
+
(``dut.expect``) and a control channel (``dut.serial``) that resets it,
|
|
16
|
+
erases flash and burns eFuses. The second one is esptool-backed on
|
|
17
|
+
hardware, and an emulator has no serial port behind it, so the operations
|
|
18
|
+
that are expressible go over esp-emu's control channel instead.
|
|
19
|
+
|
|
20
|
+
Reset and the flash erase and write operations go over the channel and act
|
|
21
|
+
on the running machine, so the firmware sees them without a reload. The
|
|
22
|
+
operations that need esptool itself — ``flash()``, ``bootloader_flash()``
|
|
23
|
+
and the partition-writing helpers ESP-IDF's esp_tee tests subclass in —
|
|
24
|
+
still raise, and the test reports the operation it needed.
|
|
25
|
+
"""
|
|
26
|
+
|
|
27
|
+
def __init__(self, control_port: int | None = None, app: t.Optional['IdfApp'] = None) -> None:
|
|
28
|
+
"""
|
|
29
|
+
Args:
|
|
30
|
+
control_port: the emulator's control channel, the same port `EspEmu` serves;
|
|
31
|
+
`None` for a build without one
|
|
32
|
+
app: `IdfApp` instance, whose partition table `erase_partition` reads
|
|
33
|
+
"""
|
|
34
|
+
self.control_port = control_port
|
|
35
|
+
self.app = app
|
|
36
|
+
|
|
37
|
+
@property
|
|
38
|
+
def port(self) -> str:
|
|
39
|
+
"""The control channel's address, in the place a port name would be."""
|
|
40
|
+
if self.control_port is None:
|
|
41
|
+
return 'espemu'
|
|
42
|
+
return f'espemu://127.0.0.1:{self.control_port}'
|
|
43
|
+
|
|
44
|
+
def hard_reset(self) -> None:
|
|
45
|
+
"""Reset the chip, the way a DTR/RTS toggle does on hardware."""
|
|
46
|
+
logging.debug('hard resetting the emulated chip')
|
|
47
|
+
send_control_command(self.control_port, 'reset')
|
|
48
|
+
|
|
49
|
+
def erase_flash(self) -> None:
|
|
50
|
+
"""Erase the whole flash, as ``esptool erase-flash`` does."""
|
|
51
|
+
logging.info('erasing the emulated flash')
|
|
52
|
+
send_control_command(self.control_port, 'erase-flash')
|
|
53
|
+
|
|
54
|
+
def erase_region(self, offset: int, size: int) -> None:
|
|
55
|
+
"""Erase one flash region, as ``esptool erase-region`` does."""
|
|
56
|
+
logging.info('erasing %#x bytes of emulated flash at %#x', size, offset)
|
|
57
|
+
send_control_command(self.control_port, f'erase-region {offset:#x} {size:#x}')
|
|
58
|
+
|
|
59
|
+
def erase_partition(self, partition_name: str) -> None:
|
|
60
|
+
"""Erase one partition, looked up in the app's partition table."""
|
|
61
|
+
table = getattr(self.app, 'partition_table', None)
|
|
62
|
+
if not table:
|
|
63
|
+
raise ValueError('Partition table not parsed.')
|
|
64
|
+
if partition_name not in table:
|
|
65
|
+
raise ValueError(f'partition {partition_name} not found in the partition table')
|
|
66
|
+
entry = table[partition_name]
|
|
67
|
+
self.erase_region(entry['offset'], entry['size'])
|
|
68
|
+
|
|
69
|
+
def write_flash_no_enc(self, offset: int, file_path: str) -> None:
|
|
70
|
+
"""Write one file into flash at ``offset``, without encrypting it."""
|
|
71
|
+
logging.info('writing %s into emulated flash at %#x', file_path, offset)
|
|
72
|
+
send_control_command(self.control_port, f'write-region {offset:#x} {file_path}')
|
|
73
|
+
|
|
74
|
+
def close(self) -> None:
|
|
75
|
+
"""Nothing to close: the control channel is opened per command."""
|
|
76
|
+
|
|
77
|
+
def __getattr__(self, name: str) -> t.Any:
|
|
78
|
+
raise NotImplementedError(
|
|
79
|
+
f'esp-emu cannot do dut.serial.{name}() yet: it needs esptool '
|
|
80
|
+
f'itself, driving the emulator in download mode with its UART on '
|
|
81
|
+
f'a socket.'
|
|
82
|
+
)
|
|
@@ -33,6 +33,36 @@ def test_pexpect_by_espemu(testdir):
|
|
|
33
33
|
result.assert_outcomes(passed=1)
|
|
34
34
|
|
|
35
35
|
|
|
36
|
+
@espemu_bin_required
|
|
37
|
+
def test_espemu_write_efuse(testdir):
|
|
38
|
+
efuse_path = os.path.join(testdir.tmpdir, 'efuse.bin')
|
|
39
|
+
|
|
40
|
+
testdir.makepyfile(f"""
|
|
41
|
+
def test_espemu_write_efuse(dut):
|
|
42
|
+
dut.espemu.execute_efuse_command('burn-custom-mac 00:11:22:33:44:55')
|
|
43
|
+
|
|
44
|
+
with open({efuse_path!r}, 'rb') as f:
|
|
45
|
+
content = f.read()
|
|
46
|
+
|
|
47
|
+
# the emulator writes the eFuse image back when it exits, so the
|
|
48
|
+
# burned MAC is there for the next run
|
|
49
|
+
assert len(content) == 336
|
|
50
|
+
assert bytes.fromhex('001122334455') in content
|
|
51
|
+
""")
|
|
52
|
+
|
|
53
|
+
result = testdir.runpytest(
|
|
54
|
+
'-s',
|
|
55
|
+
'--embedded-services',
|
|
56
|
+
'idf,espemu',
|
|
57
|
+
'--app-path',
|
|
58
|
+
os.path.join(testdir.tmpdir, 'hello_world_esp32c3'),
|
|
59
|
+
'--espemu-efuse-path',
|
|
60
|
+
efuse_path,
|
|
61
|
+
)
|
|
62
|
+
|
|
63
|
+
result.assert_outcomes(passed=1)
|
|
64
|
+
|
|
65
|
+
|
|
36
66
|
@espemu_bin_required
|
|
37
67
|
def test_multi_count_espemu(testdir):
|
|
38
68
|
testdir.makepyfile("""
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import os
|
|
2
|
+
import shutil
|
|
3
|
+
|
|
4
|
+
import pytest
|
|
5
|
+
|
|
6
|
+
espemu_bin_required = pytest.mark.skipif(shutil.which('esp-emu') is None, reason='no esp-emu')
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
@espemu_bin_required
|
|
10
|
+
def test_serial_is_the_fixture(testdir):
|
|
11
|
+
testdir.makepyfile("""
|
|
12
|
+
from pytest_embedded_espemu import EspEmuSerial
|
|
13
|
+
|
|
14
|
+
def test_serial_is_the_fixture(dut, serial):
|
|
15
|
+
assert isinstance(serial, EspEmuSerial)
|
|
16
|
+
assert dut.serial is serial
|
|
17
|
+
|
|
18
|
+
# the serial is built from the port alone, the one the emulator serves
|
|
19
|
+
assert serial.control_port is not None
|
|
20
|
+
assert serial.control_port == dut.espemu.control_port
|
|
21
|
+
|
|
22
|
+
# and that is enough to drive it: the reset is answered, not refused
|
|
23
|
+
serial.hard_reset()
|
|
24
|
+
""")
|
|
25
|
+
|
|
26
|
+
result = testdir.runpytest(
|
|
27
|
+
'-s',
|
|
28
|
+
'--embedded-services',
|
|
29
|
+
'idf,espemu',
|
|
30
|
+
'--app-path',
|
|
31
|
+
os.path.join(testdir.tmpdir, 'hello_world_esp32c3'),
|
|
32
|
+
)
|
|
33
|
+
|
|
34
|
+
result.assert_outcomes(passed=1)
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
Metadata-Version: 2.4
|
|
2
|
-
Name: pytest-embedded-espemu
|
|
3
|
-
Version: 2.9.2
|
|
4
|
-
Summary: Make pytest-embedded plugin work with esp-emu.
|
|
5
|
-
Author: Espressif Systems
|
|
6
|
-
Requires-Python: >=3.10
|
|
7
|
-
Description-Content-Type: text/markdown
|
|
8
|
-
Classifier: Development Status :: 4 - Beta
|
|
9
|
-
Classifier: Framework :: Pytest
|
|
10
|
-
Classifier: Intended Audience :: Developers
|
|
11
|
-
Classifier: License :: OSI Approved :: MIT License
|
|
12
|
-
Classifier: Operating System :: OS Independent
|
|
13
|
-
Classifier: Programming Language :: Python :: 3 :: Only
|
|
14
|
-
Classifier: Programming Language :: Python :: 3
|
|
15
|
-
Classifier: Programming Language :: Python :: 3.10
|
|
16
|
-
Classifier: Programming Language :: Python :: 3.11
|
|
17
|
-
Classifier: Programming Language :: Python :: 3.12
|
|
18
|
-
Classifier: Programming Language :: Python :: 3.13
|
|
19
|
-
Classifier: Programming Language :: Python :: 3.14
|
|
20
|
-
Classifier: Programming Language :: Python
|
|
21
|
-
Classifier: Topic :: Software Development :: Testing
|
|
22
|
-
License-File: LICENSE
|
|
23
|
-
Requires-Dist: pytest-embedded~=2.9.2
|
|
24
|
-
Requires-Dist: pytest-embedded-idf~=2.9.2 ; extra == "idf"
|
|
25
|
-
Project-URL: changelog, https://github.com/espressif/pytest-embedded/blob/main/CHANGELOG.md
|
|
26
|
-
Project-URL: documentation, https://docs.espressif.com/projects/pytest-embedded/en/latest/
|
|
27
|
-
Project-URL: homepage, https://github.com/espressif/pytest-embedded
|
|
28
|
-
Project-URL: repository, https://github.com/espressif/pytest-embedded
|
|
29
|
-
Provides-Extra: idf
|
|
30
|
-
|
|
31
|
-
### pytest-embedded-espemu
|
|
32
|
-
|
|
33
|
-
pytest-embedded service for running tests on [esp-emu](https://github.com/espressif/esp-emulator), Espressif's lightweight emulator for ESP RISC-V series SoCs, instead of real targets.
|
|
34
|
-
|
|
35
|
-
Supported targets: `esp32c3`, `esp32c6`, `esp32h2`, `esp32p4`, `esp32s31`.
|
|
36
|
-
|
|
37
|
-
#### Usage
|
|
38
|
-
|
|
39
|
-
```shell
|
|
40
|
-
pytest --embedded-services idf,espemu --target esp32c3
|
|
41
|
-
```
|
|
42
|
-
|
|
43
|
-
The service builds a merged flash binary from the app's build directory (via `esptool merge-bin`), launches `esp-emu` with UART0 on stdio, and drives it like any other DUT — including the Unity test menu machinery from `pytest-embedded-idf`.
|
|
44
|
-
|
|
45
|
-
Extra CLI options:
|
|
46
|
-
|
|
47
|
-
- `--espemu-image-path`: use an existing merged flash binary instead of generating one
|
|
48
|
-
- `--espemu-prog-path`: path to the `esp-emu` binary (default: `esp-emu` from `PATH`)
|
|
49
|
-
- `--espemu-cli-args` / `--espemu-extra-args`: forwarded to the `esp-emu` command line, e.g. `--espemu-extra-args "--net user,restrict=yes"`
|
|
50
|
-
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
### pytest-embedded-espemu
|
|
2
|
-
|
|
3
|
-
pytest-embedded service for running tests on [esp-emu](https://github.com/espressif/esp-emulator), Espressif's lightweight emulator for ESP RISC-V series SoCs, instead of real targets.
|
|
4
|
-
|
|
5
|
-
Supported targets: `esp32c3`, `esp32c6`, `esp32h2`, `esp32p4`, `esp32s31`.
|
|
6
|
-
|
|
7
|
-
#### Usage
|
|
8
|
-
|
|
9
|
-
```shell
|
|
10
|
-
pytest --embedded-services idf,espemu --target esp32c3
|
|
11
|
-
```
|
|
12
|
-
|
|
13
|
-
The service builds a merged flash binary from the app's build directory (via `esptool merge-bin`), launches `esp-emu` with UART0 on stdio, and drives it like any other DUT — including the Unity test menu machinery from `pytest-embedded-idf`.
|
|
14
|
-
|
|
15
|
-
Extra CLI options:
|
|
16
|
-
|
|
17
|
-
- `--espemu-image-path`: use an existing merged flash binary instead of generating one
|
|
18
|
-
- `--espemu-prog-path`: path to the `esp-emu` binary (default: `esp-emu` from `PATH`)
|
|
19
|
-
- `--espemu-cli-args` / `--espemu-extra-args`: forwarded to the `esp-emu` command line, e.g. `--espemu-extra-args "--net user,restrict=yes"`
|
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
import shlex
|
|
2
|
-
import typing as t
|
|
3
|
-
|
|
4
|
-
from pytest_embedded.log import DuplicateStdoutPopen
|
|
5
|
-
|
|
6
|
-
if t.TYPE_CHECKING:
|
|
7
|
-
from .app import EspEmuApp
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
class EspEmu(DuplicateStdoutPopen):
|
|
11
|
-
"""
|
|
12
|
-
esp-emu class (https://github.com/espressif/esp-emulator)
|
|
13
|
-
|
|
14
|
-
The emulator runs with UART0 attached to stdio: its output streams
|
|
15
|
-
straight into the pexpect process and `write()` feeds the firmware's
|
|
16
|
-
UART RX via stdin. No sockets are involved.
|
|
17
|
-
"""
|
|
18
|
-
|
|
19
|
-
SOURCE = 'ESPEMU'
|
|
20
|
-
|
|
21
|
-
ESPEMU_PROG_PATH = 'esp-emu'
|
|
22
|
-
|
|
23
|
-
SUPPORTED_TARGETS: t.ClassVar[tuple] = ('esp32c3', 'esp32c6', 'esp32h2', 'esp32p4', 'esp32s31')
|
|
24
|
-
|
|
25
|
-
def __init__(
|
|
26
|
-
self,
|
|
27
|
-
espemu_image_path: str | None = None,
|
|
28
|
-
espemu_prog_path: str | None = None,
|
|
29
|
-
espemu_cli_args: str | None = None,
|
|
30
|
-
espemu_extra_args: str | None = None,
|
|
31
|
-
app: t.Optional['EspEmuApp'] = None,
|
|
32
|
-
**kwargs,
|
|
33
|
-
):
|
|
34
|
-
"""
|
|
35
|
-
Args:
|
|
36
|
-
espemu_image_path: image path (merged flash binary)
|
|
37
|
-
espemu_prog_path: esp-emu program path
|
|
38
|
-
espemu_cli_args: esp-emu CLI arguments
|
|
39
|
-
espemu_extra_args: esp-emu CLI extra arguments, will be appended to `espemu_cli_args`
|
|
40
|
-
app: `EspEmuApp` instance, used to detect the target chip
|
|
41
|
-
"""
|
|
42
|
-
self.app = app
|
|
43
|
-
|
|
44
|
-
image_path = espemu_image_path
|
|
45
|
-
if not image_path and self.app:
|
|
46
|
-
image_path = self.app.image_path
|
|
47
|
-
if not image_path:
|
|
48
|
-
raise ValueError('Please specify --espemu-image-path or use the espemu service together with idf')
|
|
49
|
-
|
|
50
|
-
target = getattr(self.app, 'target', None)
|
|
51
|
-
if target not in self.SUPPORTED_TARGETS:
|
|
52
|
-
raise ValueError(
|
|
53
|
-
f'esp-emu does not support target {target!r}. Supported targets: {", ".join(self.SUPPORTED_TARGETS)}'
|
|
54
|
-
)
|
|
55
|
-
|
|
56
|
-
espemu_prog_path = espemu_prog_path or self.ESPEMU_PROG_PATH
|
|
57
|
-
|
|
58
|
-
cmd = [
|
|
59
|
-
espemu_prog_path,
|
|
60
|
-
'--chip',
|
|
61
|
-
target,
|
|
62
|
-
'--firmware',
|
|
63
|
-
image_path,
|
|
64
|
-
*shlex.split(espemu_cli_args or ''),
|
|
65
|
-
*shlex.split(espemu_extra_args or ''),
|
|
66
|
-
]
|
|
67
|
-
|
|
68
|
-
super().__init__(cmd=cmd, **kwargs)
|
|
69
|
-
|
|
70
|
-
def _hard_reset(self):
|
|
71
|
-
"""
|
|
72
|
-
esp-emu has no reset API. Raising `NotImplementedError` makes
|
|
73
|
-
`IdfUnityDutMixin` fall back to re-triggering the Unity test menu
|
|
74
|
-
with a newline instead of resetting the target.
|
|
75
|
-
"""
|
|
76
|
-
raise NotImplementedError('esp-emu does not support resetting; relaunch the emulator instead')
|
|
File without changes
|