]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
startup: move RunUnittests to StartInternalRunMode
authorVictor Julien <victor@inliniac.net>
Fri, 29 May 2015 12:00:40 +0000 (14:00 +0200)
committerVictor Julien <victor@inliniac.net>
Tue, 12 Apr 2016 08:03:53 +0000 (10:03 +0200)
src/suricata.c

index 13eb25012422373cfbaaf5326a719260075164ef..f5ed5136e16d740f0324988a2e34f877e3c29442 100644 (file)
@@ -1930,6 +1930,8 @@ int StartInternalRunMode(SCInstance *suri, int argc, char **argv)
             return TM_ECODE_DONE;
         case RUNMODE_LIST_UNITTEST:
             RunUnittests(1, suri->regex_arg);
+        case RUNMODE_UNITTEST:
+            RunUnittests(0, suri->regex_arg);
 #ifdef OS_WIN32
         case RUNMODE_INSTALL_SERVICE:
             if (SCServiceInstall(argc, argv)) {
@@ -2243,6 +2245,10 @@ int main(int argc, char **argv)
         exit(EXIT_FAILURE);
     }
 
+    if (FinalizeRunMode(&suri, argv) != TM_ECODE_OK) {
+        exit(EXIT_FAILURE);
+    }
+
     switch (StartInternalRunMode(&suri, argc, argv)) {
         case TM_ECODE_DONE:
             exit(EXIT_SUCCESS);
@@ -2250,13 +2256,6 @@ int main(int argc, char **argv)
             exit(EXIT_FAILURE);
     }
 
-    if (FinalizeRunMode(&suri, argv) != TM_ECODE_OK) {
-        exit(EXIT_FAILURE);
-    }
-
-    if (suri.run_mode == RUNMODE_UNITTEST)
-        RunUnittests(0, suri.regex_arg);
-
 #ifdef __SC_CUDA_SUPPORT__
     /* Init the CUDA environment */
     SCCudaInitCudaEnvironment();