Posts

Showing posts with the label cmocka

Test Anything Protocol (TAP) with autotools and cmocka

Image
Autotoole can handle test suits of several types. Usually, I store my tests in "test" directory in the root of the project and set up each test in "Makefile.am" file. Each test to run is a separate executable file listed in "TEST" variable in makefile. For example: TESTS = foo_test bar_test xyz_test

Using Ragel to implement TFTP protocol client

Image
This blog is about how to implement TFTP protocol (RFC1350) with ragel. Ragel is a very powerful State Machine compiler, perfect for text parsing. One of the tasks where ragel can be used for is "Writing robust protocol implementations". More detailed information about ragel can be found here:  http://www.colm.net/open-source/ragel . Indeed, there are projects which successfully use ragel to parse network protocol packets: Mongrel , the web-server developed by Zed Shaw. Mongrel and its derivatives (like Thin) are using ragel to parse HTTP protocol. OverSIP , SIP proxy developed by IƱaki Baz Castillo and using ragel to parse SIP protocol. Both HTTP and SIP are text based protocols. There are many articles and blogs that explain how to parse text with ragel. TFTP is a bit different and I thought it would be fun to try implement this protocol with ragel.

C project IDE and skeleton [part 2]: vim, autotools, ctags, cmocka, lcov, dejagnu, apr, doxygen, git, guard

Image
This is second part. The first part is here . After setting up my development environment I am starting with writing tests. I do prefer TDD way and usually the process RED-GREEN-REFACTORING takes many changes during development as TDD allows to improve and optimize code any time (refactoring). But here I will put just final version of the code. The final version can be found on my github repo . Before starting, I run "guard" command in the console to let this amazing utility run all commands for my.