[hipl-dev] Mock functions for hipl unit tests

  • From: Henrik Ziegeldorf <henrik.ziegeldorf@xxxxxxxxxxxxxx>
  • To: hipl-dev@xxxxxxxxxxxxx, christof.mroz@xxxxxxxxxxxxxx
  • Date: Thu, 11 Aug 2011 14:59:07 +0200

Hello,

I'm currently writing unit tests for the midauth functionality in hipl,
especially in the hipl firewall.
In this context I tried to mock the function ipq_get_packet (based on the
examples and code provided in mock.c/h).

I have taken all steps as described in mock.h, namely:
 * - In Makefile.am
 *   - add test/mock.c to your check program's _SOURCE,
 *   - add -ldl to your check program's _LDFLAGS.

Nevertheless, I encountered the following problem:

  CCLD   test/check_firewall
/usr/lib/gcc/x86_64-linux-gnu/4.4.5/../../../../lib/libipq.a(libipq.o): In
function `ipq_get_packet':
(.text+0x20): multiple definition of `ipq_get_packet'
test/mocks.o:/home/ziegeldorf/hipl-bzr/midauth-firewall/test/mocks.c:222:
first defined here
collect2: ld returned 1 exit status
make[2]: *** [test/check_firewall] Error 1

Any ideas, how I might fix this one?


Henrik

Other related posts: