bazel-测试运行时的可写归档路径 [英] bazel - writable archivable path for test runtime
问题描述
我正在使用一些bazel测试目标(java_test
的scala风格)进行E2E测试.
I'm running E2E test using some bazel test target (the scala flavour of java_test
).
在Maven中,我曾经将日志转储到在测试期间创建的target/logs
文件夹中,然后如果出现故障-我本可以在此文件夹中查找日志.
In Maven I used to dump logs to target/logs
folder that was created during test time, and then if something failed - I could have looked in this folder and find the logs.
在bazel中-我可以在测试日志配置中输入什么路径,以便在测试完成/测试失败时可写且方便使用?
In bazel - what path can I put in my test logs configuration so it would be writable and conveniently available upon test finish / test failure?
我知道java.io.tmp
目录是可写的,但是在测试完成后会立即被删除.
I know that the java.io.tmp
dir is writable but gets deleted immediately after test finishes.
推荐答案
因此,通过浏览Bazel文档,我发现了这一点: https://docs.bazel.build/versions/master/test -encyclopedia.html#initial-conditions
So digging through bazel docs I found this: https://docs.bazel.build/versions/master/test-encyclopedia.html#initial-conditions
似乎我可以读取env变量"TEST_UNDECLARED_OUTPUTS_DIR"
,它将给我一条可写的路径.我写的所有内容都将被压缩并保存在./bazel-out/darwin-fastbuild/testlogs/<package-name>/<target-name>/test.outputs/outputs.zip
Seems like I can read env variable "TEST_UNDECLARED_OUTPUTS_DIR"
and it will give me a writable path. Anything I write there would be zipped and saved under ./bazel-out/darwin-fastbuild/testlogs/<package-name>/<target-name>/test.outputs/outputs.zip
很酷!
这篇关于bazel-测试运行时的可写归档路径的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!