Funny thing, I was just thinking that it's not possible to unit test C programs because, for example, a system call like read(2) just takes primitive arguments, which doesn't give you much opportunity for mocking. Then I had a small epiphany: use LD_PRELOAD to mock out external functions, including system calls.