added blacklist support in the OpenCV test engine for centralized exclusion of failed...
authorVadim Pisarevsky <no@email>
Tue, 14 Sep 2010 13:58:05 +0000 (13:58 +0000)
committerVadim Pisarevsky <no@email>
Tue, 14 Sep 2010 13:58:05 +0000 (13:58 +0000)
tests/cxcore/src/cxcoretest_main.cpp
tests/cxts/cxts.cpp
tests/cxts/cxts.h

index 16f51cc..1e657d1 100644 (file)
 
 CvTS test_system;
 
+const char* blacklist[] =
+{
+    //"matrix-invert",
+    0
+};
+
 int main( int argc, char** argv )
 {
-    return test_system.run( argc, argv );
+    return test_system.run( argc, argv, blacklist );
 }
 
 /* End of file. */
index 269572f..4cece0e 100644 (file)
@@ -1302,7 +1302,7 @@ static int CV_CDECL cmp_test_names( const void* a, const void* b )
     return strcmp( (*(const CvTest**)a)->get_name(), (*(const CvTest**)b)->get_name() );
 }
 
-int CvTS::run( int argc, char** argv )
+int CvTS::run( int argc, char** argv, const char** blacklist )
 {
     time( &start_time );
 
@@ -1475,7 +1475,7 @@ int CvTS::run( int argc, char** argv )
         if( !(test->get_support_testing_modes() & get_testing_mode()) )
             continue;
 
-        if( strcmp( test->get_func_list(), "" ) != 0 && filter(test) )
+        if( strcmp( test->get_func_list(), "" ) != 0 && filter(test, blacklist) )
         {
             if( test->init(this) >= 0 )
             {
@@ -1875,11 +1875,21 @@ static char* cv_strnstr( const char* str, int len,
 }
 
 
-int CvTS::filter( CvTest* test )
+int CvTS::filter( CvTest* test, const char** blacklist )
 {
     const char* pattern = params.test_filter_pattern;
+    const char* test_name = test->get_name();
     int inverse = 0;
 
+    if( blacklist )
+    {
+        for( ; *blacklist != 0; blacklist++ )
+        {
+            if( strcmp( *blacklist, test_name ) == 0 )
+                return 0;
+        }
+    }
+    
     if( pattern && pattern[0] == '!' )
     {
         inverse = 1;
@@ -1888,7 +1898,7 @@ int CvTS::filter( CvTest* test )
 
     if( !pattern || strcmp( pattern, "" ) == 0 || strcmp( pattern, "*" ) == 0 )
         return 1 ^ inverse;
-
+    
     if( params.test_filter_mode == CHOOSE_TESTS )
     {
         int found = 0;
@@ -1914,9 +1924,9 @@ int CvTS::filter( CvTest* test )
                 have_wildcard = 0;
             }
 
-            t_name_len = (int)strlen( test->get_name() );
+            t_name_len = (int)strlen( test_name );
             found = (t_name_len == len || (have_wildcard && t_name_len > len)) &&
-                    (len == 0 || memcmp( test->get_name(), pattern, len ) == 0);
+                    (len == 0 || memcmp( test_name, pattern, len ) == 0);
             if( endptr )
             {
                 *endptr = ',';
index 0c10f65..3f1e884 100644 (file)
@@ -290,7 +290,7 @@ public:
     virtual void vprintf( int streams, const char* fmt, va_list arglist );
 
     // runs the tests (the whole set or some selected tests)
-    virtual int run( int argc, char** argv );
+    virtual int run( int argc, char** argv, const char** blacklist=0 );
 
     // updates the context: current test, test case, rng state
     virtual void update_context( CvTest* test, int test_case_idx, bool update_ts_context );
@@ -433,7 +433,7 @@ protected:
     virtual int read_params( CvFileStorage* fs );
     
     // checks, whether the test needs to be run (1) or not (0); called from run()
-    virtual int filter( CvTest* test );
+    virtual int filter( CvTest* test, const char** blacklist=0 );
 
     // makes base name of output files
     virtual void make_output_stream_base_name( const char* config_name );