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

[microTVM] Replace static fixtures with parameterization #12530

Merged
merged 6 commits into from
Aug 23, 2022

Conversation

guberti
Copy link
Member

@guberti guberti commented Aug 22, 2022

#12207 went a long way to improving microTVM code reuse, but introduced an unintentional? change. Previously, the full pytest names of microTVM tests included the value of board, prepended to any paremeterization. For example, test_rpc_large_array would have the name:

tests.micro.zephyr.test_zephyr.test_rpc_large_array[nucleo_f746zg-(4*1024)]

This behavior was useful, as it meant that exported Junit XML files would correctly record which board the test was run on. However, after #12207 the names of tests stopped including this information:

tests.micro.zephyr.test_zephyr.test_rpc_large_array[(4*1024)]

This prevented Junit from differentiating between the tests when they were run on different boards, and instead just overwrote results on previous boards. Additionally, we never made this distinction for common tests that were parameterized by platform, so tests like tests.micro.common.test_autotune.test_kws_autotune_workflow would have one of the platforms overwrite the other (with whichever one finished last being the one that was ultimately reported).


This PR uses the pytest_generate_tests hook to fix this issue. Now, the board parameter is included in the test name as before, and the platform parameter will be included for any tests that use that fixture (e.g. common tests).

cc @alanmacd @gromero @mehrdadh

Copy link
Member

@mehrdadh mehrdadh left a comment

Choose a reason for hiding this comment

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

@guberti I like this change, thanks for fixing this!



def pytest_addoption(parser):
"""Adds more pytest arguments"""
parser.addoption(
Copy link
Member

Choose a reason for hiding this comment

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

doesn't this force every test to have --platform as an argument? In that case we don't want this for tests that are specific to Zephyr/Arduino

Copy link
Member Author

@guberti guberti Aug 22, 2022

Choose a reason for hiding this comment

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

Nope! Only tests that include the platform fixture will require the --platform argument, and likewise for board. This is done by the if argument in metafunc.fixturenames line.

Copy link
Member

Choose a reason for hiding this comment

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

cool, thanks for clarification!

@mehrdadh mehrdadh merged commit 58f2139 into apache:main Aug 23, 2022
xinetzone pushed a commit to daobook/tvm that referenced this pull request Nov 25, 2022
* Replace microTVM static fixtures with parameterization

* [microTVM] Only perform parameterization when fixture is present

* Reformat with black

* Fix Cortex-M tests

* Add docstring to pytest_generate_tests

* Remove trailing space from docstring
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.

2 participants