cmd_test: default WOLFPROV_FORCE_FAIL to 0 in ecc-cmd-test.sh#407
Merged
Conversation
When WOLFPROV_FORCE_FAIL is unset, the unquoted numeric test guarding the force-fail re-run expands to '[ -ne 0 ]', so every ECC key test prints '[: -ne: unary operator expected' to stderr. The condition still evaluates false, so the re-run is correctly skipped and results are unaffected, but the noise looks alarming in test output. Initialize the variable with a default, matching what rsa-cmd-test.sh already does.
aidangarske
approved these changes
Jun 16, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
When
WOLFPROV_FORCE_FAILis unset (the normal case),scripts/cmd_test/ecc-cmd-test.shemits a shell error on every ECC key test:The guard for the force-fail re-run uses an unquoted numeric test:
With the variable unset, this expands to
[ -ne 0 ], producingunary operator expected. The condition still evaluates false, so the re-run is correctly skipped and test results are unaffected (the suite still reports PASS) — but the stderr noise is alarming and can trip CI that treats stderr as failure.Fix
Initialize the variable with a default at the top of the script, matching the pattern
rsa-cmd-test.shalready uses (WOLFPROV_FORCE_FAIL=${WOLFPROV_FORCE_FAIL:-0}). One line; force-fail mode (WOLFPROV_FORCE_FAIL=1) behaves exactly as before.Verification
Reproduced and confirmed fixed end-to-end in a Yocto image build (wolfSSL FIPS + wolfProvider): 12
unary operator expectedlines before, 0 after, with the full command-line suite still PASS. Reported by a customer running the cmd-test suite on-target.