Skip to content

tests: use stdin/stdout when compiling using mpy-cross, instead of temporary files#19216

Open
dpgeorge wants to merge 3 commits into
micropython:masterfrom
dpgeorge:tests-use-mpy-cross-stdin-stdout
Open

tests: use stdin/stdout when compiling using mpy-cross, instead of temporary files#19216
dpgeorge wants to merge 3 commits into
micropython:masterfrom
dpgeorge:tests-use-mpy-cross-stdin-stdout

Conversation

@dpgeorge
Copy link
Copy Markdown
Member

Summary

This change pipes data into and out of mpy-cross using stdin/stdout, instead of creating two temporary files. That should be more efficient, reducing load on the filesystem.

As part of this change, pass through the correct .py filename to mpy-cross' "-s" argument, to make error messages a little easier to understand.

Also fix a related bug with missing prologue in run-perfbench.py that was found when testing this change.

Testing

Ran on a bare-metal target, using --via-mpy and --via-mpy --emit native. The tests still run.

Also tested the cases of mpy-cross crashing due to invalid arguments passed into it, and due to a syntax error in a .py file.

Generative AI

I did not use generative AI tools when creating this PR.

dpgeorge added 3 commits May 13, 2026 13:26
Otherwise running performance tests with `--via-mpy` does not work.

Signed-off-by: Damien George <damien@micropython.org>
Signed-off-by: Damien George <damien@micropython.org>
This change pipes data into and out of mpy-cross using stdin/stdout,
instead of creating two temporary files.  That should be more efficient,
reducing load on the filesystem.

As part of this change, pass through the correct .py filename to mpy-cross'
"-s" argument, to make error messages a little easier to understand.

Signed-off-by: Damien George <damien@micropython.org>
@dpgeorge dpgeorge added the tests Relates to tests/ directory in source label May 13, 2026
@codecov
Copy link
Copy Markdown

codecov Bot commented May 13, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 98.47%. Comparing base (936596c) to head (74d330b).

Additional details and impacted files
@@           Coverage Diff           @@
##           master   #19216   +/-   ##
=======================================
  Coverage   98.47%   98.47%           
=======================================
  Files         176      176           
  Lines       22845    22845           
=======================================
  Hits        22497    22497           
  Misses        348      348           

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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.

1 participant