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

tests: Add options. #6916

Merged
merged 14 commits into from
Jul 15, 2022
Merged

tests: Add options. #6916

merged 14 commits into from
Jul 15, 2022

Conversation

Ouss4
Copy link
Contributor

@Ouss4 Ouss4 commented Jun 27, 2022

Description of Change

Add multiple options to the test scripts.

  1. Add command line options for flash mode and parts of the FQBN (others or any required argument can be added in the future).
  2. Add a way to have multiple FQBNs per test. The FQBNs are stored in a JSON file. The test will be built and run for every FQBN.
  3. Option to erase the flash before programming. This is very hacky and shouldn't be here. For one, in the CI, it will always erase the flash. Locally one can omit the -e option. Second, this belongs to pytest-embedded, and should be added there, tests that require to erase the flash will be parameterized something like:
@pytest.mark.parametrize(
  'erase_flash'=[True], indirect=True,
)
def test_hello_world()
   ...

There is a function already that does this but it's not public and only part of the IDF service. This needs to be generic.

These options can be used as:

  1. No options at all. This is a compatible behavior with what we already have. In this case a default FQBN will be used.
  2. Pass options through the command line, like -fm dio; here the FQBN will be constructed from these options.
  3. For tests where multiple FQBNs are required for one chip, the config file can be used. Each element in the fqbn array will have a corresponding build.

Tests scenarios

Locally with the provided scripts.
CI will test the rest.

Related links

#6885
Closes #6884

@Ouss4 Ouss4 force-pushed the args branch 4 times, most recently from d7b077e to 011a52c Compare June 27, 2022 16:00
@Ouss4 Ouss4 added the hil_test Run Hardware Tests label Jun 27, 2022
@Ouss4
Copy link
Contributor Author

Ouss4 commented Jun 27, 2022

S3 builds are failing with:

Building hello_world with FQBN=espressif:esp32:esp32s3:FlashMode=qio,FlashFreq=80,FlashSize=4M,PartitionScheme=huge_app
Error resolving FQBN: getting build properties for board espressif:esp32:esp32s3: invalid option 'FlashFreq'

Why doesn't S3 have a FlashFreq option? I see in https://github.com/espressif/arduino-esp32/blob/master/boards.txt that it's the only chip without. Is there a reason for that?

