Closed Bug 1190574 Opened 9 years ago Closed 9 years ago

Test harness functions like test.chain.replace aren't asserting inputs, hiding bad tests.

Categories

(Core :: WebRTC, defect, P1)

defect

Tracking

()

RESOLVED FIXED
mozilla45
Tracking Status
firefox42 --- affected
firefox45 --- fixed

People

(Reporter: jib, Assigned: jib)

References

Details

Attachments

(1 file, 3 obsolete files)

With a patch that catches this, I found these broken tests (which I've fixed):

> 21114 INFO TEST-UNEXPECTED-FAIL | dom/media/tests/mochitest/test_peerConnection_forwarding_basicAudioVideoCombined.html | Error executing test: Error: Unknown test: PC_REMOTE_CHECK_MEDIA_FLOW_PRESENT
> 25134 INFO TEST-UNEXPECTED-FAIL | dom/media/tests/mochitest/test_peerConnection_relayOnly.html | Error executing test: Error: Unknown test: PC_LOCAL_SETURP_ICE_HANDLER
> 30551 INFO TEST-UNEXPECTED-FAIL | dom/media/tests/mochitest/test_peerConnection_replaceTrack.html | Error executing test: Error: Unknown test: PC_REMOTE_CHECK_MEDIA_FLOW_PRESENT
> 31887 INFO TEST-UNEXPECTED-FAIL | dom/media/tests/mochitest/test_peerConnection_syncSetDescription.html | Error executing test: Error: Unknown test: [object Object]
> 31903 INFO TEST-UNEXPECTED-FAIL | dom/media/tests/mochitest/test_peerConnection_forwarding_basicAudioVideoCombined.html | Error executing test: Error: Unknown test: PC_REMOTE_CHECK_MEDIA_FLOW_PRESENT
Bug 1190574 - make test.chain.replace and cohorts throw on unknown test name + fix broken tests
Attachment #8642618 - Flags: review?(drno)
Ignore dom/media/tests/mochitest/test_peerConnection_relayOnly.html, that's one I was testing with in Bug 1187775, which is how I stumbled on this.
Comment on attachment 8642618 [details]
MozReview Request: Bug 1190574 - make test.chain.replace and cohorts throw on unknown test name + fix broken tests

Bug 1190574 - make test.chain.replace and cohorts throw on unknown test name + fix broken tests
Attachment #8642618 - Flags: review?(drno)
Comment on attachment 8642618 [details]
MozReview Request: Bug 1190574 - make test.chain.replace and cohorts throw on unknown test name + fix broken tests

https://reviewboard.mozilla.org/r/14739/#review13335

::: dom/media/tests/mochitest/test_selftest.html:28
(Diff revision 2)
> +  is(catcher(() => test.chain.replace("PC_LOCAL_SET_LOCAL_DESCRIPTION", TEST)),
> +     null, "test.chain.replace works");
> +  is(catcher(() => test.chain.replace("FOO", TEST)),
> +     "Unknown test: FOO", "test.chain.replace catches typos");

This makes me wonder if we should have something more detailed, where we verify that every single of the chain functions works as expected.
Comment on attachment 8642618 [details]
MozReview Request: Bug 1190574 - make test.chain.replace and cohorts throw on unknown test name + fix broken tests

https://reviewboard.mozilla.org/r/14739/#review13337

Ship It!
Attachment #8642618 - Flags: review+
(In reply to Nils Ohlmeier [:drno] from comment #4)
> This makes me wonder if we should have something more detailed, where we
> verify that every single of the chain functions works as expected.

I think that's a good idea. Feel free to expound on it or open a followup bug.
backlog: --- → webRTC+
Rank: 10
Priority: -- → P1
See Also: → 1203683
I filled bug 1203683 as a follow up.

jib: I thought you land this after my r+. Any reason not to land it?
Comment on attachment 8642618 [details]
MozReview Request: Bug 1190574 - make test.chain.replace and cohorts throw on unknown test name + fix broken tests

Bug 1190574 - make test.chain.replace and cohorts throw on unknown test name + fix broken tests
See Bug 1202046 comment 2 for why I didn't land this. Basically https://treeherder.mozilla.org/#/jobs?repo=try&revision=099d31b82ace showed "PeerConnectionWrapper (pcRemote): legal ICE state transition from new to failed" perma-failing when I enabled the missing tests. I've done a rebase and a new try to see if things have improved.
Oh sorry. I mis-read comment 2. I thought this would fix it. But you said it runs into the same error.

Hmm so if the rebasing doesn't magically fix it, we basically have a perma orange ICE connection issue. Let me know if that is the case. I would be interested in trying out a couple of things if that is the case.
Yup still perma-orange: https://treeherder.mozilla.org/#/jobs?repo=try&revision=f89edd89af4f

Yeah comment 2 was a different error which is gone. This is all Bug 1202046 now it seems.
Bug 1190574 - make test.chain.replace and cohorts throw on unknown test name + fix broken tests
Attachment #8661083 - Attachment is obsolete: true
Attachment #8661084 - Flags: review?(jib)
Comment on attachment 8661084 [details]
MozReview Request: Bug 1190574: added missing calls to release stored ICE candidates. r+jib

https://reviewboard.mozilla.org/r/19291/#review17227

::: dom/media/tests/mochitest/test_peerConnection_syncSetDescription.html:19
(Diff revision 1)
> -  test.pcLocal._pc.setLocalDescription(test.originalOffer);
> +  return new Promise((resolve, reject) =>
> +    test.pcLocal._pc.setLocalDescription(test.originalOffer, resolve, reject));

No, the whole point of this test is to verify that we support calling these methods without waiting for them to succeed. It's the only reason peerConnections still has an "operations" array [1]. It's a legacy thing back to the callback days when people signaled after createOffer rather than after setLocalDescription [2].

[1] http://w3c.github.io/webrtc-pc/#operation
[2] http://dev.w3.org/2011/webrtc/editor/webrtc-20120720.html#simple-example
(In reply to Jan-Ivar Bruaroey [:jib] from comment #14)
> Comment on attachment 8661084 [details]
> MozReview Request: Bug 1190574: really made sLD/sRD calls synchronos. r?jib
> 
> https://reviewboard.mozilla.org/r/19291/#review17227
> 
> ::: dom/media/tests/mochitest/test_peerConnection_syncSetDescription.html:19
> (Diff revision 1)
> > -  test.pcLocal._pc.setLocalDescription(test.originalOffer);
> > +  return new Promise((resolve, reject) =>
> > +    test.pcLocal._pc.setLocalDescription(test.originalOffer, resolve, reject));
> 
> No, the whole point of this test is to verify that we support calling these
> methods without waiting for them to succeed. It's the only reason
> peerConnections still has an "operations" array [1]. It's a legacy thing
> back to the callback days when people signaled after createOffer rather than
> after setLocalDescription [2].

As far as I know, whether you call with Promises or with Callbacks, you are
still required to queue.
Also, there's absolutely no reason you have to wait till after setLocalDescription() to signal, promises or otherwise.
Fair enough, but all our tests signal after setLocalDescription, except this one, so if we wait for success on this one as well, then we lose coverage.
You are right I missed what the point of this test is. I removed the promises. But the reason why the test fails without my latest patch is that the stored ICE candidates are never added on the far ends PeerConnection.
So if I add one single success callback to sRD() to release the ICE candidates into the PC then the test starts to fail. It appears the reason is that the wrapping of legacy calls with onSuccess callbacks into a Promise basically no longer guarantees that the wrapping Promise from sRD gets executed before the native promise based call into createAnswer().
Comment on attachment 8661084 [details]
MozReview Request: Bug 1190574: added missing calls to release stored ICE candidates. r+jib

Bug 1190574: added missing calls to release stored ICE candidates.
Attachment #8661084 - Attachment description: MozReview Request: Bug 1190574: really made sLD/sRD calls synchronos. r?jib → MozReview Request: Bug 1190574: added missing calls to release stored ICE candidates.
Attachment #8661084 - Flags: review?(jib)
So my latest patch only adds the releasing of the ICE candidates, which is the reason the test keeps failing.
But it now fails for the above mentioned reason. Jib can you take a look how to fix this best in PeerConnection.js?
I know we are mixing now old style with and without callback, plus Promise based createOffer and createAnswer. But we should probably fix it I think.
Comment on attachment 8661084 [details]
MozReview Request: Bug 1190574: added missing calls to release stored ICE candidates. r+jib

https://reviewboard.mozilla.org/r/19291/#review17315

::: dom/media/tests/mochitest/test_peerConnection_syncSetDescription.html:24
(Diff revision 2)
> -  test.pcRemote._pc.setRemoteDescription(test._local_offer);
> +  test.pcRemote._pc.setRemoteDescription(test._local_offer,
> +      test.pcRemote.releaseIceCandidates);

The legacy api is fickle. You can't call setLocal/RemoteDescription with two arguments. 1 (new) or 3 (old), but not 2. i.e. you need to add the required error callback here. Unfortunately, due to webidl overload limitations, the error about this is hidden. If you were to add:

    .catch(e => console.error(e))

to the tail of that call, before the semicolon, then you would see:

TypeError: Not enough arguments to mozRTCPeerConnection.setLocalDescription.

Hopefully, we wont be writing a lot of new legacy code after this test.
Attachment #8661084 - Flags: review?(jib)
I'm fairly confident PeerConnection.js is working here. Here's a fiddle showing sync setLD/RD in action, albeit with new promise methods https://jsfiddle.net/23mzs084/
Comment on attachment 8661084 [details]
MozReview Request: Bug 1190574: added missing calls to release stored ICE candidates. r+jib

Bug 1190574: added missing calls to release stored ICE candidates. r?jib
Attachment #8661084 - Attachment description: MozReview Request: Bug 1190574: added missing calls to release stored ICE candidates. → MozReview Request: Bug 1190574: added missing calls to release stored ICE candidates. r?jib
Attachment #8661084 - Flags: review?(jib)
Good catch. Yeah adding the error callback seem to make it work.
So here is the patch which fixes the missing relay of ICE candidates for this test.
Attachment #8661084 - Flags: review?(jib) → review+
Comment on attachment 8661084 [details]
MozReview Request: Bug 1190574: added missing calls to release stored ICE candidates. r+jib

https://reviewboard.mozilla.org/r/19291/#review17357

::: dom/media/tests/mochitest/test_peerConnection_syncSetDescription.html:25
(Diff revision 3)
> +      test.pcRemote.releaseIceCandidates, function() {});

We probably want generateErrorCallback there in case there's a problem.
Nils - is this ready to land?  See also bug 1202046 which used to go perma-orange with this patch.
Flags: needinfo?(jib)
Flags: needinfo?(jib) → needinfo?(drno)
Comment on attachment 8642618 [details]
MozReview Request: Bug 1190574 - make test.chain.replace and cohorts throw on unknown test name + fix broken tests

Review request updated; see interdiff: https://reviewboard.mozilla.org/r/14739/diff/3-4/
Bug 1190574: added missing calls to release stored ICE candidates. r?jib
Attachment #8683325 - Flags: review?(jib)
Comment on attachment 8683325 [details]
MozReview Request: Bug 1190574: added missing calls to release stored ICE candidates. r?jib

Just a rebase.
Attachment #8683325 - Flags: review?(jib) → review+
Comment on attachment 8661083 [details]
MozReview Request: Bug 1190574 - make test.chain.replace and cohorts throw on unknown test name + fix broken tests

Review request updated; see interdiff: https://reviewboard.mozilla.org/r/19289/diff/1-2/
Attachment #8661083 - Attachment is obsolete: false
Comment on attachment 8661084 [details]
MozReview Request: Bug 1190574: added missing calls to release stored ICE candidates. r+jib

Review request updated; see interdiff: https://reviewboard.mozilla.org/r/19291/diff/3-4/
Attachment #8661084 - Attachment description: MozReview Request: Bug 1190574: added missing calls to release stored ICE candidates. r?jib → MozReview Request: Bug 1190574: added missing calls to release stored ICE candidates. r+jib
Comment on attachment 8661084 [details]
MozReview Request: Bug 1190574: added missing calls to release stored ICE candidates. r+jib

Review request updated; see interdiff: https://reviewboard.mozilla.org/r/19291/diff/4-5/
Sorry I did not realized that this was still depending on me. Pushed the one change jib requested. Try run is on its way...
See Also: → 1202046
Seeing this in try in bug 1202046 comment 10:

> 15:00:37     INFO -  4275 INFO TEST-PASS | dom/media/tests/mochitest/test_selftest.html | test.chain.replace catches typos
> 15:00:37     INFO -  4276 INFO TEST-UNEXPECTED-FAIL | dom/media/tests/mochitest/test_selftest.html | Test timed out.
The try run in comment 32 apparently did not execute anything. Time to go back to bigger guns again...
Comment on attachment 8661084 [details]
MozReview Request: Bug 1190574: added missing calls to release stored ICE candidates. r+jib

Review request updated; see interdiff: https://reviewboard.mozilla.org/r/19291/diff/5-6/
(In reply to Jan-Ivar Bruaroey [:jib] from comment #34)
> Seeing this in try in bug 1202046 comment 10:
> 
> > 15:00:37     INFO -  4275 INFO TEST-PASS | dom/media/tests/mochitest/test_selftest.html | test.chain.replace catches typos
> > 15:00:37     INFO -  4276 INFO TEST-UNEXPECTED-FAIL | dom/media/tests/mochitest/test_selftest.html | Test timed out.

If we never call finish() in a test then it times out :-)

Lets see if the latest patch will turn green...
Attachment #8683325 - Attachment is obsolete: true
Flags: needinfo?(drno)
Attachment #8661083 - Attachment is obsolete: true
Attachment #8642618 - Attachment is obsolete: true
Try run looks sane
Keywords: checkin-needed
does 8c850071a79d	Bug 1190574 - make test.chain.replace and cohorts throw on unknown test name + fix broken tests	also need checkin ?
Flags: needinfo?(jib)
Yes, thanks.
Flags: needinfo?(jib)
Keywords: checkin-needed
https://hg.mozilla.org/mozilla-central/rev/689ca8a01248
https://hg.mozilla.org/mozilla-central/rev/203a48eb1726
Status: NEW → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla45
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: