Skip to content

introduce WARNING_OUT, when goto is not a hard error during tests#6945

Merged
JacobBarthelmeh merged 1 commit intowolfSSL:masterfrom
gojimmypi:PR-goto-alternate
Nov 7, 2023
Merged

introduce WARNING_OUT, when goto is not a hard error during tests#6945
JacobBarthelmeh merged 1 commit intowolfSSL:masterfrom
gojimmypi:PR-goto-alternate

Conversation

@gojimmypi
Copy link
Copy Markdown
Contributor

Description

This is a revision of #6923 using a different source branch name as suggested.

Sometimes it may be desired to capture the call stack during test error conditions rather than just error out.

This PR introduces WARNING_OUT that will normally do the same thing as ERROR_OUT, except when an alterative is defined, such as the WOLFSSL_ESPIDF_ERROR_PAUSE for a custom ERROR_OUT handler in the Espressif environment.

Not all uses of the current ERROR_OUT are actually hard errors. Some simply capture expected but undesired results and still handle with the same ret = (err); goto eLabel; logic. The WARNING_OUT is used for situations where we don't actually want to capture a custom call stack with alternate ERROR_OUT code.

Note the ecc_test_curve_size test is one example now using WARNING_OUT instead of ERROR_OUT.

Other custom error-pausing code can easily be added as desired for other environments.

Also included is a variable-initialization for args in wolfcrypt_test_main().

Fixes zd# n/a

Testing

How did you test?

manual testing in Espressif environment.

Confirmation with:

./configure --enable-all && make clean && make && make check

Checklist

  • added tests
  • updated/added doxygen
  • updated appropriate READMEs
  • Updated manual and documentation

@gojimmypi gojimmypi self-assigned this Nov 6, 2023
@dgarske dgarske removed their assignment Nov 6, 2023
@dgarske dgarske removed their request for review November 6, 2023 16:16
Comment thread wolfcrypt/test/test.c Outdated
#define FOURK_BUF 4096

#if defined(WOLFSSL_ESPIDF)
static const char* TAG = "wolfcrypt_test"; /* ESP_LOG() breadcrumb */
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Is this only used when WOLFSSL_ESPIDF_ERROR_PAUSE is defined? If so please move it down into that macro guarded section of code to avoid unused warnings.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

No, it wasn't the only place, but I cleaned up the other one that was hard-coded with "wolfcrypt_test" text.

There will be a separate, future exercise to replace references to printf with the Espressif ESP_LOG.

Copy link
Copy Markdown
Contributor

@JacobBarthelmeh JacobBarthelmeh Nov 7, 2023

Choose a reason for hiding this comment

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

@gojimmypi Sounds good, when replacing the printf's I recommend following the existing XPRINTF override pattern we have for using a custom printf in the tests.

@JacobBarthelmeh JacobBarthelmeh merged commit d751029 into wolfSSL:master Nov 7, 2023
@gojimmypi gojimmypi deleted the PR-goto-alternate branch October 9, 2024 18:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants