-
Notifications
You must be signed in to change notification settings - Fork 41
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Introduce an option similar to --after-timeout for timers #298
Comments
The |
This could be sufficiently solved by adding a suitable call to
above here https://github.com/parapluu/Concuerror/blob/master/src/concuerror_callback.erl#L899. |
I tried to implement this feature according to your advise in b76b9ab, but it doesn't work. I have a test case that tries all three constructs that should be governed by
(I tweaked the test case a bit, so that I would appreciate some help on which part of the codebase to poke around with. |
Ah, very sorry for the bad lead. Another acceptable way to do this is to add an extra case for timer-related primitives, that checks the after_timeout setting and just returns a reference (via the relevant callback), but also emitting a warning similar to the one for 'ignoring after timeouts' for receives. This case should be placed before this: https://github.com/parapluu/Concuerror/blob/master/src/concuerror_callback.erl#L855 |
But that would mean I think my approach should work too, but I miss some rules about what events race in a timer-specific scenario. The test case with the |
Eek. Didn't think about that case. Indeed the assumption has been that one can always reverse cancel_timer bifs and fake timer processes dying. With a quick look I think the relevant line is: https://github.com/parapluu/Concuerror/blob/master/src/concuerror_dependencies.erl#L332 and the "time order" is irrelevant due to: https://github.com/parapluu/Concuerror/blob/master/src/concuerror_dependencies.erl#L75 Unfortunately I can't think of an easy solution. Faking the rest of the timer API so that e.g. 'cancel_timer' would be an exit signal, and 'read_timer' a 'is_process_alive' requires an extra abstraction layer above built-in ops. This would get you correct dependencies "for free". Another, 'ugly traditional' way to fix such things in the past has been to add more info to events in the |
Is your feature request related to a problem? Please describe.
Concuerror already supports treating timeouts in
receive/after
statements asinfinity
above some threshold with the--after-timeout
option. However, this option does not cover the case of timers started witherlang:start_timer
. My immediate problem is withgen_statem
, that unlikegen_server
uses timers which I cannot prevent from firing in my Concuerror tests.Describe the solution you'd like
I'd like either the
--after-timeout
option to apply to timers started witherlang:start_timer
(that is, timers above the specified threshold shall never fire while running my tests), or I'd like a new option, such as--timer-timeout
to be introduced specifically for timers. Whichever is more convenient to implement.Describe alternatives you've considered
My only alternative at the moment is to change the code I'm testing to not use finite timeouts with
gen_statem
when used from a Concuerror test case. However, this would make the code I test and the code I use in production differ for no good reason.Additional context
N/A
The text was updated successfully, but these errors were encountered: