Skip to content

Spike: replace libtap with cmocka - #492

Draft
oschwald wants to merge 1 commit into
mainfrom
greg/stf-1731
Draft

oschwald wants to merge 1 commit into
mainfrom
greg/stf-1731

Conversation

@oschwald

Copy link
Copy Markdown
Member

The bundled libtap dependency is unmaintained and has caused build problems with project compiler flags. This spike replaces it with cmocka to evaluate the migration and its failure output.

The changes convert the C tests, remove the libtap submodule, and add cmocka discovery to Autotools and CMake. CMake can fetch cmocka when it is absent. CI dependency setup includes a source build for 32-bit jobs. The four Perl test scripts remain.

This is an exploratory draft. The framework choice is still open, including a small set of internal helpers, Unity, or utest.h.

Known limitations:

  • Native 128-bit comparisons use integer assertions that truncate values and can incorrectly pass.
  • Assertion wrappers evaluate operands twice, including allocation calls. This can conceal failures.
  • CMake accepts older cmocka packages but requires the namespaced target introduced in 2.0.
  • Boolean assertions omit actual values. Large test cases lose context and stop at their first failure.
  • Replacing the Perl tests still needs evaluation.

Validation: a fresh Linux CMake build with the installed cmocka passed all 29 CTest tests. git diff --check HEAD passed. The current Autotools and cross-platform CI changes have not been validated locally. Passing tests do not resolve the known assertion defects above.

Related: STF-1731, formerly ENG-5416.

@coderabbitai

coderabbitai Bot commented Sep 15, 2026

Copy link
Copy Markdown

Important

Draft PR not reviewed

Draft PRs are not automatically reviewed by default.

  • Trigger a manual review

To automatically review draft PRs, update your CodeRabbit configuration:

reviews:
  auto_review:
    drafts: true

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@oschwald

oschwald commented Sep 15, 2026

Copy link
Copy Markdown
Member Author

After trying this out, I think my temptation is to just replace libtap with a small internal helper. Other options to consider are:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant