提交 387f2040 编写于 作者: V Vadim Pisarevsky

the path to "opencv/opencv_extra/testdata" can now be set using...

the path to "opencv/opencv_extra/testdata" can now be set using OPENCV_TEST_DATA_PATH. Filter pattern can now start with ">" or ">=" symbols, meaning - run all the test, beginning from the particular one - convenient for resuming tests after fixing crashed tests
上级 d5c57646
......@@ -41,7 +41,7 @@
#include "cvtest.h"
CvTS test_system;
CvTS test_system("cv");
const char* blacklist[] =
{
......
......@@ -41,7 +41,7 @@
#include "cxcoretest.h"
CvTS test_system;
CvTS test_system("core");
const char* blacklist[] =
{
......
......@@ -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
{
......
......@@ -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;
......
......@@ -41,7 +41,7 @@
#include "mltest.h"
CvTS test_system;
CvTS test_system("ml");
const char* blacklist[] =
{
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册