Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tools/tinytest-codegen: Ensure consistent tests order. #12906

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

agatti
Copy link
Contributor

@agatti agatti commented Nov 7, 2023

Make sure the the generated header file contains tests appearing in a predictable order, conforming to tests/run-tests.py's behaviour.

Suggested in #12853 (comment).

Make sure the the generated header file contains tests appearing in a
predictable order, conforming to `tests/run-tests.py`'s behaviour.

Signed-off-by: Alessandro Gatti <a.gatti@frob.it>
Copy link

github-actions bot commented Nov 7, 2023

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
       samd:    +0 +0.000% ADAFRUIT_ITSYBITSY_M4_EXPRESS

Copy link

codecov bot commented Nov 7, 2023

Codecov Report

Merging #12906 (91bf884) into master (958c6d9) will not change coverage.
The diff coverage is n/a.

@@           Coverage Diff           @@
##           master   #12906   +/-   ##
=======================================
  Coverage   98.39%   98.39%           
=======================================
  Files         158      158           
  Lines       20972    20972           
=======================================
  Hits        20636    20636           
  Misses        336      336           

for group in sorted(test_dirs):
tests += [
test for test in sorted(glob("{}/*.py".format(group))) if test not in exclude_tests
]
Copy link
Member

Choose a reason for hiding this comment

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

Wouldn't it be a lot simpler to just do tests.sort() after this for loop? Then there's no need to flatten anything.

Copy link
Member

Choose a reason for hiding this comment

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

@agatti any thought about using sort() to keep this simple?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Apologies for the delay, this fell off my radar. The reason for the list flattening was to prevent potential user error, as it was not obvious the tests exclusion list is a set and not an array of sorts.

If that's not a concern I can sort the final list without pre-flattening the input as you suggest.

@dpgeorge dpgeorge added the tools label Nov 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants