Skip to content

Log build steps in the outcome file #129

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

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

gilles-peskine-arm
Copy link
Contributor

@gilles-peskine-arm gilles-peskine-arm commented Jan 24, 2025

Add some logging to the output file:

  • make invocation (including CMake-driven builds): "${MBEDTLS_TEST_PLATFORM};${MBEDTLS_TEST_CONFIGURATION};${TOOL};${target};${result};${cause}"
  • for each component: "${MBEDTLS_TEST_PLATFORM};${component_name};all.sh;${component_name};${result};"

Extracted from Mbed-TLS/mbedtls#9286.

This is supposed to be transparent for a consuming branch, so we can merge it at our leisure.

Needs preceding PR: Mbed-TLS/mbedtls#9932 and Mbed-TLS/mbedtls#9933 to get the CI to pass.

Follow-up: Mbed-TLS/mbedtls#9934

PR checklist

Please add the numbers (or links) of the associated pull requests for consuming branches. You can omit branches where this pull request is not needed.

  • crypto PR not needed
  • development PR not needed
  • 3.6 PR not needed
  • 2.28 PR no: we won't bother to backport this to a branch that's almost out of support.

Add an outcome line when all.sh calls make.

Signed-off-by: Gilles Peskine <[email protected]>
Some versions on CMake (on some platforms?) run make (not $(MAKE)) under the
hood on targets named cmTC_* (CMake TryCompile). Ignore those calls.

Signed-off-by: Gilles Peskine <[email protected]>
This should make failures.csv on the CI be a complete list of failures
(although it will still have incomplete information on what has failed, if
what failed wasn't tracked individually).

Signed-off-by: Gilles Peskine <[email protected]>
This comes up in `psa_collect_statuses.py` and possibly (I didn't finish the
analysis) some CMake builds, which were reporting duplicate `make` steps.

Signed-off-by: Gilles Peskine <[email protected]>
When emitting a line for the outcome file for `make`, indicate if the target
is being built in a different directory or with a different makefile.

We don't currently do this explicitly with an ambiguous target name, but it
happens under the hood with older versions of CMake (observed with CMake
3.10.2, not with CMake 3.22.1).

Signed-off-by: Gilles Peskine <[email protected]>
@gilles-peskine-arm gilles-peskine-arm added needs-ci Needs to pass CI tests size-s Estimated task size: small (~2d) priority-medium Medium priority - this can be reviewed as time permits labels Jan 24, 2025
gilles-peskine-arm added a commit to gilles-peskine-arm/mbedtls that referenced this pull request Jan 25, 2025
Align the build in component_test_tfm_config_no_p256m with its
corresponding non-driver build test_tfm_config_p256m_driver_accel_ec.
There didn't seem to be a reason not to build programs, and
Mbed-TLS/mbedtls-framework#129 would cause the
discrepancy to be reported as a failure in outcome analysis.

Signed-off-by: Gilles Peskine <[email protected]>
gilles-peskine-arm added a commit to gilles-peskine-arm/mbedtls that referenced this pull request Jan 25, 2025
Align the build in component_test_tfm_config_no_p256m with its
corresponding non-driver build test_tfm_config_p256m_driver_accel_ec.
There didn't seem to be a reason not to build programs, and
Mbed-TLS/mbedtls-framework#129 would cause the
discrepancy to be reported as a failure in outcome analysis.

Signed-off-by: Gilles Peskine <[email protected]>
@gilles-peskine-arm gilles-peskine-arm added needs-review Every commit must be reviewed by at least two team members, needs-preceding-pr Requires another PR to be merged first needs-reviewer This PR needs someone to pick it up for review and removed needs-ci Needs to pass CI tests labels Jan 25, 2025
`platform;component_xxx;all.sh;whole;PASS;` could be misleading: it might
look like “whole” means the whole of `all.sh`. Change this to
`platform;component_xxx;all.sh;component_xxx;PASS;`.

Signed-off-by: Gilles Peskine <[email protected]>
Copy link
Contributor

@minosgalanakis minosgalanakis left a comment

Choose a reason for hiding this comment

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

Some review comments at this stage, nothing major.

@@ -75,5 +75,6 @@ else
rm "${TMPFILE}"

# Propagate the exit status
exit $EXIT_STATUS
set_status () { return $1; }
set_status $EXIT_STATUS
Copy link
Contributor

Choose a reason for hiding this comment

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

Why the indirection?

If we want to preserve the status, could't we just return "EXIT_STATUS" ? What am I missing?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

make includes (“sources”) quiet.sh with the . command. Calling exit inside quiet.sh would exit the whole program. This was ok until now because make didn't want to do anything else in this case. But now make wants to run additional logging code. So we have to return from quiet.sh, and communicate the status.

Note that in sh, there is no language feature to return early from a sub-script sourced with the . command. In ksh, bash and zsh, you can do it with the return builtin, but that extension is not available in a basic sh shell such as dash.

fi
case "$target" in
"clean"|"neat") continue;; # Boring
cmTC_*) continue;; # Weirdness from CMake
Copy link
Contributor

Choose a reason for hiding this comment

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

Those are temporary target files that will be cleaned up. So the logic is sound. It is not obscure but standard even though unfortunately undocumented behavior from cmake. ;(

return;;
--assume-new|--assume-old|--directory|--file| \
--directory=*|--file=*|-C?*|-f?*) # Modifier option with its argument
Copy link
Contributor

Choose a reason for hiding this comment

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

Why are both "--directory=somedir" and "--directory somedir" required?

For example would passing "--directory" and nothing else assert skip=1?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

With --directory=..., we want to remember the option and move on to the next argument which is another option or a non-option argument. With --directory, we want to skip the next argument, which is the argument of the --directory option.

make --directory is invalid. I don't know what the code here does in this case, but I don't think this wrapper needs to care about invalid usage of make.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs-preceding-pr Requires another PR to be merged first 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-medium Medium priority - this can be reviewed as time permits size-s Estimated task size: small (~2d)
Projects
Status: In Development
Development

Successfully merging this pull request may close these issues.

2 participants