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 path: filePath
}); });
}, },
read: function read(path, bytes) { read: function read(path, bytes, options) {
let data = File.read(Type.path.fromMsg(path), bytes); let data = File.read(Type.path.fromMsg(path), bytes);
return new Transfer({buffer: data.buffer, byteOffset: data.byteOffset, byteLength: data.byteLength}, [data.buffer]); 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 currentDir = yield OS.File.getCurrentDirectory();
let pathSource = OS.Path.join(currentDir, EXISTING_FILE); let pathSource = OS.Path.join(currentDir, EXISTING_FILE);
let copyFile = pathSource + ".bak"; let copyFile = pathSource + ".bak";
let testOptions = function testOptions(options) { let testOptions = function testOptions(options, name) {
test.info("Gathered method duration time: " + test.info("Checking outExecutionDuration for operation: " + name);
options.outExecutionDuration + " MS"); test.info(name + ": Gathered method duration time: " +
options.outExecutionDuration + "ms");
// Making sure that duration was updated. // Making sure that duration was updated.
test.ok(typeof options.outExecutionDuration === "number" && test.ok(typeof options.outExecutionDuration === "number",
options.outExecutionDuration >= 0, name + ": Operation duration is a number");
"Operation duration time was updated correctly with a numeric value."); test.ok(options.outExecutionDuration >= 0,
name + ": Operation duration time is non-negative.");
}; };
// Testing duration of OS.File.copy. // Testing duration of OS.File.copy.
yield OS.File.copy(pathSource, copyFile, copyOptions); yield OS.File.copy(pathSource, copyFile, copyOptions);
testOptions(copyOptions); testOptions(copyOptions, "OS.File.copy");
yield OS.File.remove(copyFile); yield OS.File.remove(copyFile);
// Trying an operation where options are cloned. // Trying an operation where options are cloned.
@ -986,7 +988,7 @@ let test_duration = maketest("duration", function duration(test) {
outExecutionDuration: null outExecutionDuration: null
}; };
let contents = yield OS.File.read(pathSource, undefined, readOptions); 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. // Options structure passed to a OS.File writeAtomic method.
let writeAtomicOptions = { let writeAtomicOptions = {
// This field should be first initialized with the actual // This field should be first initialized with the actual
@ -995,7 +997,7 @@ let test_duration = maketest("duration", function duration(test) {
tmpPath: tmpPath tmpPath: tmpPath
}; };
yield OS.File.writeAtomic(pathDest, contents, writeAtomicOptions); yield OS.File.writeAtomic(pathDest, contents, writeAtomicOptions);
testOptions(writeAtomicOptions); testOptions(writeAtomicOptions, "OS.File.writeAtomic");
yield OS.File.remove(pathDest); yield OS.File.remove(pathDest);
test.info("Ensuring that we can use outExecutionDuration to accumulate durations"); test.info("Ensuring that we can use outExecutionDuration to accumulate durations");