tweak to test timing code

RESOLVED FIXED in mozilla2.0b5

Status

RESOLVED FIXED
8 years ago
8 months ago

People

(Reporter: Gavin, Assigned: Gavin)

Tracking

Trunk
mozilla2.0b5
x86
Mac OS X
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment, 1 obsolete attachment)

Followup to bug 585396.
Created attachment 468099 [details] [diff] [review]
patch

-switches to seconds rather than milliseconds (most tests are 0 seconds)
-move to nextTest rather than realNextTest, so that time spent in waitForWindowState isn't counted (also makes it easier to use currentTest.addResult which takes care of specifying the filename automatically, but change TEST-END to TEST-INFO)
- the fact that we're in |if (this.currentTest)| means we don't need to check |if (this.lastStartTime)| (unless loadSubScript fails for the first test, but I don't think that's possible)
Assignee: nobody → gavin.sharp
Status: NEW → ASSIGNED
Attachment #468099 - Flags: review?(dtownsend)
Is there a particular reason to lose the millisecond accuracy?
You don't actually lose it, it just gets printed out differently ("43.356 s" vs. "43356 ms").
Comment on attachment 468099 [details] [diff] [review]
patch

Ah right, missed that.

>diff --git a/testing/mochitest/browser-test.js b/testing/mochitest/browser-test.js
>       let testScope = this.currentTest.scope;
>       while (testScope.__cleanupFunctions.length > 0) {
>         let func = testScope.__cleanupFunctions.shift();
>         func.apply(testScope);
>       };
>+
>+      // Note the test run time
>+      let time = Date.now() - this.lastStartTime;
>+      let msg = "Test took " + (time/1000) + "s to complete\n";

Spaces around the operator please.
Attachment #468099 - Flags: review?(dtownsend) → review+
Created attachment 468379 [details] [diff] [review]
patch
Attachment #468099 - Attachment is obsolete: true
Keywords: checkin-needed
http://hg.mozilla.org/mozilla-central/rev/b482b95acf21
Status: ASSIGNED → RESOLVED
Last Resolved: 8 years ago
Keywords: checkin-needed
Resolution: --- → FIXED
Version: unspecified → Trunk
Target Milestone: --- → mozilla2.0b5
Component: BrowserTest → Mochitest
Product: Testing → Testing
You need to log in before you can comment on or make changes to this bug.