suricata: RunUnittests now return void

RunUnittests function is now a terminal function (calling exit
before leaving).
pull/1073/merge
Eric Leblond 12 years ago committed by Victor Julien
parent 0780c07043
commit fe82a83e79

@ -118,7 +118,16 @@
void RegisterAllModules(); void RegisterAllModules();
void TmqhSetup (void); void TmqhSetup (void);
int RunUnittests(int list_unittests, char *regex_arg) /**
* Run or list unittests
*
* \param list_unittests If set to 1, list unittests. Run them if set to 0.
* \param regex_arg A regular expression to select unittests to run
*
* This function is terminal and will call exit after being called.
*/
void RunUnittests(int list_unittests, char *regex_arg)
{ {
#ifdef UNITTESTS #ifdef UNITTESTS
/* Initializations for global vars, queues, etc (memsets, mutex init..) */ /* Initializations for global vars, queues, etc (memsets, mutex init..) */

@ -1821,13 +1821,7 @@ int StartInternalRunMode(SCInstance *suri, int argc, char **argv)
RunModeListRunmodes(); RunModeListRunmodes();
return TM_ECODE_DONE; return TM_ECODE_DONE;
case RUNMODE_LIST_UNITTEST: case RUNMODE_LIST_UNITTEST:
{ RunUnittests(1, suri->regex_arg);
int ret = RunUnittests(1, suri->regex_arg);
if (ret == TM_ECODE_OK)
return TM_ECODE_DONE;
else
return ret;
}
#ifdef OS_WIN32 #ifdef OS_WIN32
case RUNMODE_INSTALL_SERVICE: case RUNMODE_INSTALL_SERVICE:
if (SCServiceInstall(argc, argv)) { if (SCServiceInstall(argc, argv)) {
@ -2159,7 +2153,7 @@ int main(int argc, char **argv)
} }
if (suri.run_mode == RUNMODE_UNITTEST) if (suri.run_mode == RUNMODE_UNITTEST)
return RunUnittests(0, suri.regex_arg); RunUnittests(0, suri.regex_arg);
#ifdef __SC_CUDA_SUPPORT__ #ifdef __SC_CUDA_SUPPORT__
/* Init the CUDA environment */ /* Init the CUDA environment */

Loading…
Cancel
Save