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

enhance common_config.py and generate_test_code.py #48

Merged
merged 8 commits into from
Oct 11, 2024

Conversation

valeriosetti
Copy link
Contributor

@valeriosetti valeriosetti commented Sep 23, 2024

  • Extend common_config.py adding get-all and get-all-enabled commands. Both commands use regex expressions to get a list of symbols. The difference between the 2 is that:

    • get-all returns both enabled and commented out symbols while
    • get-all-enabled returns only enabled ones.
  • Enhance generate_test_code.py allowing more complex expressions to be used in depends_on fields of *.data files.

These new features are used in Mbed-TLS/mbedtls#9302 and Mbed-TLS/mbedtls#9448

@gilles-peskine-arm gilles-peskine-arm added needs-review Every commit must be reviewed by at least two team members, needs-reviewer This PR needs someone to pick it up for review priority-high High priority - will be reviewed soon size-xs Estimated task size: extra small (a few hours at most) labels Sep 25, 2024
Copy link
Contributor

@gilles-peskine-arm gilles-peskine-arm left a comment

Choose a reason for hiding this comment

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

LGTM apart from the unnecessary complexity of returning None when given no regex.

scripts/mbedtls_framework/config_common.py Outdated Show resolved Hide resolved
scripts/mbedtls_framework/config_common.py Outdated Show resolved Hide resolved
scripts/mbedtls_framework/config_common.py Outdated Show resolved Hide resolved
@gilles-peskine-arm gilles-peskine-arm added needs-work and removed needs-review Every commit must be reviewed by at least two team members, needs-reviewer This PR needs someone to pick it up for review labels Sep 25, 2024
@valeriosetti valeriosetti added needs-review Every commit must be reviewed by at least two team members, needs-reviewer This PR needs someone to pick it up for review and removed needs-work labels Sep 26, 2024
Copy link
Contributor

@gilles-peskine-arm gilles-peskine-arm left a comment

Choose a reason for hiding this comment

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

LGTM

@valeriosetti valeriosetti changed the title config.py: add get-all and get-all-enabled commands enhance common_config.py and generate_test_code.py Sep 26, 2024
Copy link
Contributor

@gilles-peskine-arm gilles-peskine-arm left a comment

Choose a reason for hiding this comment

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

LGTM except I'd like to keep rejecting 0123 literals in dependencies.

scripts/generate_test_code.py Outdated Show resolved Hide resolved
scripts/generate_test_code.py Show resolved Hide resolved
@gilles-peskine-arm gilles-peskine-arm added needs-work and removed needs-review Every commit must be reviewed by at least two team members, labels Oct 3, 2024
@valeriosetti valeriosetti added needs-review Every commit must be reviewed by at least two team members, and removed needs-work labels Oct 4, 2024
@gilles-peskine-arm gilles-peskine-arm removed the needs-reviewer This PR needs someone to pick it up for review label Oct 4, 2024
Copy link
Contributor

@gilles-peskine-arm gilles-peskine-arm left a comment

Choose a reason for hiding this comment

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

LGTM

Both commands use regex expressions to get a list of symbols.
The difference between the 2 is that:

- get-all returns both enabled and commented out symbols while
- get-all-enabled returns only enabled ones.

Signed-off-by: Valerio Setti <vsetti@baylibre.com>
Signed-off-by: Valerio Setti <vsetti@baylibre.com>
Signed-off-by: Valerio Setti <vsetti@baylibre.com>
In case of depends_on elements that include a conditional check
on some symbol's value, we allow the comparison element to
be anything and not just a fixed value as it was before.
This allows for more complex depends_on conditions where
build symbols and macros are used on both sides of the comparison.

Signed-off-by: Valerio Setti <vsetti@baylibre.com>
Do not allow values starting with a 0 because they can be either
accidentally octal or accidentally decimal. Hex values are not
affected by this change.

Signed-off-by: Valerio Setti <vsetti@baylibre.com>
Signed-off-by: Valerio Setti <vsetti@baylibre.com>
Signed-off-by: Valerio Setti <vsetti@baylibre.com>
@valeriosetti
Copy link
Contributor Author

@bensze01 sorry to bother you, but this PR is gating the merge of Mbed-TLS/mbedtls#9302 and Mbed-TLS/mbedtls#9448. Can you please take a look at it when you have some spare review bandwidth?

Copy link
Contributor

@bensze01 bensze01 left a comment

Choose a reason for hiding this comment

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

Small nit, otherwise looks good to me.

scripts/generate_test_code.py Outdated Show resolved Hide resolved
@bensze01 bensze01 added needs-work and removed needs-review Every commit must be reviewed by at least two team members, labels Oct 11, 2024
"\w" already matches "[a-zA-Z0-9_]" so CONDITION_VALUE_REGEX
can be simplified as proposed in this commit.

Signed-off-by: Valerio Setti <vsetti@baylibre.com>
@valeriosetti valeriosetti added needs-review Every commit must be reviewed by at least two team members, and removed needs-work labels Oct 11, 2024
Copy link
Contributor

@gilles-peskine-arm gilles-peskine-arm left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Contributor

@bensze01 bensze01 left a comment

Choose a reason for hiding this comment

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

LGTM!

@bensze01 bensze01 merged commit d9a70c7 into Mbed-TLS:main Oct 11, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs-review Every commit must be reviewed by at least two team members, priority-high High priority - will be reviewed soon size-xs Estimated task size: extra small (a few hours at most)
Projects
Development

Successfully merging this pull request may close these issues.

3 participants