Closed Bug 1164726 Opened 9 years ago Closed 9 years ago

Implement LogGrabber#pollMessages

Categories

(Testing Graveyard :: JSMarionette, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: gaye, Assigned: gaye)

References

Details

Attachments

(1 file)

It'd be nice to have a mechanism for marionette-js-logger to continuously poll the message queue (at some frequency for new messages).
For synchronous jsmarionette, I think this would mean piggybacking on other calls into the JSMarionette layer and sliding a call to poll/retrieve messages in there?  (Triggered by noticing Date.now() has passed the threshold timestamp we established last time we polled.)

Or were you thinking of something else?
I guess my first thought was just to add a method that called grabLogMessages with setTimeout/setInterval. Another option is to add something here https://github.com/mozilla-b2g/marionette-js-runner/blob/master/lib/runtime/hostmanager.js that ensures that the logs are consumed before we close the client. If we were going to do the piggybacking, then perhaps it would make sense to augment the client plugin api (currently just the setup method) with events/notifications for when client methods are called. For instance we could do

```js
// Inside marionette-js-logger
exports.setup = function(client) {
  // All the great things we were doing before...
  client.on('command', function(name) {
    grabber.grabLogMessages();
  });
};
```

Though LogGrabber#grabLogMessages calls client.executeScript() which would make us grabLogMessages forever...
Blocks: 1164687
Attachment #8605597 - Flags: feedback?(bugmail)
Assignee: nobody → gaye
Comment on attachment 8605597 [details] [review]
[gaia] gaye:bug-1164726 > mozilla-b2g:master

This seems like it works for what it does, but as noted previously, it assumes a marionette test that has returned control to the event loop.  It's my impression that most marionette tests end up synchronously blocked on things, so I don't expect this to be useful in practice.  If the goal is to make sure logs are retrieved before exiting, then I think the special handling you refer to in comment 2 is more appropriate.

I'd suggest adding a block comment that explains the circumstances under which pollMessages is useful (control flow returned / async execution), and not useful (any time a test is still doing synchronous stuff).  I would expect most people to expect this does something useful in the synchronous case when it doesn't.
Attachment #8605597 - Flags: feedback?(bugmail)
Comment on attachment 8605597 [details] [review]
[gaia] gaye:bug-1164726 > mozilla-b2g:master

r=self
Attachment #8605597 - Flags: review+
Landed on master https://github.com/mozilla-b2g/gaia/pull/30057
Status: NEW → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
Product: Testing → Testing Graveyard
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: