proper icon indicating copy to clipboard operation
proper copied to clipboard

run_parallel_commands doesn't handle exceptions in commands the same way run_commands does

Open x4lldux opened this issue 5 years ago • 6 comments

When a command crashes during run_parallel_commands, the entire test just crashes also, whilerun_commands catches such a situation and returns a exception tuple as a result. Shouldn't they work the same way?

x4lldux avatar Mar 25 '20 19:03 x4lldux

Please submit a minimal test case that illustrates the issue.

kostis avatar Mar 25 '20 20:03 kostis

I can, but it'll be in Elixir using PropCheck library (a thin wrapper around PropEr); my Erlang is not that strong. But I've traced the origin of it:

  • run_parallel_commands uses pmap to run commands in parallel, wrapped in execute,
  • execute is using apply BIF instead of safe_apply like run_commands does
  • pmap spawns process and awaits the answers,
  • spawned process catch any error, while executing the command, and send it as a message to pmap
  • when the message, pmap gets, is a crash it just rethrows it

So when a SUT has a crashes, run_commands will return {exception, _, _, _} tuple as a result, while run_parallel_commands just forwards the crash.

x4lldux avatar Mar 25 '20 21:03 x4lldux

I can, but it'll be in Elixir using PropCheck library (a thin wrapper around PropEr); my Erlang is not that strong.

Well, you've came to the PropEr (TM) repository. Here you have your chance to strengthen your Erlang skills ;-)

kostis avatar Mar 25 '20 21:03 kostis

Well, you've came to the PropEr (TM) repository.

Which runs on a BEAM™ that supports many other languages. Here you have your chance to make us feel included ;)

x4lldux avatar Mar 25 '20 22:03 x4lldux

@kostis test case added, see commit x4lldux/proper@c932eef62cfddc8a2726d09a2cb9bf5e81fd6015

x4lldux avatar Mar 26 '20 08:03 x4lldux

Also, the docs for run_parallel_commands are missing the exception tuple as a valid result type and that's what is being returned when command raises during the sequential part.

x4lldux avatar Mar 26 '20 18:03 x4lldux