Closed Bug 1033858 Opened 10 years ago Closed 10 years ago

View error output during marionette_js runs

Categories

(Firefox OS Graveyard :: General, defect)

x86
macOS
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED
2.0 S6 (18july)

People

(Reporter: daleharvey, Assigned: daleharvey)

References

Details

(Whiteboard: [systemsfe])

Attachments

(1 file, 1 obsolete file)

When running the integration test, VERBOSE=1 will output console.logs but not general gecko output (in particular error logs, like runtime errors and syntax errors)

I dont know of any way to access them, would vastly ease debugging tests
Am I missing something? or if not anyone wanna give me a little pointer to how to implement this?
Flags: needinfo?(gaye)
Hey Dale! Right now we listen to the console api via https://github.com/mozilla-b2g/marionette-js-logger/blob/master/lib/client.js#L422 and send stuff over a websocket to the node / cli-attached process. If you want to add more listening and message sending, it should be pretty straightforward and I would be happy to review.
Flags: needinfo?(gaye)
Summary: View gecko logs during marionettejs runs → View error output during marionette_js runs
Previously with marionette failures, if there was a syntax / runtime error in content there was absolutely no indication, it just meant that the test would hang. We have a listener on the console events but none for errors in the content. Now we get: 

[marionette error] app://verticalhome.gaiamobile.org/js/app.js:70 SyntaxError: let is a reserved identifier

I havent figured out how to get stack traces, if the content generates a console.error then we will get them, but |nsIConsoleService| doesnt hold that information, I suggest we file a follow up and I will take a look as this alone makes life debugging a thousand times easier
Attachment #8454414 - Flags: review?(gaye)
Assignee: nobody → dale
Also I based this patch on top of the other (https://bugzilla.mozilla.org/show_bug.cgi?id=1037390)
Paul, do you have any suggestions on how to get and display the stack trace when I observe an error via |nsIConsoleService|? I had been pointed to Components.stack however if I simply access that inside the observe callback I dont get back much useful 

  { language: 0,
     languageName: 'C++',
     filename: null,
     name: null,
     lineNumber: 0,
     sourceLine: '',
     caller: null }
Flags: needinfo?(paul)
Forwarding needinfo to Panos.
Flags: needinfo?(paul) → needinfo?(past)
You will need something like Console.jsm#getStack:

http://dxr.mozilla.org/mozilla-central/source/toolkit/devtools/Console.jsm#355

You should probably skip the frames that aren't JavaScript, which would have frame.language == 2:

https://developer.mozilla.org/docs/Mozilla/Tech/XPCOM/Reference/Interface/nsIProgrammingLanguage
Flags: needinfo?(past)
Added tests and rebased
Attachment #8454414 - Attachment is obsolete: true
Attachment #8454414 - Flags: review?(gaye)
Attachment #8454549 - Flags: review?(gaye)
Thanks Panos, sorry I should have guessed your bugzilla name but I didnt know it hence ni'ing paul

It seems to me that Components.stack.callee applied to the current stack, and not the stack in which the JS ran that triggered the error observer, but that was a guess, I will open a follow up bug to get stacks added to these, try it out and get back to you if I hit any problems
Comment on attachment 8454549 [details] [review]
https://github.com/mozilla-b2g/marionette-js-logger/pull/11

LGTM. You may rebase / merge / cherry-pick / whatever you like once travis passes. Thanks dale!
Attachment #8454549 - Flags: review?(gaye) → review+
Sweet thanks, merged: https://github.com/mozilla-b2g/marionette-js-logger/commit/bc3121e7ecb243fd1f261e43f5462355ba0b8bfa
Status: NEW → RESOLVED
Closed: 10 years ago
Resolution: --- → FIXED
Included in marionette-js-runner here, and bumped to 0.5.4: https://github.com/mozilla-b2g/marionette-js-runner/commits/master
Landed in gaia-node-modules: https://github.com/mozilla-b2g/gaia-node-modules/commit/78bf8043d77279dee3c6266b46cb117435ae9a54

Working on getting this into gaia now.
Whiteboard: [systemsfe]
Target Milestone: --- → 2.0 S6 (18july)
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: