-
Notifications
You must be signed in to change notification settings - Fork 167
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
Wrong arguments passed to generated command #126
Comments
If you want some help to debug this, please provide some self-contained module that shows the problem. I do not even know where to find |
OK, I'm shrinking the problem to sth more generic. |
Ok, I've created smaller example [1]. This reproduces the real problem I've found with MongooseIM. There is indeed a bug in MongooseIM which delivers the same message twice under some circumstances. This fails given PropEr tests which is expected. Now PropEr tries to shrink the commands' sequence and generates wrong sequence when not every arguments from state are passed to the In the smaller example, I'm generating a wrong message after 10th read. And the minimal example found by PropEr looks like this (for me): [{set,{var,1},
{call,send_messages_command_generator,connect_carol,[]}},
{set,{var,2},
{call,send_messages_command_generator,connect_geralt,[]}},
{set,{var,3},
{call,send_messages_command_generator,send_from_carol,
[{var,1},{var,2}]}},
{set,{var,25},
{call,send_messages_command_generator,send_from_carol,
[{var,1},{var,2}]}},
{set,{var,26},
{call,send_messages_command_generator,send_from_carol,
[{var,1},{var,2}]}},
{set,{var,27},
{call,send_messages_command_generator,wait_for_msgs_geralt,
[{var,2},[{var,26},{var,25}]]}}] The last function Also, curious fact to me is the var sequence in the minimal example. We can see that after |
I do not fully understand all the gory details of your program but your commands look like: [{call, ?MODULE, connect_carol, []} || not Carol] ++ [{call, ?MODULE, connect_geralt, []} || not Geralt] ++ [{call, ?MODULE, send_from_carol, [S#state.carol, S#state.geralt]} || Users] ++ [{call, ?MODULE, send_from_geralt, [S#state.geralt, S#state.carol]} || Users] ++ [{call, ?MODULE, wait_for_msgs_carol, [S#state.carol, S#state.msgs_to_carol]} || MsgsToCarol] ++ [{call, ?MODULE, wait_for_msgs_geralt, [S#state.geralt, S#state.msgs_to_geralt]} || MsgsToGeralt]. The Anyway, if you want the following that you write:
shouldn't the commands you have defined look like this instead? [{call, ?MODULE, connect_carol, []} || not Carol] ++ [{call, ?MODULE, connect_geralt, []} || not Geralt] ++ [{call, ?MODULE, send_from_carol, [S#state.carol, S#state.geralt]} || Users] ++ [{call, ?MODULE, send_from_geralt, [S#state.geralt, S#state.carol]} || Users] ++ [{call, ?MODULE, wait_for_msgs_carol, [S#state.carol | S#state.msgs_to_carol]} || MsgsToCarol] ++ [{call, ?MODULE, wait_for_msgs_geralt, [S#state.geralt | S#state.msgs_to_geralt]} || MsgsToGeralt]. Note the |
Rethinking my answer/suggestion above, I actually do not see what the problem with the original code is. Bottomline: either there is no problem in PropEr, or you have not explained well/precisely what the problem is. |
Thanks for looking at my issue @kostis. I probably could describe the problem better. Let me try again. Big picture: this test generates commands for sending messages from The main issue I've found is the last generated command which looks like this: {set,{var,27},
{call,send_messages_command_generator,wait_for_msgs_geralt,
[{var,2},[{var,26},{var,25}]]}}] It looks fine, 2 arguments are passed, the second being the list of messages sent form My question is: why message Please note that, this wrong list of messages is generated only when proper tries to shrink commands to find minimal case. |
@kostis, is my latest explanation clear enough or do you have other questions? |
I've created this [1]
proper_statem
which tests sending messages between XMPP users connected over BOSH or WS. In some cases the generated commands look like this:The error is in the
wait_for_msgs_carol
function. It should take[{var 18}, {var, 3}]
as the second arg, but somehow it takes[{var 18}]
.{var, 18}
and{var, 3}
are results ofsend_from_geralt
function, and they are added to the statem's state. When I traced the state changes, it looked ok, both results where on the correct list but somehow in the end thewait_for_msgs_carol
function was invoked with wrong list.Am I doing sth wrong in my statem's implementation?
[1]. bosh_interleave_reqs.erl
The text was updated successfully, but these errors were encountered: