the path to "opencv/opencv_extra/testdata" can now be set using OPENCV_TEST_DATA_PATH...
authorVadim Pisarevsky <no@email>
Tue, 19 Oct 2010 13:49:13 +0000 (13:49 +0000)
committerVadim Pisarevsky <no@email>
Tue, 19 Oct 2010 13:49:13 +0000 (13:49 +0000)
tests/cv/src/tsysa.cpp
tests/cxcore/src/cxcoretest_main.cpp
tests/cxts/cxts.cpp
tests/cxts/cxts.h
tests/ml/src/mltest_main.cpp

index 714cf49..57cf1a7 100644 (file)
@@ -41,7 +41,7 @@
 
 #include "cvtest.h"
 
-CvTS test_system;
+CvTS test_system("cv");
 
 const char* blacklist[] =
 {
index 1e657d1..94a325b 100644 (file)
@@ -41,7 +41,7 @@
 
 #include "cxcoretest.h"
 
-CvTS test_system;
+CvTS test_system("core");
 
 const char* blacklist[] =
 {
index 4cece0e..5c6e3c5 100644 (file)
@@ -1035,8 +1035,9 @@ int CvBadArgTest::run_test_case( int expected_code, const char* descr )
 
 /******************************** Constructors/Destructors ******************************/
 
-CvTS::CvTS()
+CvTS::CvTS(const char* _module_name)
 {
+    module_name = _module_name;
     start_time = 0;
     version = CV_TS_VERSION;
     memory_manager = 0;
@@ -1361,34 +1362,18 @@ int CvTS::run( int argc, char** argv, const char** blacklist )
         }
     }
 
-#if 0
-//#if !defined WIN32 && !defined _WIN32
-    if (! config_name )
-    {    
-      char * confname = getenv("configname");
-      if (confname)
-        config_name = confname;
-    }
-    
-    if( !params.data_path || !params.data_path[0] )
-    {
-        char* datapath = getenv("datapath");
-        if( datapath )
-            set_data_path(datapath);
-    }
-    
     // this is the fallback for the current OpenCV autotools setup
     if( !params.data_path || !params.data_path[0] )
     {
-        char* srcdir = getenv("srcdir");
+        char* datapath_dir = getenv("OPENCV_TEST_DATA_PATH");
         char buf[1024];
-        if( srcdir )
+        if( datapath_dir )
         {
-            sprintf( buf, "%s/../../opencv_extra/testdata/", srcdir );
+            sprintf( buf, "%s/%s", datapath_dir, module_name ? module_name : "" );
+            printf( LOG + CONSOLE + SUMMARY, "Data Path = %s\n", buf);
             set_data_path(buf);
         }
     }
-#endif
 
     if( write_params )
     {
@@ -1467,6 +1452,8 @@ int CvTS::run( int argc, char** argv, const char** blacklist )
         }
     }
 
+    int filter_state = 0;
+    
     // 4. traverse through the list of all registered tests.
     // Initialize the selected tests and put them into the separate sequence
     for( i = 0; i < all_tests.size(); i++ )
@@ -1475,7 +1462,7 @@ int CvTS::run( int argc, char** argv, const char** blacklist )
         if( !(test->get_support_testing_modes() & get_testing_mode()) )
             continue;
 
-        if( strcmp( test->get_func_list(), "" ) != 0 && filter(test, blacklist) )
+        if( strcmp( test->get_func_list(), "" ) != 0 && filter(test, filter_state, blacklist) )
         {
             if( test->init(this) >= 0 )
             {
@@ -1875,11 +1862,12 @@ static char* cv_strnstr( const char* str, int len,
 }
 
 
-int CvTS::filter( CvTest* test, const char** blacklist )
+int CvTS::filter( CvTest* test, int& filter_state, const char** blacklist )
 {
     const char* pattern = params.test_filter_pattern;
     const char* test_name = test->get_name();
     int inverse = 0;
+    int greater_or_equal = 0;
 
     if( blacklist )
     {
@@ -1895,7 +1883,18 @@ int CvTS::filter( CvTest* test, const char** blacklist )
         inverse = 1;
         pattern++;
     }
-
+    
+    if( pattern && pattern[0] == '>' )
+    {
+        greater_or_equal = 1;
+        pattern++;
+        if( pattern[0] == '=' )
+        {
+            greater_or_equal = 2;
+            pattern++;
+        }
+    }
+    
     if( !pattern || strcmp( pattern, "" ) == 0 || strcmp( pattern, "*" ) == 0 )
         return 1 ^ inverse;
     
@@ -1939,7 +1938,22 @@ int CvTS::filter( CvTest* test, const char** blacklist )
                 break;
         }
 
-        return found ^ inverse;
+        if( greater_or_equal == 0 )
+            return found ^ inverse;
+        if( filter_state )
+            return inverse^1;
+        if( !found )
+            return inverse;
+        if( greater_or_equal == 1 )
+        {
+            filter_state = 1;
+            return inverse;
+        }
+        if( greater_or_equal == 2 )
+        {
+            filter_state = 1;
+            return inverse ^ 1;
+        }
     }
     else
     {
index 3f1e884..253b28f 100644 (file)
@@ -268,7 +268,7 @@ class CV_EXPORTS CvTS
 public:
 
     // constructor(s) and destructor
-    CvTS();
+    CvTS(const char* _module_name=0);
     virtual ~CvTS();
 
     enum
@@ -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, const char** blacklist=0 );
+    virtual int filter( CvTest* test, int& filter_state, const char** blacklist=0 );
 
     // makes base name of output files
     virtual void make_output_stream_base_name( const char* config_name );
@@ -537,6 +537,8 @@ protected:
 
     // name of config file
     const char* config_name;
+    
+    const char* module_name;
 
     // information about the current test
     CvTestInfo current_test_info;
index 22c8ae0..52b32b3 100644 (file)
@@ -41,7 +41,7 @@
 
 #include "mltest.h"
 
-CvTS test_system;
+CvTS test_system("ml");
 
 const char* blacklist[] =
 {