Bug 874425 - More logging in outExecutionDuration tests.
authorDavid Rajchenbach-Teller <dteller@mozilla.com>
Wed, 29 May 2013 20:56:08 -0400
changeset 133384 a70d601365c52b440241c6f2c4851e9da763f6c8
parent 133383 79cd6c91292bc9656a1bcf4db7a3ef03b77a0061
child 133385 f6faa7dae09582ec044c03da2dc083c1963f5136
push id24751
push userryanvm@gmail.com
push dateThu, 30 May 2013 15:43:11 +0000
treeherdermozilla-central@75407626ba46 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs874425
milestone24.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 874425 - More logging in outExecutionDuration tests.
toolkit/components/osfile/osfile_async_worker.js
toolkit/components/osfile/tests/mochi/main_test_osfile_async.js
--- a/toolkit/components/osfile/osfile_async_worker.js
+++ b/toolkit/components/osfile/osfile_async_worker.js
@@ -266,17 +266,17 @@ if (this.Components) {
          let filePath = Type.path.fromMsg(path);
          let file = File.open(filePath, mode, options);
          return OpenedFiles.add(file, {
            // Adding path information to keep track of opened files
            // to report leaks when debugging.
            path: filePath
          });
        },
-       read: function read(path, bytes) {
+       read: function read(path, bytes, options) {
          let data = File.read(Type.path.fromMsg(path), bytes);
          return new Transfer({buffer: data.buffer, byteOffset: data.byteOffset, byteLength: data.byteLength}, [data.buffer]);
        },
        exists: function exists(path) {
          return File.exists(Type.path.fromMsg(path));
        },
        writeAtomic: function writeAtomic(path, buffer, options) {
          if (options.tmpPath) {
--- a/toolkit/components/osfile/tests/mochi/main_test_osfile_async.js
+++ b/toolkit/components/osfile/tests/mochi/main_test_osfile_async.js
@@ -960,47 +960,49 @@ let test_duration = maketest("duration",
     let copyOptions = {
       // This field should be overridden with the actual duration
       // measurement.
       outExecutionDuration: null
     };
     let currentDir = yield OS.File.getCurrentDirectory();
     let pathSource = OS.Path.join(currentDir, EXISTING_FILE);
     let copyFile = pathSource + ".bak";
-    let testOptions = function testOptions(options) {
-      test.info("Gathered method duration time: " +
-        options.outExecutionDuration + " MS");
+    let testOptions = function testOptions(options, name) {
+      test.info("Checking outExecutionDuration for operation: " + name);
+      test.info(name + ": Gathered method duration time: " +
+        options.outExecutionDuration + "ms");
       // Making sure that duration was updated.
-      test.ok(typeof options.outExecutionDuration === "number" &&
-        options.outExecutionDuration >= 0,
-        "Operation duration time was updated correctly with a numeric value.");
+      test.ok(typeof options.outExecutionDuration === "number",
+              name + ": Operation duration is a number");
+      test.ok(options.outExecutionDuration >= 0,
+              name + ": Operation duration time is non-negative.");
     };
     // Testing duration of OS.File.copy.
     yield OS.File.copy(pathSource, copyFile, copyOptions);
-    testOptions(copyOptions);
+    testOptions(copyOptions, "OS.File.copy");
     yield OS.File.remove(copyFile);
 
     // Trying an operation where options are cloned.
     let pathDest = OS.Path.join(OS.Constants.Path.tmpDir,
       "osfile async test read writeAtomic.tmp");
     let tmpPath = pathDest + ".tmp";
     let readOptions = {
       outExecutionDuration: null
     };
     let contents = yield OS.File.read(pathSource, undefined, readOptions);
-    testOptions(readOptions);
+    testOptions(readOptions, "OS.File.read");
     // Options structure passed to a OS.File writeAtomic method.
     let writeAtomicOptions = {
       // This field should be first initialized with the actual
       // duration measurement then progressively incremented.
       outExecutionDuration: null,
       tmpPath: tmpPath
     };
     yield OS.File.writeAtomic(pathDest, contents, writeAtomicOptions);
-    testOptions(writeAtomicOptions);
+    testOptions(writeAtomicOptions, "OS.File.writeAtomic");
     yield OS.File.remove(pathDest);
 
     test.info("Ensuring that we can use outExecutionDuration to accumulate durations");
 
     let ARBITRARY_BASE_DURATION = 5;
     copyOptions = {
       // This field should now be incremented with the actual duration
       // measurement.