@ -41,20 +41,31 @@ bool RegisterTest(const char* base, const char* name, void (*func)()) {
int RunAllTests ( ) {
int RunAllTests ( ) {
port : : InstallStackTraceHandler ( ) ;
port : : InstallStackTraceHandler ( ) ;
const char * matcher = getenv ( " ROCKSDB_TESTS " ) ;
const char * one_matcher = getenv ( " ROCKSDB_TESTS " ) ;
const char * from_matcher = getenv ( " ROCKSDB_TESTS_FROM " ) ;
int num = 0 ;
int num = 0 ;
bool tests_on = ( one_matcher = = nullptr & & from_matcher = = nullptr ) ;
if ( tests ! = nullptr ) {
if ( tests ! = nullptr ) {
for ( unsigned int i = 0 ; i < tests - > size ( ) ; i + + ) {
for ( unsigned int i = 0 ; i < tests - > size ( ) ; i + + ) {
const Test & t = ( * tests ) [ i ] ;
const Test & t = ( * tests ) [ i ] ;
if ( matcher ! = nullptr ) {
if ( tests_on = = false ) {
if ( one_matcher ! = nullptr | | from_matcher ! = nullptr ) {
std : : string name = t . base ;
std : : string name = t . base ;
name . push_back ( ' . ' ) ;
name . push_back ( ' . ' ) ;
name . append ( t . name ) ;
name . append ( t . name ) ;
if ( strstr ( name . c_str ( ) , matcher ) = = nullptr ) {
if ( from_matcher ! = nullptr & &
strstr ( name . c_str ( ) , from_matcher ) ! = nullptr ) {
tests_on = true ;
}
if ( ! tests_on ) {
if ( one_matcher = = nullptr | |
strstr ( name . c_str ( ) , one_matcher ) = = nullptr ) {
continue ;
continue ;
}
}
}
}
}
}
fprintf ( stderr , " ==== Test %s.%s \n " , t . base , t . name ) ;
fprintf ( stderr , " ==== Test %s.%s \n " , t . base , t . name ) ;
( * t . func ) ( ) ;
( * t . func ) ( ) ;
+ + num ;
+ + num ;