cunit-testingautotools

How to go about adding unit tests to an established (autotools) C project


I have a fork of openssh with some new features and want to write some unit tests to make sure they work at build. Grafting Check into openssh's autotools configuration is diffacult (because I don't really understand autotools)

Is there an easier to use C unit test framework? One less closely tied to autotools? How about a better way of going about adding Check to this project with out radically changing its build files?


Solution

  • It might not be a good idea to move away from autotools if the objective is to integrate those new features in the main branch. This SO question is pointing to several tutorials for autotools that could be helpful.

    Otherwise, there are several unit framework available for C: the most notorious are Cunit, Check, minunit, CMockery, refer to this question or this list.