====== Check: A unit test framework for C ======
The Crossfire project specifies that developers shall create and run unit tests built with the check framework. The framework is often not packaged by *nix distributions, but it is not hard to install.
===== Installation =====
If the *nix distribution has the check framework packaged, use the distribution's customary method of adding packages, otherwise, install the tool as follows, or in a suitably similar manner:
- Download the latest tarball from [[http://sourceforge.net/projects/check/files/|SourceForge]]. For example:
$ mkdir -p ~/devel/check
$ cd ~/devel/check
$ wget http://sourceforge.net/projects/check/files/check/0.9.9/check-0.9.9.tar.gz/download
$ mv download check-0.9.9.tar.gz
- Unpack the tarball.
$ tar -xzf check-0.9.9.tar.gz
- Compile the framework.
$ cd check-*
$ ./configure --prefix=/usr/local
$ make
- Install the framework.
$ sudo make install
- As needed, modify the user environment to establish /usr/local/bin in the default run path. In BASH, the following is viable:
if ! which checkmk; then \
echo -e "\nexport PATH=\"\$\{PATH\}:/usr/local/bin\""; \
fi >>~/.bash_profile
. ~/.bash_profile
- As needed, modify the user environment to establish the location of the ''check'' resources. In BASH, following is viable:
if pkg-config --uninstalled check; then \
echo -e "\nexport PKG_CONFIG_PATH=\"\$\{PKG_CONFIG_PATH\}:/usr/local/lib/pkgconfig\""; \
echo -e "export LD_LIBRARY_PATH=\"\$\{LD_LIBRARY_PATH\}:/usr/local/lib\"\n"; \
fi >>~/.bash_profile
. ~/.bash_profile
- As needed, and in lieu of defining a per-user ''LD_LIBRARY_PATH'', the following may be viable for certain operating environments:
if [ -d /etc/ld.so.conf.d ]; then \
sudo echo "/usr/local/lib" >/etc/ld.so.conf.d/check.conf; \
sudo ldconfig -v | grep check; \
fi
===== Verification =====
If the check framework is installed correctly, the server ''./configure'' or ''autogen.sh'' output should include:
configure: Will process unit testing? yes (will generate report)
configure: (run make; make -k check)
configure: