Commit e23d62b8 authored by Vadim Pisarevsky's avatar Vadim Pisarevsky

added blacklist support in the OpenCV test engine for centralized exclusion of failed tests

parent 652d0c2a
...@@ -43,9 +43,15 @@ ...@@ -43,9 +43,15 @@
CvTS test_system; CvTS test_system;
const char* blacklist[] =
{
//"matrix-invert",
0
};
int main( int argc, char** argv ) int main( int argc, char** argv )
{ {
return test_system.run( argc, argv ); return test_system.run( argc, argv, blacklist );
} }
/* End of file. */ /* End of file. */
...@@ -1302,7 +1302,7 @@ static int CV_CDECL cmp_test_names( const void* a, const void* b ) ...@@ -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() ); 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 ); time( &start_time );
...@@ -1475,7 +1475,7 @@ int CvTS::run( int argc, char** argv ) ...@@ -1475,7 +1475,7 @@ int CvTS::run( int argc, char** argv )
if( !(test->get_support_testing_modes() & get_testing_mode()) ) if( !(test->get_support_testing_modes() & get_testing_mode()) )
continue; 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 ) if( test->init(this) >= 0 )
{ {
...@@ -1875,11 +1875,21 @@ static char* cv_strnstr( const char* str, int len, ...@@ -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* pattern = params.test_filter_pattern;
const char* test_name = test->get_name();
int inverse = 0; int inverse = 0;
if( blacklist )
{
for( ; *blacklist != 0; blacklist++ )
{
if( strcmp( *blacklist, test_name ) == 0 )
return 0;
}
}
if( pattern && pattern[0] == '!' ) if( pattern && pattern[0] == '!' )
{ {
inverse = 1; inverse = 1;
...@@ -1888,7 +1898,7 @@ int CvTS::filter( CvTest* test ) ...@@ -1888,7 +1898,7 @@ int CvTS::filter( CvTest* test )
if( !pattern || strcmp( pattern, "" ) == 0 || strcmp( pattern, "*" ) == 0 ) if( !pattern || strcmp( pattern, "" ) == 0 || strcmp( pattern, "*" ) == 0 )
return 1 ^ inverse; return 1 ^ inverse;
if( params.test_filter_mode == CHOOSE_TESTS ) if( params.test_filter_mode == CHOOSE_TESTS )
{ {
int found = 0; int found = 0;
...@@ -1914,9 +1924,9 @@ int CvTS::filter( CvTest* test ) ...@@ -1914,9 +1924,9 @@ int CvTS::filter( CvTest* test )
have_wildcard = 0; 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)) && 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 ) if( endptr )
{ {
*endptr = ','; *endptr = ',';
......
...@@ -290,7 +290,7 @@ public: ...@@ -290,7 +290,7 @@ public:
virtual void vprintf( int streams, const char* fmt, va_list arglist ); virtual void vprintf( int streams, const char* fmt, va_list arglist );
// runs the tests (the whole set or some selected tests) // 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 // updates the context: current test, test case, rng state
virtual void update_context( CvTest* test, int test_case_idx, bool update_ts_context ); virtual void update_context( CvTest* test, int test_case_idx, bool update_ts_context );
...@@ -433,7 +433,7 @@ protected: ...@@ -433,7 +433,7 @@ protected:
virtual int read_params( CvFileStorage* fs ); virtual int read_params( CvFileStorage* fs );
// checks, whether the test needs to be run (1) or not (0); called from run() // 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 // makes base name of output files
virtual void make_output_stream_base_name( const char* config_name ); virtual void make_output_stream_base_name( const char* config_name );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment