如何为 bazel 测试指定自定义超时

How to specify custom timeout for bazel test

bazel test 命令在我的设置(版本 0.12.0)中对标记为 size = small 的测试使用 75 秒的默认超时(而 documentation 提到这是 60 秒)

有没有办法在 bazel 命令行上提供自定义超时,比如 10 秒,这样如果测试挂起,它会更快终止?

希望我没有误读问题,但这听起来确实像是您在寻找 --test_timeout 选项:

  --test_timeout
    (a single integer or comma-separated list of 4 integers; default: "-1")
    Override the default test timeout values for test timeouts (in secs). If a 
    single positive integer value is specified it will override all 
    categories.  If 4 comma-separated integers are specified, they will 
    override the timeouts for short, moderate, long and eternal (in that 
    order). In either form, a value of -1 tells blaze to use its default 
    timeouts for that category.

如果您想每次都使用相同的选项,您可以使用 bazelrc 来节省一些输入时间。