]> git.ipfire.org Git - thirdparty/snort3.git/commitdiff
remove check related build foo and code
authorruss <rucombs@cisco.com>
Tue, 8 Sep 2015 22:46:43 +0000 (18:46 -0400)
committerruss <rucombs@cisco.com>
Tue, 8 Sep 2015 22:46:43 +0000 (18:46 -0400)
src/main.cc
src/main/snort_module.cc
src/test/unit_test.cc
src/test/unit_test.h

index 3fc10665fbf569c33014131acd5abb292930719f..e2b61a8213946f8f073972df93f0bfb31db1a0de 100644 (file)
@@ -696,9 +696,6 @@ static bool set_mode()
         exit(Piglet::main());
 #endif
 #ifdef UNIT_TEST
-    if ( check_enabled() )
-        exit(check_test());
-
     if ( catch_enabled() )
         exit(catch_test());
 #endif
index 6483790599c5e3b1a294603715ef6c56a9c0b34d..90f9680c38a6779644e45fde521be8d79d1bb614 100644 (file)
@@ -441,10 +441,6 @@ static const Parameter s_params[] =
       "use drop, sdrop, and reject rules to ignore session traffic when not inline" },
 
 #ifdef UNIT_TEST
-    { "--check-test", Parameter::PT_SELECT,
-      "silent | minimal | normal | verbose | env (export CK_VERBOSITY)", nullptr,
-      "<verbosity> run unit tests with given libcheck output mode" },
-
     { "--catch-test", Parameter::PT_STRING, nullptr, nullptr,
         "comma separated list of cat unit test tags or 'all'" },
 #endif
@@ -835,9 +831,6 @@ bool SnortModule::set(const char*, Value& v, SnortConfig* sc)
         ConfigTreatDropAsIgnore(sc, v.get_string());
 
 #ifdef UNIT_TEST
-    else if ( v.is("--check-test") )
-        unit_test_mode(v.get_string());
-
     else if ( v.is("--catch-test") )
         unit_test_catch_test_filter(v.get_string());
 #endif
index 6f4bfee5f17b5d9696e1c9a30cda9976af296b34..53a92bc559d8776d0afcc7fe964599737f8edcc6 100644 (file)
 //--------------------------------------------------------------------------
 // unit_test.h author Russ Combs <rucombs@cisco.com>
 
+#include <stdlib.h>
+#include <string.h>
+
 #include <vector>
 #include <string>
 
 #include "unit_test.h"
 
-#include <stdlib.h>
-
-#if defined(__clang__)
-#pragma clang diagnostic push
-#pragma clang diagnostic ignored "-Wgnu-zero-variadic-macro-arguments"
-#endif
-
-#include <check.h>
-
-#if defined(__clang__)
-#pragma clang diagnostic pop
-#endif
-#include <check.h>
-
-#include "suite_decl.h"
-
-static print_output s_mode = CK_LAST;
 static bool s_catch = false;
 static std::vector<std::string> test_tags;
 
-typedef Suite* (* SuiteCtor_f)();
-
-static SuiteCtor_f s_suites[] =
-{
-#include "suite_list.h"
-    nullptr
-};
-
-void unit_test_mode(const char* s)
-{
-    if ( !s || !strcasecmp(s, UNIT_TEST_MODE_OFF) )
-        s_mode = CK_LAST;
-
-    else if ( !strcasecmp(s, UNIT_TEST_MODE_SILENT) )
-        s_mode = CK_SILENT;
-
-    else if ( !strcasecmp(s, UNIT_TEST_MODE_MINIMAL) )
-        s_mode = CK_MINIMAL;
-
-    else if ( !strcasecmp(s, UNIT_TEST_MODE_NORMAL) )
-        s_mode = CK_NORMAL;
-
-    else if ( !strcasecmp(s, UNIT_TEST_MODE_VERBOSE) )
-        s_mode = CK_VERBOSE;
-
-    else //if ( !strcasecmp(s, UNIT_TEST_MODE_ENV) )
-        s_mode = CK_ENV;
-}
-
 void unit_test_catch_test_filter(const char* s)
 {
     if ( s && strcmp(s, "all") )
@@ -79,54 +36,11 @@ void unit_test_catch_test_filter(const char* s)
     s_catch = true;
 }
 
-bool check_enabled()
-{
-    return s_mode != CK_LAST;
-}
-
 bool catch_enabled()
 {
     return s_catch;
 }
 
-static bool run_check()
-{
-    int nErr;
-    SuiteCtor_f* ctor = s_suites;
-    SRunner* pr = nullptr;
-
-    while ( *ctor )
-    {
-        Suite* ps = (* ctor)();
-
-        if ( !pr )
-            pr = srunner_create(ps);
-        else
-            srunner_add_suite(pr, ps);
-
-        ++ctor;
-    }
-    if ( !pr )
-        return false;
-
-    // tbd - possible to support forking?
-    srunner_set_fork_status(pr, CK_NOFORK);
-
-    // PrintTests();
-    //if ( argc > 1 ) s_debug = 1;
-
-    // srunner_set_log() overrides CK_ENV
-    const char* log = getenv("CK_LOG");
-    if ( log )
-        srunner_set_log (pr, log);
-
-    srunner_run_all(pr, s_mode);
-    nErr = srunner_ntests_failed(pr);
-
-    srunner_free(pr);
-    return !nErr;
-}
-
 // check defines fail, so we must squash that because
 // catch uses stream and that has a fail method
 #undef fail
@@ -138,8 +52,8 @@ static bool run_catch()
   Catch::Session session;
 
   // write to session.configData() or session.Config() to customize
-  if( s_mode == CK_VERBOSE )
-      session.configData().showSuccessfulTests = true;
+  //if( s_mode == CK_VERBOSE )
+  //    session.configData().showSuccessfulTests = true;
 
   if( test_tags.size() > 0 )
       session.configData().testsOrTags = test_tags;
@@ -147,14 +61,6 @@ static bool run_catch()
   return session.run() == 0;
 }
 
-int check_test()
-{
-    if ( !run_check() )
-        return -1;
-
-    return 0;
-}
-
 int catch_test()
 {
     if ( !run_catch() )
index 74c7fd3571568a1b89a6bb096aed0430dfa2ecae..a0246166d681082449fde9b938a1541842de5cf1 100644 (file)
 
 // Unit test interface
 
-// These are the available arguments to unit_test_mode()
-#define UNIT_TEST_MODE_SILENT "silent"
-#define UNIT_TEST_MODE_MINIMAL "minimal"
-#define UNIT_TEST_MODE_NORMAL "normal"
-#define UNIT_TEST_MODE_VERBOSE "verbose"
-#define UNIT_TEST_MODE_ENV "env"
-#define UNIT_TEST_MODE_OFF "off"
-
-// Use "env" test mode to allow setting verbosity via this environment variable
-#define UNIT_TEST_MODE_ENVVAR "CK_VERBOSITY"
-
-void unit_test_mode(const char* = nullptr);
 void unit_test_catch_test_filter(const char* s);
 
-bool check_enabled();
 bool catch_enabled();
 
-int check_test();
 int catch_test();
 #endif