When using ert I'd sometimes like to have tests abort after some timeout. I could program this in advance in the test-case but this is not what I need.

Imagine a situation where I use ert-run-tests-batch for non-regression testing after I modified something in the code. The new code may introduce a bug where, say, some test case will loop forever. This blocks the rest of the test batch and, to make matter worse, it is not easy to find out which test exactly tripped the infinite loop.

To avoid this, I'd like to be able to say something like run all selected tests but abort any that lasts more than 1 second, knowing that they usually pass very quickly. I looked in the ert manual but could not find anything relevant. Is there a hidden way that someone knows of?

  • Not ert related, but are you able to use with-timeout? Aug 10, 2021 at 10:00
  • with-timeout probably won't work if the loop doesn't look for some external input somewhere. This seems like a case where you need to run the tests asynchrously, then after a certain amount of time check the results. I guess you could kill any process that takes too long. Aug 10, 2021 at 13:33


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.