@ -109,6 +109,15 @@ def get_tests(repo_path):
return tests
return tests
# Get gtest dir from Makefile
def get_gtest_dir ( repo_path ) :
for line in open ( repo_path + " /Makefile " ) :
if line . strip ( ) . startswith ( " GTEST_DIR = " ) :
return line . split ( " = " ) [ 1 ] . strip ( )
# if not found
exit_with_error ( " Unable to find GTEST_DIR in Makefile " )
# Parse extra dependencies passed by user from command line
# Parse extra dependencies passed by user from command line
def get_dependencies ( ) :
def get_dependencies ( ) :
deps_map = {
deps_map = {
@ -142,11 +151,14 @@ def generate_targets(repo_path, deps_map):
cc_files = get_cc_files ( repo_path )
cc_files = get_cc_files ( repo_path )
# get tests from Makefile
# get tests from Makefile
tests = get_tests ( repo_path )
tests = get_tests ( repo_path )
# get gtest dir
gtest_dir = get_gtest_dir ( repo_path ) + " / "
if src_mk is None or cc_files is None or tests is None :
if src_mk is None or cc_files is None or tests is None :
return False
return False
TARGETS = TARGETSBuilder ( " %s /TARGETS " % repo_path )
TARGETS = TARGETSBuilder ( " %s /TARGETS " % repo_path , gtest_dir )
# rocksdb_lib
# rocksdb_lib
TARGETS . add_library (
TARGETS . add_library (
" rocksdb_lib " ,
" rocksdb_lib " ,
@ -159,7 +171,7 @@ def generate_targets(repo_path, deps_map):
src_mk . get ( " TEST_LIB_SOURCES " , [ ] ) +
src_mk . get ( " TEST_LIB_SOURCES " , [ ] ) +
src_mk . get ( " EXP_LIB_SOURCES " , [ ] ) +
src_mk . get ( " EXP_LIB_SOURCES " , [ ] ) +
src_mk . get ( " ANALYZER_LIB_SOURCES " , [ ] ) ,
src_mk . get ( " ANALYZER_LIB_SOURCES " , [ ] ) ,
[ " :rocksdb_lib " ] )
[ " :rocksdb_lib " , " :rocksdb_third_party_gtest " ] )
# rocksdb_tools_lib
# rocksdb_tools_lib
TARGETS . add_library (
TARGETS . add_library (
" rocksdb_tools_lib " ,
" rocksdb_tools_lib " ,
@ -173,6 +185,12 @@ def generate_targets(repo_path, deps_map):
src_mk . get ( " ANALYZER_LIB_SOURCES " , [ ] )
src_mk . get ( " ANALYZER_LIB_SOURCES " , [ ] )
+ src_mk . get ( ' STRESS_LIB_SOURCES ' , [ ] )
+ src_mk . get ( ' STRESS_LIB_SOURCES ' , [ ] )
+ [ " test_util/testutil.cc " ] )
+ [ " test_util/testutil.cc " ] )
# rocksdb_third_party_gtest
TARGETS . add_library (
" rocksdb_third_party_gtest " ,
[ gtest_dir + " gtest/gtest-all.cc " ] ,
[ ] ,
[ gtest_dir + " gtest/gtest.h " ] )
print ( " Extra dependencies: \n {0} " . format ( json . dumps ( deps_map ) ) )
print ( " Extra dependencies: \n {0} " . format ( json . dumps ( deps_map ) ) )
# test for every test we found in the Makefile
# test for every test we found in the Makefile
@ -219,6 +237,7 @@ def get_rocksdb_path():
return rocksdb_path
return rocksdb_path
def exit_with_error ( msg ) :
def exit_with_error ( msg ) :
print ( ColorString . error ( msg ) )
print ( ColorString . error ( msg ) )
sys . exit ( 1 )
sys . exit ( 1 )