I have autocompletion enabled for drush commands. When trying to "double-tab" for drush test-run, the following error is thrown:

preg_grep() expects parameter 2 to be array, integer given           [warning]
complete.inc:273
Drush command terminated abnormally due to an unrecoverable error.   [error]
Error: Unsupported operand types in
/usr/local/drush/includes/complete.inc, line 176
CommentFileSizeAuthor
#7 1496426.patch776 bytesowen barton
#5 1496426.patch749 bytesowen barton

Comments

moshe weitzman’s picture

Status: Active » Postponed (maintainer needs more info)

WHat version of Drupal are you using? This is working for me in Drupal 7. Might be a good idea to disable any contrib/custom modules that supply tests.

daften’s picture

Latest stable drupal version (7.12). I am getting errors on all my site.
Sometimes it's the following though:

rush command terminated abnormally due to an unrecoverable error.   [error]
Error: Call to undefined function module_exists() in
/usr/local/drush/commands/core/test.drush.inc, line 56

I am on Mac OS X Lion, maybe there's an issue there.

moshe weitzman’s picture

Version: 7.x-5.0-rc5 » 7.x-5.0
Status: Postponed (maintainer needs more info) » Fixed

now suppressing that error, but you will still need to figure out why your site can't bootstrap properly. probably a rogue contrib module

daften’s picture

I don't think that's the issue, simply running drush test-run for a site works fine, it's the autocomplete that's the issue.
I've added --complete-debug and this is the output for "drush test-run " (the space is important, completing the command itself works):

Cache HIT cid: 5.0-complete-0c3c171f331c22cd7e78b2421e52c41e [0 sec,     [debug]
3.49 MB]
Cache MISS cid: 5.0-complete-3402c67c0b4d982ad34565686a065de4 [0.01      [debug]
sec, 3.46 MB]
Drush bootstrap phase : _drush_bootstrap_drush() [0.01 sec, 3.65 MB] [bootstrap]
array_keys() expects parameter 1 to be array, null given test.drush.inc:60                                                                                                               [warning]
array_walk() expects parameter 1 to be array, integer given complete.inc:474                                                                                                             [warning]
preg_grep() expects parameter 2 to be array, integer given complete.inc:273                                                                                                              [warning]
Drush command terminated abnormally due to an unrecoverable error.                                                                                                                       [error]
Error: Unsupported operand types in /usr/local/drush/includes/complete.inc, line 176

I've tried digging into the code, but got a bit lost after a while :s

owen barton’s picture

Status: Fixed » Needs review
StatusFileSize
new749 bytes

This patch fixes both issues for me - incorrect bootstrap level check (#2), and providing a funky values array back on fail (#4) for me.

Please give it a try and report back! You will probably need to run "drush cc drush" if you have the borked (#4) values cached.

daften’s picture

Status: Needs review » Needs work

Jup, no more error message, but the list of tests isn't shown either (which I thought was the expected behavior)
And yes, simpletest is enabled. :)

owen barton’s picture

StatusFileSize
new776 bytes

Oh yeah - minor detail :)

owen barton’s picture

Status: Needs work » Needs review
daften’s picture

Yep, that does it. Nice work! (did need to clean drush cache off course)

moshe weitzman’s picture

Status: Needs review » Fixed

committed

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.