Search code examples
bazel

How to specify custom timeout for bazel test


bazel test command uses default timeout of 75 seconds for tests tagged size = small in my setup (version 0.12.0) (while the documentation mentions this as 60 seconds)

Is there a way to supply a custom timeout say 10 seconds, on bazel command line, so that if a test hangs it is terminated quicker?


Solution

  • I hope I did not misread the question, but this really sounds like you're looking for --test_timeout option:

      --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.
    

    If you want to use the same option(s) every time, you can save yourself some typing by using bazelrc.