Hi all, after the discussion on unit tests I tried to add some. Some years ago, we had a very small set of "unit tests". These (two actually) were really almost nothing, BUT a skeleton to build better ones. And this skeleton I wanted to use, as it covers the initialization of the runtime (test rt_init).
Unfortunately, I don't get them even to link. IIRC, that was also the reason why they were removed from the testbench some time ago. I've tried for several hours now and googled a lot, but I can't find a solution to make them build. So any help would be appreciated. The code is available in branch https://github.com/rsyslog/rsyslog/tree/master-unittests When I try to build the rt_init test, I get this: rger@ubuntu1404esp:~/proj/rsyslog/tests$ make rt_init CCLD rt_init /usr/bin/ld: ../runtime/.libs/librsyslog.a(librsyslog_la-msg.o): undefined reference to symbol 'pthread_rwlock_wrlock@@GLIBC_2.2.5' /lib/x86_64-linux-gnu/libpthread.so.0: error adding symbols: DSO missing from command line collect2: error: ld returned 1 exit status make: *** [rt_init] Error 1 After what I could find out, this seems to be related to the order of -lpthread in the linker options. That's because the gnu linker is order-dependent. In theory, this should be fixable by moving -lpthread to the end of the linker libs. If I do that, I get a myriad of unresolved externals for the rsyslog runtime library. I than begun putting libs in different orders in the linker call, but I always get one error or the other. The interesting thing is that rsyslogd itself builds **successfully** with the **same** linker options in the **same** order. I even tried to move rt_init out of the tests directory into tools, where syslogd resides, and add rt_init to that Makefile. Again, rsyslogd builds, but rt_init fails. Quite honestly, I don't have any more idea. And the bad thing is that if I can't get rt_init to build, I probably cannot write any unit test at all (because most, especially those that do notable work, require the rsyslog runtime to be initialized). Help with this problem would be deeply appreciated. Again, it's a blocker for any unit test. Thanks, Rainer _______________________________________________ rsyslog mailing list http://lists.adiscon.net/mailman/listinfo/rsyslog http://www.rsyslog.com/professional-services/ What's up with rsyslog? Follow https://twitter.com/rgerhards NOTE WELL: This is a PUBLIC mailing list, posts are ARCHIVED by a myriad of sites beyond our control. PLEASE UNSUBSCRIBE and DO NOT POST if you DON'T LIKE THAT.

