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

[idf] Support Skip Marker for ESP-IDF Soc Caps (RDT-1055) #326

Open
hfudev opened this issue Dec 20, 2024 · 5 comments · May be fixed by #327
Open

[idf] Support Skip Marker for ESP-IDF Soc Caps (RDT-1055) #326

hfudev opened this issue Dec 20, 2024 · 5 comments · May be fixed by #327
Assignees
Labels
enhancement New feature or request

Comments

@hfudev
Copy link
Member

hfudev commented Dec 20, 2024

Soc Caps defines hardware capabilities or ESP-IDF apps.

Ideal Use Case

1. Basic

Support a marker, like

@pytest.mark.skip_if_soc("SOC_ADC_SAMPLE_FREQ_THRES_HIGH == 20000")

Iterate through all supported targets, if the expression is false, then we skip running the test case for this target.

2. Preview Targets

Support iterating through preview targets as well, by

@pytest.mark.skip_if_soc(
    "SOC_ADC_SAMPLE_FREQ_THRES_HIGH == 20000",
    include_preview_targets=True
)

Here we shall iterate over SUPPORTED_TARGETS + PREVIEW_TARGETS

3. Limited Targets

Or iterate over a subset of targets, if user specified targets as param, like

@pytest.mark.skip_if_soc("SOC_ADC_SAMPLE_FREQ_THRES_HIGH == 20000")
@pytest.mark.parametrization('target', ['esp32', 'esp32s2'], indirect=True)
def test_foo():
    pass

here shall only iterate over esp32 and esp32s2

Implementation Details

  • the parsing soc caps part could be done by idf_build_apps.manifest.if_parser
  • the skip test case part shall be done in the pytest hook function pytest_collection_modifyitems
  • idf-build-apps shall be added as a dependency for pytest-embedded-idf
  • SUPPORTED_TARGETS and PREVIEW_TARGETS could be loaded from idf_build_apps. These values are lazy loaded from IDF_PATH.
  • Make sure everything is lazy-loaded, otherwise it would break user without IDF_PATH.
@hfudev hfudev added the enhancement New feature or request label Dec 20, 2024
@hfudev hfudev changed the title [**idf**] Support Skip Marker for ESP-IDF Soc Caps [idf] Support Skip Marker for ESP-IDF Soc Caps Dec 20, 2024
@github-actions github-actions bot changed the title [idf] Support Skip Marker for ESP-IDF Soc Caps [idf] Support Skip Marker for ESP-IDF Soc Caps (RDT-1055) Dec 20, 2024
@horw
Copy link
Member

horw commented Dec 20, 2024

@hfudev Hi, I can do it, WDYT?

@horw
Copy link
Member

horw commented Dec 22, 2024

Should we also support the and syntax?
There are two possible variants:

@pytest.mark.custom_skip(
    ("SOC_ADC_SAMPLE_FREQ_THRES_HIGH == 20000", "SUPPORT_A_FEATURE == 1"),
    "SOC_ADC_SAMPLE_FREQ_THRES_HIGH == 10000",
    include_preview_targets=True
)
@pytest.mark.custom_skip(
    "SOC_ADC_SAMPLE_FREQ_THRES_HIGH == 20000 and SUPPORT_A_FEATURE == 1",
    "SOC_ADC_SAMPLE_FREQ_THRES_HIGH == 10000",
    include_preview_targets=True
)

@hfudev
Copy link
Member Author

hfudev commented Dec 22, 2024

@horw sure. the idf-build-apps if-clause supports and or that we may reuse.

@horw horw linked a pull request Dec 23, 2024 that will close this issue
6 tasks
@horw
Copy link
Member

horw commented Dec 23, 2024

The easiest part was 3. Limited Targets because we can associate our pytest item with the target. However, for 1. Basic and 2. Preview Targets, it’s trickier because we don’t know which target it is associated with. So, maybe we should do this only for tests with a target in the parametrize?

@hfudev
Copy link
Member Author

hfudev commented Dec 23, 2024

sure it makes sense

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants