Skip to content

Warn if test has been running for more than 60 seconds

Romain requested to merge romain-scheduler-timeout-3 into master

What

This MR makes Tezt warn if a test has been running for more than 60 seconds. The name of the test is shown in the error message. The warning repeats every 60 seconds as long as the test is running. The exact delay is configurable with new command-line option --warn-after-timeout. This behavior only works when using -j 2 or more.

Why

#26 (closed)

How

Because we cannot trust the test to yield to the Lwt scheduler, we implement this in Tezt's scheduler process. This is why this only works with -j 2 or more. (We could make it so that -j 1 runs the test in a separate process as well, so that it can benefit from the new warning. Maybe in another MR. Opinions?)

So we store a "deadline" for each warning, in each worker, and we modify the scheduler: instead of waiting until something is readable from a worker, we wait until either something is readable from a worker, or one of the deadlines would be reached. Then we check for deadlines and warn if needed.

How to Test the MR Manually

I added a cram test, so just run dune runtest.

Checklist

  • Update CHANGES.md. No need to document changes to documentation and tests.
  • Make sure all new values, types etc. are documented in .mli files and that the generated documentation looks ok.
  • Add tests in test/, if relevant.

Merge request reports