2017-09-21 92 views
1

當我使用一個cc_test,如:巴澤爾cc_test test_env選項

cc_test(
    name = "xxx_test", 
    srcs = glob([ 
     'xxx.cpp', 
    ]), 
    linkopts = [ 
     "-L/usr/local/lib", 
     "-lcppunit", 
     "-ldl", 
     "-lz", 
     "-ltbb", 
     "-llz4", 
     "-lzstd" 
    ], 
    deps = [ 
     ":feature_generator" 
    ], 
) 

我需要運行這個CMD:

./bazel test @xxx//xxx:xxx_test --test_output=errors --test_env=LD_LIBRARY_PATH=/usr/local/lib 

我怎麼能忽略它"--test_env=LD_LIBRARY_PATH=/usr/local/lib".

是否cc_test有env_path選項?

我想要做這樣的

cc_test( 
*** 
*** 
test_env = ['/usr/local/lib'] 
) 

,我可以在這個CMD測試:./bazel test @xxx//xxx:xxx_test --test_output=errors我不想寫"--test_env=LD_LIBRARY_PATH=/usr/local/lib"當我想測試

現在如果我運行這個CMD:./bazel test @xxx//xxx:xxx_test --test_output=errors會得到這個錯誤:

/home/alex.sh/.cache/bazel/_bazel_alex.sh/c973fcd5ba7eef8db46b22b84af3a149/bazel-sandbox/3561058496653596424/execroot/__main__/bazel-out/local-fastbuild/bin/external/feature_generator/featur\ 
e_generator/gbdt_test.runfiles/__main__/external/feature_generator/feature_generator/gbdt_test: error while loading shared libraries: libzstd.so.1: cannot open shared object file: No such fi\ 
le or directory 
+0

對不起文件中的問題你能添加上有什麼問題究竟更多的細節?例如。你想要做什麼以及當你嘗試做什麼時會發生什麼? –

+0

我想要做這樣 cc_test( *** *** test_env = [ '的/ usr/local/lib目錄'] ) ,我可以在這個CMD測試:./巴澤勒測試@xxx // xxx:xxx_test --test_output = errors 當我想測試 – Alex

+0

時,我不想寫「--test_env = LD_LIBRARY_PATH =/usr/local/lib」爲什麼你需要添加測試環境?你有沒有通過更多的選擇巴澤爾bazelrc? –

回答