Backed out 2 changesets (bug 1723536, bug 1723198) for causing xpcshell failures on test_SocketScalars.js. CLOSED TREE

Backed out changeset 16c398716c60 (bug 1723198)
Backed out changeset 47c08d2c33f4 (bug 1723536)
This commit is contained in:
Iulian Moraru 2021-08-09 20:16:59 +03:00
Родитель c136a57852
Коммит 01f91c94a7
13 изменённых файлов: 6 добавлений и 196 удалений

Просмотреть файл

@ -6,7 +6,4 @@
# This is a list of directories containing tests to run, separated by spaces.
# Most likely, tho, you won't use more than one directory here.
XPCSHELL_TESTS_MANIFESTS += [
"unit/xpcshell-with-prefs.ini",
"unit/xpcshell.ini",
]
XPCSHELL_TESTS_MANIFESTS += ["unit/xpcshell.ini"]

Просмотреть файл

@ -1,49 +0,0 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
const { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm");
function isValidPref(prefName) {
return Services.prefs.getPrefType(prefName) !== Services.prefs.PREF_INVALID;
}
// Check a pref that appears in testing/profiles/xpcshell/user.js
// but NOT in StaticPrefList.yaml, modules/libpref/init/all.js
function has_pref_from_xpcshell_user_js() {
return isValidPref("extensions.webextensions.warnings-as-errors");
}
// Test pref from xpcshell-with-prefs.ini
function has_pref_from_manifest_defaults() {
return isValidPref("dummy.pref.from.test.manifest");
}
// Test pref set in xpcshell.ini and xpcshell-with-prefs.ini
function has_pref_from_manifest_file_section() {
return isValidPref("dummy.pref.from.test.file");
}
function check_common_xpcshell_with_prefs() {
Assert.ok(
has_pref_from_xpcshell_user_js(),
"Should have pref from xpcshell's user.js"
);
Assert.ok(
has_pref_from_manifest_defaults(),
"Should have pref from DEFAULTS in xpcshell-with-prefs.ini"
);
}
function check_common_xpcshell_without_prefs() {
Assert.ok(
has_pref_from_xpcshell_user_js(),
"Should have pref from xpcshell's user.js"
);
Assert.ok(
!has_pref_from_manifest_defaults(),
"xpcshell.ini did not set any prefs in DEFAULTS"
);
}

Просмотреть файл

@ -1,15 +0,0 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
function run_test() {
/* import-globals-from prefs_test_common.js */
load("prefs_test_common.js");
check_common_xpcshell_with_prefs();
Assert.ok(
!has_pref_from_manifest_file_section(),
"Should not have pref that was only assigned to a different test"
);
}

Просмотреть файл

@ -1,39 +0,0 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
function run_test() {
/* import-globals-from prefs_test_common.js */
load("prefs_test_common.js");
check_common_xpcshell_with_prefs();
Assert.ok(
has_pref_from_manifest_file_section(),
"Should have pref set for file in xpcshell-with-prefs.ini"
);
Assert.equal(
Services.prefs.getIntPref("dummy.pref.from.test.file"),
2,
"Value of pref that was set once at the file in xpcshell-with-prefs.ini"
);
Assert.equal(
Services.prefs.getStringPref("dummy.pref.from.test.duplicate"),
"final",
"The last pref takes precedence when duplicated"
);
Assert.equal(
Services.prefs.getIntPref("dummy.pref.from.test.manifest"),
1337,
"File-specific pref takes precedence over manifest defaults"
);
Assert.equal(
Services.prefs.getStringPref("dummy.pref.from.test.ancestor"),
"Ancestor",
"Pref in manifest defaults without file-specific override should be set"
);
}

Просмотреть файл

@ -1,16 +0,0 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
function run_test() {
/* import-globals-from prefs_test_common.js */
load("prefs_test_common.js");
check_common_xpcshell_with_prefs();
Assert.equal(
Services.prefs.getStringPref("dummy.pref.from.test.ancestor"),
"ReplacedParent",
"Pref set in included test manifest takes precedence over ancestor"
);
}

Просмотреть файл

@ -1,15 +0,0 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
function run_test() {
/* import-globals-from prefs_test_common.js */
load("prefs_test_common.js");
check_common_xpcshell_without_prefs();
Assert.ok(
!has_pref_from_manifest_file_section(),
"Should not have pref that was only assigned to a different test"
);
}

Просмотреть файл

@ -1,15 +0,0 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
function run_test() {
/* import-globals-from prefs_test_common.js */
load("prefs_test_common.js");
check_common_xpcshell_without_prefs();
Assert.ok(
has_pref_from_manifest_file_section(),
"Should have pref set for file in xpcshell.ini"
);
}

Просмотреть файл

@ -1,5 +0,0 @@
# This file is included by xpcshell-with-prefs.ini
[DEFAULT]
prefs = dummy.pref.from.test.ancestor=ReplacedParent
[test_prefs_defaults_included.js]

Просмотреть файл

@ -1,16 +0,0 @@
[DEFAULT]
head =
support-files = prefs_test_common.js
prefs =
dummy.pref.from.test.ancestor=Ancestor
dummy.pref.from.test.manifest=1
[test_prefs_defaults.js]
[test_prefs_defaults_and_file.js]
prefs = # Multiple prefs, for additional test coverage over xpcshell.ini
dummy.pref.from.test.file=2
dummy.pref.from.test.duplicate=first
dummy.pref.from.test.duplicate=final
dummy.pref.from.test.manifest=1337 # overrides manifest
[include:xpcshell-included-with-prefs.ini]

Просмотреть файл

@ -11,9 +11,6 @@ support-files =
load_subscript.js
location_load.js
check_profile.js
prefs_test_common.js
# NOTE: Do NOT set prefs= here. If you do, move test_prefs_no_defaults.js and
# test_prefs_no_defaults_with_file.js to a new file without "prefs =".
[test_check_nsIException.js]
skip-if = os == "win" && debug
@ -29,9 +26,6 @@ skip-if = os == "win" && debug
[test_load.js]
[test_load_httpd_js.js]
[test_location.js]
[test_prefs_no_defaults.js]
[test_prefs_no_defaults_with_file.js]
prefs = dummy.pref.from.test.file=1
[test_profile.js]
[test_profile_afterChange.js]
[test_sample.js]

Просмотреть файл

@ -140,12 +140,10 @@ class RemoteXPCShellTestThread(xpcshell.XPCShellTestThread):
self.device.mkdir(path, parents=True, timeout=timeout)
def updateTestPrefsFile(self):
# The base method will either be no-op (and return the existing
# remote path), or return a path to a new local file.
testPrefsFile = xpcshell.XPCShellTestThread.updateTestPrefsFile(self)
if testPrefsFile == self.rootPrefsFile:
# The pref file is the shared one, which has been already pushed on the
# device, and so there is nothing more to do here.
# devide, and so there is nothing more to do here.
return self.rootPrefsFile
# Push the per-test prefs file in the remote temp dir.
@ -500,9 +498,7 @@ class XPCShellRemote(xpcshell.XPCShellTests, object):
remotePrefsFile = posixpath.join(self.remoteTestRoot, "user.js")
self.device.push(self.prefsFile, remotePrefsFile)
self.device.chmod(remotePrefsFile)
# os.remove(self.prefsFile) is not called despite having pushed the
# file to the device, because the local file is relied upon by the
# updateTestPrefsFile method
os.remove(self.prefsFile)
self.prefsFile = remotePrefsFile
return prefs

Просмотреть файл

@ -401,7 +401,7 @@ class XPCShellTestThread(Thread):
self.clean_temp_dirs(self.test_object["path"])
def updateTestPrefsFile(self):
# If the Manifest file has some additional prefs, merge the
# If the Manifest file has some additiona prefs, merge the
# prefs set in the user.js file stored in the _rootTempdir
# with the prefs from the manifest and the prefs specified
# in the extraPrefs option.
@ -415,7 +415,6 @@ class XPCShellTestThread(Thread):
filename = "user.js"
interpolation = {"server": "dummyserver"}
profile = Profile(profile=localTempDir, restore=False)
# _rootTempDir contains a user.js file, generated by buildPrefsFile
profile.merge(self._rootTempDir, interpolation=interpolation)
prefs = self.test_object["prefs"].strip().split()
@ -437,7 +436,6 @@ class XPCShellTestThread(Thread):
return os.path.join(profile.profile, filename)
# Return the root prefsFile if there is no other prefs to merge.
# This is the path set by buildPrefsFile.
return self.rootPrefsFile
def buildCmdTestFile(self, name):
@ -1149,12 +1147,6 @@ class XPCShellTests(object):
}
profile = Profile(profile=self.tempDir, restore=False)
prefsFile = os.path.join(profile.profile, "user.js")
# Empty the user.js file in case the file existed before.
with open(prefsFile, "w"):
pass
for name in base_profiles:
path = os.path.join(profile_data_dir, name)
profile.merge(path, interpolation=interpolation)
@ -1163,7 +1155,7 @@ class XPCShellTests(object):
prefs = parse_preferences(extraPrefs)
profile.set_preferences(prefs)
self.prefsFile = prefsFile
self.prefsFile = os.path.join(profile.profile, "user.js")
return prefs
def buildCoreEnvironment(self):

Просмотреть файл

@ -182,6 +182,7 @@ skip-if = os == "android" # Android: Bug 1700482
[test_ext_sandbox_var.js]
[test_ext_sandboxed_resource.js]
[test_ext_schema.js]
skip-if = os == "android" # Android: Bug 1680132
[test_ext_script_filenames.js]
[test_ext_shared_workers.js]
[test_ext_shutdown_cleanup.js]