(This doesn't fail on the on-push workflow because there we pass a fixed FQBN that does not contain FlashFreq.)

@me-no-dev
Copy link
Member

Why doesn't S3 have a FlashFreq option? I see in https://github.com/espressif/arduino-esp32/blob/master/boards.txt that it's the only chip without. Is there a reason for that?

Yes there is a reason and future chips will probably be the same. We used to have way too many options available and too many cases to cover (8 bootloaders + some different libs for each chip). With OPI and 120MHz as options, that would have brought even more bootloaders, etc. So for S3 we go simple. See here

@Ouss4
Copy link
Contributor Author

Ouss4 commented Jun 27, 2022

So for S3 we go simple. See #6885 (comment)

Simple is better, however what's the plan for older chips? Is there any plans to drop the extra options and combine flash mode and frequency or S3 is gonna stay as a special case for now?

It's simple to just #ifdef S3 the difference now, but it would be better to have something generic.

@me-no-dev
Copy link
Member

So for S3 we go simple. See #6885 (comment)

Simple is better, however what's the plan for older chips? Is there any plans to drop the extra options and combine flash mode and frequency or S3 is gonna stay as a special case for now?

Future chips, I hope, will be like S3. For C3 and S2 we can probably go more or less the same, except OPI and 120MHz, but on ESP32 situation is different and I have boards that run on dout, dio and qio (different freqs as well) so for that chip, things must stay as they are

;;
esac

partition="PartitionScheme=$partition_opt"
Copy link
Member

Choose a reason for hiding this comment

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

I will suggest to extract the option names also from some argument. We should not be limited by these options, nor we should need to change them if we adjust the options in Arduino's configs. We can have the default FQBNs defined somewhere, if special is needed, then JSON should be provided.

Copy link
Contributor Author

@Ouss4 Ouss4 Jun 28, 2022

Choose a reason for hiding this comment

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

I only added the basics that (I thought) will be present in all chips. For further customization one can pass a whole FQBN, this is not very different from passing options with their names. It can save some typing if we extended options to the common parts, for instance for S3 the FQBN will start with espressif:esp32:esp32s3: and then we extend it with ./tests_build.sh -t esp32s3 -a "FlashMode=qio120,PartitionScheme=huge_app, the resulting FQBN will be espressif:esp32:esp32s3:FlashMode=qio120,PartitionScheme=huge_app

Copy link
Contributor Author

Choose a reason for hiding this comment

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

In this case those flash options are useless and cumbersome, I can just remove them.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

In this case those flash options are useless and cumbersome, I can just remove them.

I did so.

@Ouss4 Ouss4 force-pushed the args branch 2 times, most recently from 577e88b to bf9d239 Compare June 28, 2022 11:29
@github-actions
Copy link
Contributor

github-actions bot commented Jun 28, 2022

Unit Test Results

15 files  15 suites   2m 10s ⏱️
  7 tests   7 ✔️ 0 💤 0
24 runs  24 ✔️ 0 💤 0

Results for commit 05c07ee.

♻️ This comment has been updated with latest results.

@VojtechBartoska
Copy link
Contributor

@Ouss4 can this be merged? Thanks!

@Ouss4
Copy link
Contributor Author

Ouss4 commented Jul 13, 2022

@Ouss4 can this be merged? Thanks!

From my side yes, unless someone else has any concerns or new idea to add.

@VojtechBartoska
Copy link
Contributor

@SuGlider & @P-R-O-C-H-Y Please help with reviews and we can proceed to merging.

@SuGlider
Copy link
Collaborator

LGTM

Ouss4 added 13 commits July 14, 2022 15:49
…s in case a customization is required.

Signed-off-by: Abdelatif Guettouche <abdelatif.guettouche@espressif.com>
Signed-off-by: Abdelatif Guettouche <abdelatif.guettouche@espressif.com>
Signed-off-by: Abdelatif Guettouche <abdelatif.guettouche@espressif.com>
Signed-off-by: Abdelatif Guettouche <abdelatif.guettouche@espressif.com>
configurations.

Signed-off-by: Abdelatif Guettouche <abdelatif.guettouche@espressif.com>
Signed-off-by: Abdelatif Guettouche <abdelatif.guettouche@espressif.com>
script.

Multiple arguments and options were not set correctly.

Signed-off-by: Abdelatif Guettouche <abdelatif.guettouche@espressif.com>
Signed-off-by: Abdelatif Guettouche <abdelatif.guettouche@espressif.com>
with only one option take is supposed to take any extra FQBN addition.

Signed-off-by: Abdelatif Guettouche <abdelatif.guettouche@espressif.com>
Signed-off-by: Abdelatif Guettouche <abdelatif.guettouche@espressif.com>
Signed-off-by: Abdelatif Guettouche <abdelatif.guettouche@espressif.com>
Signed-off-by: Abdelatif Guettouche <abdelatif.guettouche@espressif.com>
up.

Signed-off-by: Abdelatif Guettouche <abdelatif.guettouche@espressif.com>
@Ouss4
Copy link
Contributor Author

Ouss4 commented Jul 14, 2022

Looks like the branch was rebased using the Web UI which added a merge commit. Last force push was just to remove it.

@SuGlider
Copy link
Collaborator

Looks like the branch was rebased using the Web UI which added a merge commit. Last force push was just to remove it.

Sorry @Ouss4, my bad. Can you fix it back?

@Ouss4
Copy link
Contributor Author

Ouss4 commented Jul 14, 2022

Looks like the branch was rebased using the Web UI which added a merge commit. Last force push was just to remove it.

Sorry @Ouss4, my bad. Can you fix it back?

No problem, I already did. :)

Copy link
Member

@P-R-O-C-H-Y P-R-O-C-H-Y left a comment

Choose a reason for hiding this comment

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

Lets merge it :)

@VojtechBartoska
Copy link
Contributor

VojtechBartoska commented Jul 15, 2022

I promise last question before a merging :)

@Ouss4 There is bunch of commits, do you want to keep a history and maybe clean it a bit or can it be squashed into 1 commit?

@Ouss4
Copy link
Contributor Author

Ouss4 commented Jul 15, 2022

Usually, I keep separate logical changes in different commits, but the workflow here was to squash merge everything from the UI, so I may not have payed a lot of attention to the history. Feel free to squash merge everything in one commit.

@P-R-O-C-H-Y P-R-O-C-H-Y merged commit 4431582 into espressif:master Jul 15, 2022
@Ouss4 Ouss4 deleted the args branch July 16, 2022 09:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Development

Successfully merging this pull request may close these issues.

C3 + S3 Flash - CI test
5 participants