I have a use case here which I think needs some custom changes that would normally be run by extra_scripts
, but aren’t currently working because these aren’t ran as part of pio test
.
I have these 4 environments;
* esp32s3 (arduino only)
* exp32s3-idf (arduino+IDF, extends esp32s3)
* esp32s3-doctest (test environment using custom runner based on the doctest runner, extends esp32s3)
* esp32s3-idf-doctest (extends esp32-idf)
The IDF build makes use of IDF-specific features, which are controlled by conditional defines. (e.g. ULP_ENABLED.) Since there’s more in common between the environments than what distinguishes them, I’m extending from the base esp32s3 environment.
What I wanted to achieve is that ULP_ENABLED
is defined in the build flags, set to 0 for arduino builds and tests, but set to 1 for IDF builds and tests.
My first attempt was to define
[env:esp32s3]
custom_ulp_enabled = 0
build_flags =. .... -DULP_ENABLED=${this.custom_ulp_enabled}
[env:esp32s3-idf]
custom_ulp_enabled = 1
But this didn’t work as I expected, since I imagine the build flags are interpolated before they are used in the final environment?
I then turned to using an extra script to add this build flag, but found that the scripts are not run for pio test
.
How about adding a test_extra_scripts
for adding scripts to tests? Or perhaps a flag that says that the usual extra scripts are ran as part of running tests?
Of course, I could just make the environment changes in my custom test runner, so this isn’t a blocker. If adding test_extra_scripts
sounds like a good idea, please let me know and I’ll submit a PR.
EDIT: I resolved the issue I was having by factoring out an esp32-base
environment, which doesn’t include the ULP_ENABLED
build flag. This is then set as needed in the esp32s3 and esp32s3-idf environments. Even so, I’m still interested in running custom scripts during tests, for external test setup/teardown.