drush-ops/drush — pull request #646 by xendk (2014-05-26 06:58:48+00:00)
Title: Testing output and timeout

This in not quite complete yet, but I'm creating a pull request to gather some feedback.

I've reworked command running and output here, resulting in less output per default and other improvements:

It's now using proc_open. Which means that stderr is now captured.

As a side effect of using proc_open, getOutput() now returns the output of the command verbatim (including trailing newlines), which means that some tests needed to be updated.

When the return code isn't the expected, the command line and it's output it printed, to ease debugging.

A timeout is enforced, failing the test if the command runs for too long. Also prints the command, and any partial output.

And I've eliminated the output when not using --verbose and --debug, so now the progress indication from phpunit doesn't get drowned in logging of command lines. As many Drush tests run long, I've added a function that creates a throbber which the execute command uses, which automatically provides some feedback for tests that runs a lot of commands, and other long running test methods can use.

It's not green on Travis yet, but I wanted some feedback and hear your opinions on:

I considered adding getTrimmedOutput() and getTrimmedErrOutput() so everybody don't have to add a trim.

Also a assertNoErrOutput().

Also, I was thinking of raising the execute_timeout to something large (say, half an hour), and instead implementing a shorter timeout that would instead reset on output from the command.