--enable-unittests now controls compilation of unittest code. Added crude commandline support for running unittests: ./eidps runtests

remotes/origin/master-1.0.x
Victor Julien 16 years ago
parent 462a346bf6
commit e6400bf456

@ -19,6 +19,12 @@
/* Define to 1 if you have the `pcap' library (-lpcap). */ /* Define to 1 if you have the `pcap' library (-lpcap). */
#undef HAVE_LIBPCAP #undef HAVE_LIBPCAP
/* Define to 1 if you have the `pcre' library (-lpcre). */
#undef HAVE_LIBPCRE
/* Define to 1 if you have the `pthread' library (-lpthread). */
#undef HAVE_LIBPTHREAD
/* Define to 1 if you have the <memory.h> header file. */ /* Define to 1 if you have the <memory.h> header file. */
#undef HAVE_MEMORY_H #undef HAVE_MEMORY_H

@ -242,12 +242,12 @@ AC_CHECK_HEADER(pcap.h,,[AC_ERROR(pcap.h not found ...)])
fi fi
# enable the running of unit tests # enable the running of unit tests
AC_ARG_ENABLE(unittest, AC_ARG_ENABLE(unittests,
[ --enable-unittest Enable Running of Unit Tests], [ --enable-unittests Enable compilation of the unit tests],
[ enable_unittest=yes [ enable_unittests=yes
]) ])
if test "$enable_unittest" = "yes"; then if test "$enable_unittests" = "yes"; then
CFLAGS="${CFLAGS} -DRUN_UNITTEST" CFLAGS="${CFLAGS} -DUNITTESTS"
fi fi
# enable the loading of sigs XXX remove this when we get a config language # enable the loading of sigs XXX remove this when we get a config language

@ -866,8 +866,11 @@ int main(int argc, char **argv)
TmModuleStreamTcpRegister(); TmModuleStreamTcpRegister();
TmModuleDebugList(); TmModuleDebugList();
#ifdef UNITTESTS
/* test and initialize the unittesting subsystem */ /* test and initialize the unittesting subsystem */
UtRunSelftest(); /* inits and cleans up again */ if (argc > 1&& (strcmp(argv[1],"runtests") == 0)) {
UtRunSelftest(); /* inits and cleans up again */
}
UtInitialize(); UtInitialize();
TmModuleRegisterTests(); TmModuleRegisterTests();
SigTableRegisterTests(); SigTableRegisterTests();
@ -880,13 +883,14 @@ int main(int argc, char **argv)
FlowBitRegisterTests(); FlowBitRegisterTests();
SigRegisterTests(); SigRegisterTests();
DecodePPPRegisterTests(); DecodePPPRegisterTests();
#ifdef RUN_UNITTEST if (argc > 1&& (strcmp(argv[1],"runtests") == 0)) {
UtRunTests(); UtRunTests();
UtCleanup(); }
exit(1);
#else /* Implied We did enable running of Unit Tests */
UtCleanup(); UtCleanup();
#endif /* RUN_UNITTEST */ if (argc > 1&& (strcmp(argv[1],"runtests") == 0)) {
exit(0);
}
#endif /* UNITTESTS */
//LoadConfig(); //LoadConfig();
//exit(1); //exit(1);

Loading…
Cancel
Save