tests/run-tests.py: Add --trace-output option for board targets. by dpgeorge · Pull Request #19329 · micropython/micropython · GitHub
Skip to content

tests/run-tests.py: Add --trace-output option for board targets.#19329

Merged
dpgeorge merged 1 commit into
micropython:masterfrom
dpgeorge:tests-run-tests-add-trace-option
Jun 25, 2026
Merged

tests/run-tests.py: Add --trace-output option for board targets.#19329
dpgeorge merged 1 commit into
micropython:masterfrom
dpgeorge:tests-run-tests-add-trace-option

Conversation

@dpgeorge

Copy link
Copy Markdown
Member

Summary

This adds a new --trace-output option (short-hand -c) to run-tests.py which mimics the same option already in run-multitests.py. Using it, the output from the test running on a board is printed to stdout as it is received.

This allows easier debugging of tests, to see the output in real time. For tests that have complicated run parameters, eg using via-mpy or needing a target wiring script, running them standalone (eg with mpremote) is not possible, so using run-tests.py becomes mandatory, hence the need to easily see the output without having to view the result file separately at the end. It's also useful to watch tests that pass but are long running.

Testing

Tested on PYBD_SF6:

  • running normally, still works
  • running with -c, gives lots of output and everything still passes as before
  • deliberately making a test fail, the results file still has the full output, and the crash is also printed to stdout
  • deliberately making a test lock up the board, the test runner correctly stops after a few tests have failed to enter the raw repl

Generative AI

Not used.

@dpgeorge dpgeorge added the tests Relates to tests/ directory in source label Jun 10, 2026
@dpgeorge dpgeorge force-pushed the tests-run-tests-add-trace-option branch from 6690643 to 907027e Compare June 10, 2026 03:19
@codecov

codecov Bot commented Jun 10, 2026

Copy link
Copy Markdown

@octoprobe-bot

Copy link
Copy Markdown

Octoprobe PR report

Test Tests
passed
Tests
skipped
Tests
xfailed
Tests
failed
Total
Failures

@projectgus projectgus left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Yes, this looks very useful. Should be able to retire at least one shell one-liner from my history!

This adds a new `--trace-output` option to `run-tests.py` which mimics the
same option already in `run-multitests.py`.  Using it, the output from the
test running on a board is printed to stdout as it is received.

This allows easier debugging of tests, to see the output in real time.  For
tests that have complicated run parameters, eg using via-mpy or needing a
target wiring script, running them standalone (eg with `mpremote`) is not
possible, so using `run-tests.py` becomes mandatory, hence the need to
easily see the output without having to view the result file separately at
the end.  It's also useful to watch tests that pass but are long running.

Signed-off-by: Damien George <damien@micropython.org>
@dpgeorge dpgeorge force-pushed the tests-run-tests-add-trace-option branch from 5dd5646 to e62bd41 Compare June 25, 2026 13:35
@dpgeorge dpgeorge merged commit e62bd41 into micropython:master Jun 25, 2026
@dpgeorge dpgeorge deleted the tests-run-tests-add-trace-option branch June 25, 2026 13:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

tests Relates to tests/ directory in source

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants