]> git.ipfire.org Git - people/ms/suricata.git/commitdiff
suricata: RunUnittests now return void
authorEric Leblond <eric@regit.org>
Wed, 30 Jul 2014 15:17:51 +0000 (17:17 +0200)
committerVictor Julien <victor@inliniac.net>
Thu, 31 Jul 2014 13:43:26 +0000 (15:43 +0200)
RunUnittests function is now a terminal function (calling exit
before leaving).

src/runmode-unittests.c
src/suricata.c

index 838924e860fdd29736e83e4e9eeabba5d29f6330..ef808f24e1d0553b07a8b326d0486d5edd5e1744 100644 (file)
 void RegisterAllModules();
 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
     /* Initializations for global vars, queues, etc (memsets, mutex init..) */
index 5f96ac410adbdf2735336a9a4a48e8d4249173ca..db130392b260e10fb9bad0b85afbd593443b131f 100644 (file)
@@ -1821,13 +1821,7 @@ int StartInternalRunMode(SCInstance *suri, int argc, char **argv)
             RunModeListRunmodes();
             return TM_ECODE_DONE;
         case RUNMODE_LIST_UNITTEST:
-            {
-                int ret = RunUnittests(1, suri->regex_arg);
-                if (ret == TM_ECODE_OK)
-                    return TM_ECODE_DONE;
-                else
-                    return ret;
-            }
+            RunUnittests(1, suri->regex_arg);
 #ifdef OS_WIN32
         case RUNMODE_INSTALL_SERVICE:
             if (SCServiceInstall(argc, argv)) {
@@ -2159,7 +2153,7 @@ int main(int argc, char **argv)
     }
 
     if (suri.run_mode == RUNMODE_UNITTEST)
-        return RunUnittests(0, suri.regex_arg);
+        RunUnittests(0, suri.regex_arg);
 
 #ifdef __SC_CUDA_SUPPORT__
     /* Init the CUDA environment */