bazel icon indicating copy to clipboard operation
bazel copied to clipboard

bazel test run file env has bug

Open huitailang949494 opened this issue 9 years ago • 1 comments

When I use a cc_test like:

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

I need to run this cmd:

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

How can I omit it "--test_env=LD_LIBRARY_PATH=/usr/local/lib".

Does cc_test has env_path option?

I want to do like this

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

and I can test in this cmd:./bazel test @xxx//xxx:xxx_test --test_output=errors I dont want to write "--test_env=LD_LIBRARY_PATH=/usr/local/lib" when I want to test

now if I run this cmd:./bazel test @xxx//xxx:xxx_test --test_output=errors will get this error:

/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

Have you found anything relevant by searching the web?

https://stackoverflow.com/questions/46339851/bazel-cc-test-test-env-options

huitailang949494 avatar Sep 28 '17 05:09 huitailang949494

Hi there! We're doing a clean up of old issues and will be closing this one. Please reopen (or ping me to reopen) if you’d like to discuss anything further. We’ll respond as soon as we have the bandwidth/resources to do so.

sgowroji avatar Feb 17 '23 08:02 sgowroji