Bug 874425 - More logging in outExecutionDuration tests.

This commit is contained in:
David Rajchenbach-Teller 2013-05-29 20:56:08 -04:00
parent 2644dad67f
commit 589f45c603
2 changed files with 12 additions and 10 deletions

View File

@ -271,7 +271,7 @@ if (this.Components) {
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]);
},

View File

@ -965,17 +965,19 @@ let test_duration = maketest("duration", function duration(test) {
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.
@ -986,7 +988,7 @@ let test_duration = maketest("duration", function duration(test) {
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
@ -995,7 +997,7 @@ let test_duration = maketest("duration", function duration(test) {
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");