Skip to content

OpenOCDDriver: disable default server ports - #1958

Merged
jluebbe merged 1 commit into
labgrid-project:masterfrom
analogdevicesinc:openocd-close-ports
Aug 26, 2026
Merged

OpenOCDDriver: disable default server ports#1958
jluebbe merged 1 commit into
labgrid-project:masterfrom
analogdevicesinc:openocd-close-ports

Conversation

@ozan956

@ozan956 ozan956 commented Aug 16, 2026

Copy link
Copy Markdown
Contributor

Description

OpenOCD starts GDB, telnet, and TCL servers on fixed default ports. When
multiple boards on the same exporter bootstrap concurrently, the second
OpenOCD instance fails to bind these ports.

Disable the server ports before loading OpenOCD configuration files.
OpenOCDDriver does not provide a lifecycle for using or stopping these
servers, while disabling them allows parallel bootstrap operations.

Configurations that intentionally require a server interface can re-enable
the required port before init.

Checklist

  • Documentation for the feature
  • Tests for the feature
  • The arguments and description in doc/configuration.rst have been updated
  • Add a section on how to use the feature to doc/usage.rst
  • Add a section on how to use the feature to doc/development.rst
  • PR has been tested
  • Man pages have been regenerated

Tested with:

pytest -q tests/test_openocd.py
ruff check labgrid/driver/openocddriver.py
ruff format --check labgrid/driver/openocddriver.py

@Emantor Emantor left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That change makes sense to me, a different option would be to rewrite the exporter to control the openOCD invocation similar to how we handle serial ports with ser2net.

Emantor
Emantor previously approved these changes Aug 25, 2026
@Emantor

Emantor commented Aug 26, 2026

Copy link
Copy Markdown
Member

This currently breaks tests and there is a DCO complaint.

@ozan956

ozan956 commented Aug 26, 2026

Copy link
Copy Markdown
Contributor Author

That change makes sense to me, a different option would be to rewrite the exporter to control the openOCD invocation similar to how we handle serial ports with ser2net.

Thanks, that is a good point! However, that would be a broader architectural change. Since OpenOCDDriver currently invokes OpenOCD directly and does not use those server interfaces, I would prefer to keep this PR focused and consider exporter-managed OpenOCD invocation in a separate one.

@codecov

codecov Bot commented Aug 26, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 60.8%. Comparing base (a7a96a0) to head (a70ed34).
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@           Coverage Diff            @@
##           master   #1958     +/-   ##
========================================
- Coverage    60.8%   60.8%   -0.1%     
========================================
  Files         184     184             
  Lines       15189   15190      +1     
========================================
- Hits         9241    9240      -1     
- Misses       5948    5950      +2     
Flag Coverage Δ
3.10 60.7% <100.0%> (-0.1%) ⬇️
3.11 60.8% <100.0%> (+<0.1%) ⬆️
3.12 60.7% <100.0%> (-0.1%) ⬇️
3.13 60.7% <100.0%> (-0.1%) ⬇️
3.14 60.7% <100.0%> (-0.1%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

@Emantor
Emantor self-requested a review August 26, 2026 08:18
Comment thread labgrid/driver/openocddriver.py
@ozan956
ozan956 force-pushed the openocd-close-ports branch from 3adbae2 to 540bd3a Compare August 26, 2026 09:32
@ozan956
ozan956 requested a review from Emantor August 26, 2026 09:33
OpenOCD starts GDB, telnet, and TCL servers on fixed default ports.
When multiple boards on the same exporter bootstrap concurrently, the
second OpenOCD instance fails to bind these ports.

Disable the server ports before loading OpenOCD configuration files.
OpenOCDDriver does not provide a lifecycle for using or stopping these
servers, while disabling them allows parallel bootstrap operations.

Signed-off-by: Ozan Durgut <ozan.durgut@analog.com>
@ozan956
ozan956 force-pushed the openocd-close-ports branch from 540bd3a to a70ed34 Compare August 26, 2026 09:46
@jluebbe
jluebbe merged commit f786cab into labgrid-project:master Aug 26, 2026
10 of 11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants