Skip to content

qemu-arm/qemu-riscv: improve tinytest runner so it doesn't need to generate .exp files on disk - #15609

Closed
dpgeorge wants to merge 4 commits into
micropython:masterfrom
dpgeorge:ports-qemu-simplify-tests-exp
Closed

dpgeorge wants to merge 4 commits into
micropython:masterfrom
dpgeorge:ports-qemu-simplify-tests-exp

Conversation

@dpgeorge

@dpgeorge dpgeorge commented Aug 7, 2024 •

Copy link
Copy Markdown
Member

Summary

The qemu-arm and qemu-riscv ports generate a whole lot of .exp files in the tests/ directory when you run the tests on these ports. This leaves the repo in an unclean state.

This PR improves this situation by:

  • generating the .exp files from within the tools/tinytest-codegen.py script by calling out to Python to run them and collecting the resulting stdout output
  • then putting the output into a big dictionary of results
  • then generating the resulting build/genhdr/tests.h file

This results in a clean repo after running the tests. It also means that run-tests.py no longer needs a special case to handle the allowed tests for qemu-arm/riscv targets.

A bonus of this approach is that it's not much extra work to enable running the tests on qemu-* port using the via .mpy and via native emitter test framework that already exists in run-tests.py.

Note: this PR builds on #15577.

TODO:

  • test zephyr changes

Testing

The qemu-arm tests pass like they did before, but no stray .exp files are generated.

Trade-offs and Alternatives

It's a little slower this way when generating the .exp files but not by much.

An alternative to this approach would be to make the qemu-* ports have a stdio to the outside world for the REPL, then treat the qemu process as a board with a serial port, and run the test suite as it would normally be run for an attached hardware board.

To be used only when `run-tests.py` is imported as a module by another
Python script.

Signed-off-by: Damien George <[email protected]>
TODO:
- test zephyr changes

Signed-off-by: Damien George <[email protected]>
@github-actions

github-actions Bot commented Aug 7, 2024

Copy link
Copy Markdown

Code size report:

   bare-arm:    +0 +0.000% 
minimal x86:    +0 +0.000% 
   unix x64:    +0 +0.000% standard
      stm32:    +0 +0.000% PYBV10
     mimxrt:    +0 +0.000% TEENSY40
        rp2:    +0 +0.000% RPI_PICO_W
       samd:    +0 +0.000% ADAFRUIT_ITSYBITSY_M4_EXPRESS

@codecov

codecov Bot commented Aug 7, 2024

Copy link
Copy Markdown

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 98.43%. Comparing base (afba3e0) to head (e05a67b).
Report is 8 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master   #15609   +/-   ##
=======================================
  Coverage   98.43%   98.43%           
=======================================
  Files         161      161           
  Lines       21281    21281           
=======================================
  Hits        20948    20948           
  Misses        333      333           

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

@dpgeorge

Copy link
Copy Markdown
Member Author

Closing in favour of #15624.

@dpgeorge dpgeorge closed this Aug 12, 2024
@dpgeorge
dpgeorge deleted the ports-qemu-simplify-tests-exp branch August 12, 2024 02:39
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.

1 participant