ounit
ounit copied to clipboard
?length parameter doesn't seem to set timeout
Hi there!
I had a question about the ?length
parameter on test_case
. I wrote a test that should never complete, and I'm trying to get it to timeout, but it won't. I'm wondering if I'm using the ?length
parameter correctly:
let suite =
"main_test_suite"
>::: [
"timeout_test"
>: test_case ~length:(OUnitTest.Custom_length 1.) (fun _ ->
let rec call_self_tr n =
if n = 0 then 0 else call_self_tr (n + 1)
in
assert_equal 1 (call_self_tr 1));
]
let _ = run_test_tt_main suite
I think that this test should timeout after 1 second, but this doesn't seem to happen? Is there any documentation that i should be looking at for this parameter, or something that I'm doing wrong? I've taken a look here, but that seems to be pretty much the only documentation that I can find.
Thank you so much!
By the way, I'm using OUnit2 v2.2.4.
Thanks!
What runner are you using? (Thread or Process)
What OS are you running on?
The code doesn't show if you are using "open OUnit" or "open OUnit2" (there is a difference).
Have you tried with a standard test length (OUnitTest.Immediate)?
What runner are you using? (Thread or Process)
I'm using -runner sequential
, it seems to work when I remove this flag. Are timeouts not supported on the sequential runner?
What OS are you running on?
macOS 11.2.1
The code doesn't show if you are using "open OUnit" or "open OUnit2" (there is a difference).
I'm using open OUnit2
Have you tried with a standard test length (OUnitTest.Immediate)?
Yes, I've tried both OUnitTest.Immediate
and OUnitTest.Short
Thank you so much for your help, and for making such an amazing testing library :)
Sequential runner doesn't support timeout
I have__totally__ documented this problem at the time of the release: https://sylvain.le-gall.net/blog/index.php?post/2013/09/29/OUnit-2.0%2C-official-release
It might be worth adding that to the real documentation on this website (the blog post was really a bad idea for the documentation).