Last active
January 29, 2025 11:14
-
-
Save kozmotronik/5d5c01188e70c82cafa2e3c79882a952 to your computer and use it in GitHub Desktop.
ESP-IDF VSCode Extension Unit Test Chip Select Issue
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
================================================================================================= test session starts ================================================================================================== | |
platform linux -- Python 3.13.1, pytest-8.3.4, pluggy-1.5.0 | |
rootdir: /disk/Projeler/Lab/Espressif/lab-system/unit-testing-esp/unity-app | |
plugins: embedded-1.12.1, ignore-test-results-0.2.2, timeout-2.3.1, rerunfailures-15.0 | |
collected 1 item | |
test_unit_case.py 2025-01-29 11:07:07 Serial port /dev/ttyUSB0 | |
2025-01-29 11:07:07 Connecting.... | |
2025-01-29 11:07:07 /dev/ttyUSB0 failed to connect: This chip is ESP32-C3 not ESP32. Wrong --chip argument? | |
2025-01-29 11:07:07 Serial port /dev/ttyS9 | |
2025-01-29 11:07:07 /dev/ttyS9 failed to connect: Could not open /dev/ttyS9, the port is busy or doesn't exist. | |
2025-01-29 11:07:07 (Could not configure port: (5, 'Input/output error')) | |
2025-01-29 11:07:07 | |
2025-01-29 11:07:07 Serial port /dev/ttyS8 | |
2025-01-29 11:07:07 /dev/ttyS8 failed to connect: Could not open /dev/ttyS8, the port is busy or doesn't exist. | |
2025-01-29 11:07:07 (Could not configure port: (5, 'Input/output error')) | |
2025-01-29 11:07:07 | |
2025-01-29 11:07:07 Serial port /dev/ttyS7 | |
2025-01-29 11:07:07 /dev/ttyS7 failed to connect: Could not open /dev/ttyS7, the port is busy or doesn't exist. | |
2025-01-29 11:07:07 (Could not configure port: (5, 'Input/output error')) | |
2025-01-29 11:07:07 | |
2025-01-29 11:07:07 Serial port /dev/ttyS6 | |
2025-01-29 11:07:07 /dev/ttyS6 failed to connect: Could not open /dev/ttyS6, the port is busy or doesn't exist. | |
2025-01-29 11:07:07 (Could not configure port: (5, 'Input/output error')) | |
2025-01-29 11:07:07 | |
2025-01-29 11:07:07 Serial port /dev/ttyS5 | |
2025-01-29 11:07:07 /dev/ttyS5 failed to connect: Could not open /dev/ttyS5, the port is busy or doesn't exist. | |
2025-01-29 11:07:07 (Could not configure port: (5, 'Input/output error')) | |
2025-01-29 11:07:07 | |
2025-01-29 11:07:07 Serial port /dev/ttyS4 | |
2025-01-29 11:07:07 /dev/ttyS4 failed to connect: Could not open /dev/ttyS4, the port is busy or doesn't exist. | |
2025-01-29 11:07:07 (Could not configure port: (5, 'Input/output error')) | |
2025-01-29 11:07:07 | |
2025-01-29 11:07:07 Serial port /dev/ttyS31 | |
2025-01-29 11:07:07 /dev/ttyS31 failed to connect: Could not open /dev/ttyS31, the port is busy or doesn't exist. | |
2025-01-29 11:07:07 (Could not configure port: (5, 'Input/output error')) | |
2025-01-29 11:07:07 | |
2025-01-29 11:07:07 Serial port /dev/ttyS30 | |
2025-01-29 11:07:07 /dev/ttyS30 failed to connect: Could not open /dev/ttyS30, the port is busy or doesn't exist. | |
2025-01-29 11:07:07 (Could not configure port: (5, 'Input/output error')) | |
2025-01-29 11:07:07 | |
2025-01-29 11:07:07 Serial port /dev/ttyS3 | |
2025-01-29 11:07:07 /dev/ttyS3 failed to connect: Could not open /dev/ttyS3, the port is busy or doesn't exist. | |
2025-01-29 11:07:07 (Could not configure port: (5, 'Input/output error')) | |
2025-01-29 11:07:07 | |
2025-01-29 11:07:07 Serial port /dev/ttyS29 | |
2025-01-29 11:07:07 /dev/ttyS29 failed to connect: Could not open /dev/ttyS29, the port is busy or doesn't exist. | |
2025-01-29 11:07:07 (Could not configure port: (5, 'Input/output error')) | |
2025-01-29 11:07:07 | |
2025-01-29 11:07:07 Serial port /dev/ttyS28 | |
2025-01-29 11:07:07 /dev/ttyS28 failed to connect: Could not open /dev/ttyS28, the port is busy or doesn't exist. | |
2025-01-29 11:07:07 (Could not configure port: (5, 'Input/output error')) | |
2025-01-29 11:07:07 | |
2025-01-29 11:07:07 Serial port /dev/ttyS27 | |
2025-01-29 11:07:07 /dev/ttyS27 failed to connect: Could not open /dev/ttyS27, the port is busy or doesn't exist. | |
2025-01-29 11:07:07 (Could not configure port: (5, 'Input/output error')) | |
2025-01-29 11:07:07 | |
2025-01-29 11:07:07 Serial port /dev/ttyS26 | |
2025-01-29 11:07:07 /dev/ttyS26 failed to connect: Could not open /dev/ttyS26, the port is busy or doesn't exist. | |
2025-01-29 11:07:07 (Could not configure port: (5, 'Input/output error')) | |
2025-01-29 11:07:07 | |
2025-01-29 11:07:07 Serial port /dev/ttyS25 | |
2025-01-29 11:07:07 /dev/ttyS25 failed to connect: Could not open /dev/ttyS25, the port is busy or doesn't exist. | |
2025-01-29 11:07:07 (Could not configure port: (5, 'Input/output error')) | |
2025-01-29 11:07:07 | |
2025-01-29 11:07:07 Serial port /dev/ttyS24 | |
2025-01-29 11:07:07 /dev/ttyS24 failed to connect: Could not open /dev/ttyS24, the port is busy or doesn't exist. | |
2025-01-29 11:07:07 (Could not configure port: (5, 'Input/output error')) | |
2025-01-29 11:07:07 | |
2025-01-29 11:07:07 Serial port /dev/ttyS23 | |
2025-01-29 11:07:07 /dev/ttyS23 failed to connect: Could not open /dev/ttyS23, the port is busy or doesn't exist. | |
2025-01-29 11:07:07 (Could not configure port: (5, 'Input/output error')) | |
2025-01-29 11:07:07 | |
2025-01-29 11:07:07 Serial port /dev/ttyS22 | |
2025-01-29 11:07:07 /dev/ttyS22 failed to connect: Could not open /dev/ttyS22, the port is busy or doesn't exist. | |
2025-01-29 11:07:07 (Could not configure port: (5, 'Input/output error')) | |
2025-01-29 11:07:07 | |
2025-01-29 11:07:07 Serial port /dev/ttyS21 | |
2025-01-29 11:07:07 /dev/ttyS21 failed to connect: Could not open /dev/ttyS21, the port is busy or doesn't exist. | |
2025-01-29 11:07:07 (Could not configure port: (5, 'Input/output error')) | |
2025-01-29 11:07:07 | |
2025-01-29 11:07:07 Serial port /dev/ttyS20 | |
2025-01-29 11:07:07 /dev/ttyS20 failed to connect: Could not open /dev/ttyS20, the port is busy or doesn't exist. | |
2025-01-29 11:07:07 (Could not configure port: (5, 'Input/output error')) | |
2025-01-29 11:07:07 | |
2025-01-29 11:07:07 Serial port /dev/ttyS2 | |
2025-01-29 11:07:07 /dev/ttyS2 failed to connect: Could not open /dev/ttyS2, the port is busy or doesn't exist. | |
2025-01-29 11:07:07 (Could not configure port: (5, 'Input/output error')) | |
2025-01-29 11:07:07 | |
2025-01-29 11:07:07 Serial port /dev/ttyS19 | |
2025-01-29 11:07:07 /dev/ttyS19 failed to connect: Could not open /dev/ttyS19, the port is busy or doesn't exist. | |
2025-01-29 11:07:07 (Could not configure port: (5, 'Input/output error')) | |
2025-01-29 11:07:07 | |
2025-01-29 11:07:07 Serial port /dev/ttyS18 | |
2025-01-29 11:07:07 /dev/ttyS18 failed to connect: Could not open /dev/ttyS18, the port is busy or doesn't exist. | |
2025-01-29 11:07:07 (Could not configure port: (5, 'Input/output error')) | |
2025-01-29 11:07:07 | |
2025-01-29 11:07:07 Serial port /dev/ttyS17 | |
2025-01-29 11:07:07 /dev/ttyS17 failed to connect: Could not open /dev/ttyS17, the port is busy or doesn't exist. | |
2025-01-29 11:07:07 (Could not configure port: (5, 'Input/output error')) | |
2025-01-29 11:07:07 | |
2025-01-29 11:07:07 Serial port /dev/ttyS16 | |
2025-01-29 11:07:07 /dev/ttyS16 failed to connect: Could not open /dev/ttyS16, the port is busy or doesn't exist. | |
2025-01-29 11:07:07 (Could not configure port: (5, 'Input/output error')) | |
2025-01-29 11:07:07 | |
2025-01-29 11:07:07 Serial port /dev/ttyS15 | |
2025-01-29 11:07:07 /dev/ttyS15 failed to connect: Could not open /dev/ttyS15, the port is busy or doesn't exist. | |
2025-01-29 11:07:07 (Could not configure port: (5, 'Input/output error')) | |
2025-01-29 11:07:07 | |
2025-01-29 11:07:07 Serial port /dev/ttyS14 | |
2025-01-29 11:07:07 /dev/ttyS14 failed to connect: Could not open /dev/ttyS14, the port is busy or doesn't exist. | |
2025-01-29 11:07:07 (Could not configure port: (5, 'Input/output error')) | |
2025-01-29 11:07:07 | |
2025-01-29 11:07:07 Serial port /dev/ttyS13 | |
2025-01-29 11:07:07 /dev/ttyS13 failed to connect: Could not open /dev/ttyS13, the port is busy or doesn't exist. | |
2025-01-29 11:07:07 (Could not configure port: (5, 'Input/output error')) | |
2025-01-29 11:07:07 | |
2025-01-29 11:07:07 Serial port /dev/ttyS12 | |
2025-01-29 11:07:07 /dev/ttyS12 failed to connect: Could not open /dev/ttyS12, the port is busy or doesn't exist. | |
2025-01-29 11:07:07 (Could not configure port: (5, 'Input/output error')) | |
2025-01-29 11:07:07 | |
2025-01-29 11:07:07 Serial port /dev/ttyS11 | |
2025-01-29 11:07:07 /dev/ttyS11 failed to connect: Could not open /dev/ttyS11, the port is busy or doesn't exist. | |
2025-01-29 11:07:07 (Could not configure port: (5, 'Input/output error')) | |
2025-01-29 11:07:07 | |
2025-01-29 11:07:07 Serial port /dev/ttyS10 | |
2025-01-29 11:07:07 /dev/ttyS10 failed to connect: Could not open /dev/ttyS10, the port is busy or doesn't exist. | |
2025-01-29 11:07:07 (Could not configure port: (5, 'Input/output error')) | |
2025-01-29 11:07:07 | |
2025-01-29 11:07:07 Serial port /dev/ttyS1 | |
2025-01-29 11:07:07 /dev/ttyS1 failed to connect: Could not open /dev/ttyS1, the port is busy or doesn't exist. | |
2025-01-29 11:07:07 (Could not configure port: (5, 'Input/output error')) | |
2025-01-29 11:07:07 | |
2025-01-29 11:07:07 Serial port /dev/ttyS0 | |
2025-01-29 11:07:07 /dev/ttyS0 failed to connect: Could not open /dev/ttyS0, the port is busy or doesn't exist. | |
2025-01-29 11:07:07 (Could not configure port: (5, 'Input/output error')) | |
2025-01-29 11:07:07 | |
E | |
======================================================================================================== ERRORS ======================================================================================================== | |
___________________________________________________________________________ ERROR at setup of test_unit_test[Mean of an empty array is zero] ___________________________________________________________________________ | |
args = () | |
kwargs = {'_fixture_classes_and_options': ClassCliOptions(classes={'app': <class 'pytest_embedded_idf.app.IdfApp'>, 'serial': <...ded_idf.app.IdfApp object at 0x773fa716dfd0>, 'msg_queue': <pytest_embedded.log.MessageQueue object at 0x773fa716cad0>} | |
_close_or_terminate = <function multi_dut_generator_fixture.<locals>.wrapper.<locals>._close_or_terminate at 0x773fa71a7100>, res = None | |
@functools.wraps(func) | |
def wrapper(*args, **kwargs): | |
def _close_or_terminate(obj): | |
if obj is None: | |
del obj | |
return | |
try: | |
if isinstance(obj, (subprocess.Popen, multiprocessing.process.BaseProcess)): | |
obj.terminate() | |
obj.kill() | |
elif isinstance(obj, io.IOBase): | |
try: | |
obj.close() | |
except Exception as e: | |
logging.debug('file %s closed failed with error: %s', obj, str(e)) | |
else: | |
try: | |
obj.close() | |
except AttributeError: | |
try: | |
obj.terminate() | |
except AttributeError: | |
pass | |
except Exception as e: | |
logging.debug('Not properly caught object %s: %s', obj, str(e)) | |
except Exception as e: | |
logging.debug('%s: %s', obj, str(e)) | |
return # swallow up all error | |
finally: | |
referrers = gc.get_referrers(obj) | |
for _referrer in referrers: | |
if isinstance(_referrer, list): | |
for _i, val in enumerate(_referrer): | |
if val is obj: | |
_referrer[_i] = None | |
elif isinstance(_referrer, dict): | |
for key, value in _referrer.items(): | |
if value is obj: | |
_referrer[key] = None | |
del obj | |
if _COUNT == 1: | |
res = None | |
try: | |
> res = func(*args, **kwargs) | |
/home/ismail/.espressif/python_env/idf5.4_py3.13_env/lib/python3.13/site-packages/pytest_embedded/plugin.py:499: | |
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
/home/ismail/.espressif/python_env/idf5.4_py3.13_env/lib/python3.13/site-packages/pytest_embedded/plugin.py:1120: in serial | |
return serial_gn(**locals()) | |
/home/ismail/.espressif/python_env/idf5.4_py3.13_env/lib/python3.13/site-packages/pytest_embedded/dut_factory.py:466: in serial_gn | |
return cls(**_drop_none_kwargs(kwargs)) | |
/home/ismail/.espressif/python_env/idf5.4_py3.13_env/lib/python3.13/site-packages/pytest_embedded_idf/serial.py:42: in __init__ | |
super().__init__( | |
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
self = <pytest_embedded_idf.serial.IdfSerial object at 0x773fa716dd30>, pexpect_proc = <pytest_embedded.log.PexpectProcess object at 0x773fa716da90> | |
msg_queue = <pytest_embedded.log.MessageQueue object at 0x773fa716cad0>, target = 'esp32', beta_target = None, port = None, port_mac = None, baud = 115200, esptool_baud = 921600, esp_flash_force = False | |
skip_autoflash = True, erase_all = False | |
meta = Meta(logdir='/tmp/pytest-embedded/2025-01-29_08-07-07-180239/test_unit_test[Mean of an empty array is zero]', port_target_cache={}, port_app_cache={}, logfile_extension='.log'), ports_to_occupy = () | |
kwargs = {}, port_filter = '', available_ports = ['/dev/ttyS0', '/dev/ttyS1', '/dev/ttyS10', '/dev/ttyS11', '/dev/ttyS12', '/dev/ttyS13', ...] | |
ports = ['/dev/ttyS0', '/dev/ttyS1', '/dev/ttyS10', '/dev/ttyS11', '/dev/ttyS12', '/dev/ttyS13', ...] | |
def __init__( | |
self, | |
pexpect_proc: PexpectProcess, | |
msg_queue: MessageQueue, | |
target: Optional[str] = None, | |
beta_target: Optional[str] = None, | |
port: Optional[str] = None, | |
port_mac: Optional[str] = None, | |
baud: int = Serial.DEFAULT_BAUDRATE, | |
esptool_baud: int = ESPTOOL_DEFAULT_BAUDRATE, | |
esp_flash_force: bool = False, | |
skip_autoflash: bool = False, | |
erase_all: bool = False, | |
meta: Optional[Meta] = None, | |
ports_to_occupy: List[str] = (), | |
**kwargs, | |
) -> None: | |
self._meta = meta | |
esptool_target = beta_target or target or 'auto' | |
if port is None or port.endswith('*'): | |
port_filter = port.strip('*') if port else '' | |
available_ports = [_p for _p in esptool.get_port_list() if port_filter in _p] | |
ports = list(set(available_ports) - set(self.occupied_ports.keys()) - set(ports_to_occupy)) | |
# sort to make /dev/ttyS* ports before /dev/ttyUSB* ports | |
# esptool will reverse the list | |
ports.sort() | |
if port_mac: | |
for port in ports: | |
if _is_port_mac_verified(pexpect_proc, port, port_mac, msg_queue): | |
ports = [port] | |
break | |
else: | |
raise ValueError(f'The specified MAC address {port_mac} cannot be found.') | |
# prioritize the cache recorded target port | |
if esptool_target and self._meta: | |
ports.sort(key=lambda x: self._meta.hit_port_target_cache(x, esptool_target)) | |
logging.debug(f'Detecting ports from {", ".join(ports)}') | |
else: | |
if port_mac: | |
if _is_port_mac_verified(pexpect_proc, port, port_mac, msg_queue): | |
ports = [port] | |
else: | |
raise ValueError(f'The specified MAC address {port_mac} binds with different port, not with {port}') | |
else: | |
ports = [port] | |
# normal loader | |
if esptool_target not in ['auto', *ESPTOOL_CHIPS]: | |
raise ValueError( | |
f'esptool version {ESPTOOL_VERSION} not support target {esptool_target}\n' | |
f'Supported targets: {ESPTOOL_CHIPS}' | |
) | |
with contextlib.redirect_stdout(msg_queue): | |
self.esp = esptool.get_default_connected_device( | |
ports, | |
port=port, | |
connect_attempts=3, | |
initial_baud=baud, | |
chip=esptool_target, | |
) | |
if not self.esp: | |
> raise ValueError('Couldn\'t auto detect chip. Please manually specify with "--port"') | |
E ValueError: Couldn't auto detect chip. Please manually specify with "--port" | |
/home/ismail/.espressif/python_env/idf5.4_py3.13_env/lib/python3.13/site-packages/pytest_embedded_serial_esp/serial.py:118: ValueError | |
----------------------------------------------------------- generated xml file: /disk/Projeler/Lab/Espressif/lab-system/unit-testing-esp/unity-app/test.xml ------------------------------------------------------------ | |
===================================================================================================== Failed Cases ===================================================================================================== | |
====================================================================== you can use --ignore-result-files or --ignore-result-cases to ignore them ======================================================================= | |
test_unit_case.py::test_unit_test[Mean of an empty array is zero] | |
=============================================================================================== short test summary info ================================================================================================ | |
ERROR test_unit_case.py::test_unit_test[Mean of an empty array is zero] - ValueError: Couldn't auto detect chip. Please manually specify with "--port" | |
=================================================================================================== 1 error in 0.56s =================================================================================================== | |
* The terminal process "/usr/bin/fish '-c', 'pytest --junitxml test.xml --skip-autoflash y --embedded-services esp,idf -s --test-name 'Mean of an empty array is zero''" terminated with exit code: 1. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment