Bug 1506559 - Enable ESLint for memory/replace/dmd/test/. r=njn

Differential Revision: https://phabricator.services.mozilla.com/D11619

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Mark Banner 2018-11-13 09:07:38 +00:00
parent 8d34d6b733
commit 50fbf54ef3
3 changed files with 14 additions and 11 deletions

View file

@ -26,7 +26,6 @@ gfx/tests/chrome/**
gfx/tests/mochitest/** gfx/tests/mochitest/**
image/** image/**
layout/** layout/**
memory/replace/dmd/test/**
modules/** modules/**
netwerk/cookie/test/browser/** netwerk/cookie/test/browser/**
netwerk/test/browser/** netwerk/test/browser/**

View file

@ -0,0 +1,7 @@
"use strict";
module.exports = {
"extends": [
"plugin:mozilla/xpcshell-test"
]
};

View file

@ -6,9 +6,8 @@
"use strict"; "use strict";
var {classes: Cc, interfaces: Ci, utils: Cu} = Components
ChromeUtils.import("resource://gre/modules/FileUtils.jsm"); ChromeUtils.import("resource://gre/modules/FileUtils.jsm");
ChromeUtils.import("resource://gre/modules/Services.jsm");
// The xpcshell test harness sets PYTHON so we can read it here. // The xpcshell test harness sets PYTHON so we can read it here.
var gEnv = Cc["@mozilla.org/process/environment;1"] var gEnv = Cc["@mozilla.org/process/environment;1"]
@ -30,8 +29,7 @@ function getExecutable(aFilename) {
return file; return file;
} }
var gIsWindows = Cc["@mozilla.org/xre/app-info;1"] var gIsWindows = Services.appinfo.OS === "WINNT";
.getService(Ci.nsIXULRuntime).OS === "WINNT";
var gDmdTestFile = getExecutable("SmokeDMD" + (gIsWindows ? ".exe" : "")); var gDmdTestFile = getExecutable("SmokeDMD" + (gIsWindows ? ".exe" : ""));
var gDmdScriptFile = getExecutable("dmd.py"); var gDmdScriptFile = getExecutable("dmd.py");
@ -55,7 +53,7 @@ function readFile(aFile) {
data += str.value; data += str.value;
} while (read != 0); } while (read != 0);
cstream.close(); // this closes fstream cstream.close(); // this closes fstream
return data.replace(/\r/g, ""); // normalize line endings return data.replace(/\r/g, ""); // normalize line endings
} }
@ -78,7 +76,7 @@ function test(aPrefix, aArgs) {
let args = [ let args = [
gDmdScriptFile.path, gDmdScriptFile.path,
"--filter-stacks-for-testing", "--filter-stacks-for-testing",
"-o", actualFile.path "-o", actualFile.path,
].concat(aArgs); ].concat(aArgs);
runProcess(new FileUtils.File(gPythonName), args); runProcess(new FileUtils.File(gPythonName), args);
@ -136,7 +134,7 @@ function run_test() {
// in-place (to fix stacks) when it runs dmd.py, and that's not safe to do // in-place (to fix stacks) when it runs dmd.py, and that's not safe to do
// asynchronously. // asynchronously.
gEnv.set('DMD', '1'); gEnv.set("DMD", "1");
runProcess(gDmdTestFile, []); runProcess(gDmdTestFile, []);
@ -165,8 +163,7 @@ function run_test() {
jsonFile = FileUtils.getFile("CurWorkD", ["basic-scan.json"]); jsonFile = FileUtils.getFile("CurWorkD", ["basic-scan.json"]);
ok(scanTest(jsonFile.path), "Basic scan test"); ok(scanTest(jsonFile.path), "Basic scan test");
let is64Bit = Cc["@mozilla.org/xre/app-info;1"] let is64Bit = Services.appinfo.is64Bit;
.getService(Ci.nsIXULRuntime).is64Bit;
let basicScanFileName = "basic-scan-" + (is64Bit ? "64" : "32"); let basicScanFileName = "basic-scan-" + (is64Bit ? "64" : "32");
test(basicScanFileName, ["--clamp-contents", jsonFile.path]); test(basicScanFileName, ["--clamp-contents", jsonFile.path]);
ok(scanTest(jsonFile.path, ["--clamp-contents"]), "Scan with address clamping"); ok(scanTest(jsonFile.path, ["--clamp-contents"]), "Scan with address clamping");
@ -187,7 +184,7 @@ function run_test() {
// of the tested values. // of the tested values.
jsonFile = FileUtils.getFile("CurWorkD", ["script-max-frames.json"]); jsonFile = FileUtils.getFile("CurWorkD", ["script-max-frames.json"]);
test("script-max-frames-8", test("script-max-frames-8",
[jsonFile.path]); // --max-frames=8 is the default [jsonFile.path]); // --max-frames=8 is the default
test("script-max-frames-3", test("script-max-frames-3",
["--max-frames=3", "--no-fix-stacks", jsonFile.path]); ["--max-frames=3", "--no-fix-stacks", jsonFile.path]);
test("script-max-frames-1", test("script-max-frames-1",