Skip to content

Generate the test certificates once under parallel make - #188

Merged
danielinux merged 1 commit into
wolfSSL:masterfrom
Frauschi:mkcerts-parallel-race
Oct 16, 2026
Merged

danielinux merged 1 commit into
wolfSSL:masterfrom
Frauschi:mkcerts-parallel-race

Conversation

@Frauschi

@Frauschi Frauschi commented Oct 16, 2026 •

Copy link
Copy Markdown
Member

build/certs/ca_cert.c, server_key.c and server_cert.c each had their own rule running tools/certs/mkcerts.sh, which rewrites all of the cert files. Under make -j the three rules run at once and overwrite each other's output, so server_cert.c can end up without server_der and build/test-wolfssl fails to link. wolfSSL's cross-library CI hits this intermittently on several unrelated PRs.

The three files are now targets of a single pattern rule, which make runs as one recipe, so mkcerts.sh runs once and a missing file still triggers it. The files are also named as plain targets so make does not treat them as intermediates: they survive the build and a deleted one is regenerated.

Copilot AI left a comment

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.

🟡 Changes recommended

.SECONDARY prevents missing certificate sources from being regenerated when their objects already exist.

1 open finding
What changed in this PR

This PR consolidates test certificate generation to prevent concurrent writes and intermittent wolfSSL test link failures under parallel make.

Changes:

  • Replaces three recipes with one multi-target pattern rule.
  • Adds .SECONDARY to retain generated certificate sources.
File Description
Makefile Consolidates certificate generation and adjusts generated-source retention.

🧠 Review effort: Balanced


💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread Makefile Outdated
ca_cert.c, server_key.c and server_cert.c each had their own rule
running tools/certs/mkcerts.sh, and the script rewrites all of the cert
files. With make -j the three rules run at the same time, overwrite
each other's keys and certificates, and can leave server_cert.c without
server_der, so build/test-wolfssl fails to link with an undefined
reference to server_der. wolfSSL's cross-library CI hits this
intermittently.

One pattern rule now names all three files as targets, which GNU make
treats as a single recipe that writes all of them, so mkcerts.sh runs
once under -j. The files are also named as plain targets so make does
not treat them as intermediates: they survive the build and a deleted
one is regenerated.
@Frauschi
Frauschi force-pushed the mkcerts-parallel-race branch from 2769dc2 to a8c3955 Compare October 16, 2026 09:02
@danielinux
danielinux merged commit 4c6fea5 into wolfSSL:master Oct 16, 2026
35 checks passed
@Frauschi
Frauschi deleted the mkcerts-parallel-race branch October 16, 2026 13:13
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.

3 participants