Skip to content

cmd_test: default WOLFPROV_FORCE_FAIL to 0 in ecc-cmd-test.sh#407

Merged
aidangarske merged 1 commit into
wolfSSL:masterfrom
ColtonWilley:fix-ecc-cmd-test-wpff
Jun 16, 2026
Merged

cmd_test: default WOLFPROV_FORCE_FAIL to 0 in ecc-cmd-test.sh#407
aidangarske merged 1 commit into
wolfSSL:masterfrom
ColtonWilley:fix-ecc-cmd-test-wpff

Conversation

@ColtonWilley

Copy link
Copy Markdown
Contributor

Problem

When WOLFPROV_FORCE_FAIL is unset (the normal case), scripts/cmd_test/ecc-cmd-test.sh emits a shell error on every ECC key test:

[PASS] libwolfprov can use ECC key (prime256v1)
ecc-cmd-test.sh: line 259: [: -ne: unary operator expected

The guard for the force-fail re-run uses an unquoted numeric test:

if [ $WOLFPROV_FORCE_FAIL -ne 0 ]; then

With the variable unset, this expands to [ -ne 0 ], producing unary 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.sh already 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 expected lines before, 0 after, with the full command-line suite still PASS. Reported by a customer running the cmd-test suite on-target.

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 aidangarske merged commit 07f56fd into wolfSSL:master Jun 16, 2026
55 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants