Bug 1869204 - Batch 19.1 - migrate python/ mozbuild and mozbase .ini to toml. r=ahal,firefox-build-system-reviewers,ahochheiden

Differential Revision: https://phabricator.services.mozilla.com/D195995
This commit is contained in:
Joel Maher 2023-12-15 20:59:46 +00:00
parent e074614f1f
commit 90c34fbbd0
146 changed files with 452 additions and 1067 deletions

View file

@ -22,7 +22,7 @@ var TestFile = {
var file = Cc["@mozilla.org/file/directory_service;1"]
.getService(Ci.nsIProperties)
.get("CurWorkD", Ci.nsIFile);
file.append("xpcshell.ini");
file.append("xpcshell.toml");
// should be able to construct a file
var f1, f2;
@ -35,8 +35,8 @@ var TestFile = {
Assert.ok(f1 instanceof File, "Should be a DOM File");
Assert.ok(f2 instanceof File, "Should be a DOM File");
Assert.ok(f1.name == "xpcshell.ini", "Should be the right file");
Assert.ok(f2.name == "xpcshell.ini", "Should be the right file");
Assert.ok(f1.name == "xpcshell.toml", "Should be the right file");
Assert.ok(f2.name == "xpcshell.toml", "Should be the right file");
Assert.ok(f1.type == "", "Should be the right type");
Assert.ok(f2.type == "", "Should be the right type");

View file

@ -86,26 +86,26 @@ with Files("**/crashtest*.list"):
SCHEDULES.inclusive += ["test-verify", "test-verify-gpu"]
SCHEDULES.exclusive = ["crashtest"]
with Files("**/a11y.ini"):
with Files("**/a11y.toml"):
SCHEDULES.inclusive += ["test-verify", "test-verify-gpu"]
SCHEDULES.exclusive = ["mochitest-a11y"]
with Files("**/mochitest.ini"):
with Files("**/mochitest.toml"):
SCHEDULES.inclusive += ["test-verify", "test-verify-gpu"]
SCHEDULES.exclusive = ["mochitest-plain"]
with Files("**/browser.ini"):
with Files("**/browser.toml"):
SCHEDULES.inclusive += ["test-verify", "test-verify-gpu"]
SCHEDULES.exclusive = ["mochitest-browser-chrome"]
with Files("**/test*/**browser_*"):
SCHEDULES.exclusive = ["mochitest-browser-chrome"]
with Files("**/chrome.ini"):
with Files("**/chrome.toml"):
SCHEDULES.inclusive += ["test-verify", "test-verify-gpu"]
SCHEDULES.exclusive = ["mochitest-chrome"]
with Files("**/xpcshell.ini"):
with Files("**/xpcshell.toml"):
SCHEDULES.inclusive += ["test-verify", "test-verify-gpu"]
SCHEDULES.exclusive = ["xpcshell"]

View file

@ -468,6 +468,7 @@ ARCHIVE_FILES = {
"content_analysis_sdk_agent",
"http3server",
"*.ini",
"*.toml",
"localization/**",
"modules/**",
"update.locale",
@ -827,7 +828,7 @@ def find_manifest_dirs(topsrcdir, manifests):
for p in manifests:
p = os.path.join(topsrcdir, p)
if p.endswith(".ini"):
if p.endswith(".ini") or p.endswith(".toml"):
test_manifest = TestManifest()
test_manifest.read(p)
dirs |= set([os.path.dirname(m) for m in test_manifest.manifests()])

View file

@ -3,7 +3,7 @@
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
"""A generic script to verify all test files are in the
corresponding .ini file.
corresponding .toml file.
Usage: xpccheck.py <directory> [<directory> ...]
"""
@ -17,7 +17,7 @@ import manifestparser
def getIniTests(testdir):
mp = manifestparser.ManifestParser(strict=False)
mp.read(os.path.join(testdir, "xpcshell.ini"))
mp.read(os.path.join(testdir, "xpcshell.toml"))
return mp.tests
@ -48,7 +48,7 @@ def verifyDirectory(initests, directory):
)
% (
name,
os.path.join(directory, "xpcshell.ini"),
os.path.join(directory, "xpcshell.toml"),
),
file=sys.stderr,
)
@ -74,7 +74,7 @@ def verifyIniFile(initests, directory):
print(
(
"TEST-UNEXPECTED-FAIL | xpccheck | found "
"%s in xpcshell.ini and not in directory '%s'"
"%s in xpcshell.toml and not in directory '%s'"
)
% (
name,
@ -95,7 +95,7 @@ def main(argv):
for d in argv[1:]:
# xpcshell-unpack is a copy of xpcshell sibling directory and in the Makefile
# we copy all files (including xpcshell.ini from the sibling directory.
# we copy all files (including xpcshell.toml from the sibling directory.
if d.endswith("toolkit/mozapps/extensions/test/xpcshell-unpack"):
continue

View file

@ -1027,7 +1027,7 @@ class RecursiveMakeBackend(MakeBackend):
# Make the master test manifest files.
for flavor, t in self._test_manifests.items():
install_prefix, manifests = t
manifest_stem = mozpath.join(install_prefix, "%s.ini" % flavor)
manifest_stem = mozpath.join(install_prefix, "%s.toml" % flavor)
self._write_master_test_manifest(
mozpath.join(self.environment.topobjdir, "_tests", manifest_stem),
manifests,
@ -1757,7 +1757,7 @@ class RecursiveMakeBackend(MakeBackend):
)
for manifest in sorted(manifests):
master.write("[include:%s]\n" % manifest)
master.write('["include:%s"]\n' % manifest)
class Substitution(object):
"""BaseConfigSubstitution-like class for use with _create_makefile."""

View file

@ -1,8 +0,0 @@
[DEFAULT]
support-files =
support-file.txt
!/child/test_sub.js
!/child/another-file.sjs
!/child/data/**
[test_foo.js]

View file

@ -0,0 +1,9 @@
[DEFAULT]
support-files = [
"support-file.txt",
"!/child/test_sub.js",
"!/child/another-file.sjs",
"!/child/data/**",
]
["test_foo.js"]

View file

@ -1,5 +1,5 @@
# Any copyright is dedicated to the Public Domain.
# http://creativecommons.org/publicdomain/zero/1.0/
MOCHITEST_MANIFESTS += ["mochitest.ini"]
MOCHITEST_MANIFESTS += ["mochitest.toml"]
BROWSER_CHROME_MANIFESTS += ["child/browser.toml"]

View file

@ -0,0 +1,3 @@
[DEFAULT]
["test_bar.js"]

View file

@ -1,2 +0,0 @@
[test_foo.js]
[include:mochitest-common.ini]

View file

@ -0,0 +1,5 @@
[DEFAULT]
["include:mochitest-common.ini"]
["test_foo.js"]

View file

@ -2,5 +2,5 @@
# http://creativecommons.org/publicdomain/zero/1.0/
MOCHITEST_MANIFESTS += [
"mochitest.ini",
"mochitest.toml",
]

View file

@ -1,4 +0,0 @@
[DEFAULT]
support-files = support-file.txt
[test_foo.js]

View file

@ -0,0 +1,4 @@
[DEFAULT]
support-files = ["support-file.txt"]
["test_foo.js"]

View file

@ -1,4 +0,0 @@
[DEFAULT]
support-files = support-file.txt
[test_bar.js]

View file

@ -0,0 +1,4 @@
[DEFAULT]
support-files = ["support-file.txt"]
["test_bar.js"]

View file

@ -2,6 +2,6 @@
# http://creativecommons.org/publicdomain/zero/1.0/
MOCHITEST_MANIFESTS += [
"mochitest1.ini",
"mochitest2.ini",
"mochitest1.toml",
"mochitest2.toml",
]

View file

@ -0,0 +1,3 @@
[DEFAULT]
["not_packaged.java"]

View file

@ -0,0 +1,3 @@
[DEFAULT]
["mochitest.js"]

View file

@ -2,9 +2,9 @@
# http://creativecommons.org/publicdomain/zero/1.0/
MOCHITEST_MANIFESTS += [
"mochitest.ini",
"mochitest.toml",
]
ANDROID_INSTRUMENTATION_MANIFESTS += [
"instrumentation.ini",
"instrumentation.toml",
]

View file

@ -0,0 +1,3 @@
[DEFAULT]
["test_bar.js"]

View file

@ -1,3 +0,0 @@
[DEFAULT]
[mochitest.js]

View file

@ -0,0 +1,3 @@
[DEFAULT]
["mochitest.js"]

View file

@ -2,8 +2,8 @@
# http://creativecommons.org/publicdomain/zero/1.0/
XPCSHELL_TESTS_MANIFESTS += [
"dir1/xpcshell.ini",
"xpcshell.ini",
"dir1/xpcshell.toml",
"xpcshell.toml",
]
MOCHITEST_MANIFESTS += ["mochitest.ini"]
MOCHITEST_MANIFESTS += ["mochitest.toml"]

View file

@ -1,4 +0,0 @@
[DEFAULT]
support-files = support/**
[xpcshell.js]

View file

@ -0,0 +1,4 @@
[DEFAULT]
support-files = ["support/**"]
["xpcshell.js"]

View file

@ -643,9 +643,9 @@ class TestRecursiveMakeBackend(BackendTester):
tests_dir = mozpath.join(env.topobjdir, "_tests")
m_master = mozpath.join(
tests_dir, "testing", "mochitest", "tests", "mochitest.ini"
tests_dir, "testing", "mochitest", "tests", "mochitest.toml"
)
x_master = mozpath.join(tests_dir, "xpcshell", "xpcshell.ini")
x_master = mozpath.join(tests_dir, "xpcshell", "xpcshell.toml")
self.assertTrue(os.path.exists(m_master))
self.assertTrue(os.path.exists(x_master))
@ -655,8 +655,8 @@ class TestRecursiveMakeBackend(BackendTester):
[
"# THIS FILE WAS AUTOMATICALLY GENERATED. DO NOT MODIFY BY HAND.",
"",
"[include:dir1/xpcshell.ini]",
"[include:xpcshell.ini]",
'["include:dir1/xpcshell.toml"]',
'["include:xpcshell.toml"]',
],
)
@ -679,7 +679,7 @@ class TestRecursiveMakeBackend(BackendTester):
"""Shared support files are written to their own data file by the backend."""
env = self._consume("test-manifest-shared-support", RecursiveMakeBackend)
# First, read the generated for ini manifest contents.
# First, read the generated for toml manifest contents.
test_files_manifest = mozpath.join(
env.topobjdir, "_build_manifests", "install", "_test_files"
)

View file

@ -58,10 +58,10 @@ class TestTestManifestBackend(BackendTester):
self.assertEqual(
set(mozpath.relpath(k, env.topsrcdir) for k in o.keys()),
set(["dir1/xpcshell.ini", "xpcshell.ini", "mochitest.ini"]),
set(["dir1/xpcshell.toml", "xpcshell.toml", "mochitest.toml"]),
)
manifest_path = mozpath.join(env.topsrcdir, "xpcshell.ini")
manifest_path = mozpath.join(env.topsrcdir, "xpcshell.toml")
self.assertIn("here", o[manifest_path])
self.assertIn("support-files", o[manifest_path])
@ -81,8 +81,8 @@ class TestTestManifestBackend(BackendTester):
sources,
set(
[
mozpath.join(env.topsrcdir, "mochitest.ini"),
mozpath.join(env.topsrcdir, "mochitest-common.ini"),
mozpath.join(env.topsrcdir, "mochitest.toml"),
mozpath.join(env.topsrcdir, "mochitest-common.toml"),
mozpath.join(env.topsrcdir, "moz.build"),
status_path,
]

View file

@ -1 +0,0 @@
# dummy file so the existence checks for TEST_HARNESS_FILES succeed

View file

@ -4,4 +4,4 @@
TEST_HARNESS_FILES.mochitest += ["runtests.py"]
TEST_HARNESS_FILES.mochitest += ["utils.py"]
TEST_HARNESS_FILES.testing.mochitest += ["mochitest.py"]
TEST_HARNESS_FILES.testing.mochitest += ["mochitest.ini"]
TEST_HARNESS_FILES.testing.mochitest += ["mochitest.toml"]

View file

@ -1,4 +0,0 @@
[DEFAULT]
support-files = /.well-known/foo.txt
[test_file.js]

View file

@ -0,0 +1,4 @@
[DEFAULT]
support-files = ["/.well-known/foo.txt"]
["test_file.js"]

View file

@ -1,4 +1,4 @@
# Any copyright is dedicated to the Public Domain.
# http://creativecommons.org/publicdomain/zero/1.0/
MOCHITEST_MANIFESTS += ["absolute-support.ini"]
MOCHITEST_MANIFESTS += ["absolute-support.toml"]

View file

@ -1,7 +0,0 @@
# Any copyright is dedicated to the Public Domain.
# http://creativecommons.org/publicdomain/zero/1.0/
[DEFAULT]
support-files = bar.js foo.js bar.js
[test_baz.js]

View file

@ -0,0 +1,8 @@
[DEFAULT]
support-files = [
"bar.js",
"foo.js",
"bar.js",
]
["test_baz.js"]

View file

@ -1,4 +1,4 @@
# Any copyright is dedicated to the Public Domain.
# http://creativecommons.org/publicdomain/zero/1.0/
MOCHITEST_MANIFESTS += ["mochitest.ini"]
MOCHITEST_MANIFESTS += ["mochitest.toml"]

View file

@ -0,0 +1,2 @@
[DEFAULT]
foo = "bar"

View file

@ -1,4 +1,4 @@
# Any copyright is dedicated to the Public Domain.
# http://creativecommons.org/publicdomain/zero/1.0/
MOCHITEST_MANIFESTS += ["empty.ini"]
MOCHITEST_MANIFESTS += ["empty.toml"]

View file

@ -0,0 +1,3 @@
[DEFAULT]
["test_foo.html"]

View file

@ -1,3 +0,0 @@
[DEFAULT]
[include:common.ini]

View file

@ -0,0 +1,3 @@
[DEFAULT]
["include:common.ini"]

View file

@ -1,4 +1,4 @@
# Any copyright is dedicated to the Public Domain.
# http://creativecommons.org/publicdomain/zero/1.0/
MOCHITEST_MANIFESTS += ["mochitest.ini"]
MOCHITEST_MANIFESTS += ["mochitest.toml"]

View file

@ -1,3 +0,0 @@
[DEFAULT]
[test_metro.js]

View file

@ -0,0 +1,3 @@
[DEFAULT]
["test_metro.js"]

View file

@ -1,5 +0,0 @@
[DEFAULT]
support-files = external1 external2
generated-files = external1 external2
[test_mochitest.js]

View file

@ -0,0 +1,11 @@
[DEFAULT]
support-files = [
"external1",
"external2",
]
generated-files = [
"external1",
"external2",
]
["test_mochitest.js"]

View file

@ -3,10 +3,10 @@
A11Y_MANIFESTS += ["a11y.toml"]
BROWSER_CHROME_MANIFESTS += ["browser.toml"]
METRO_CHROME_MANIFESTS += ["metro.ini"]
MOCHITEST_MANIFESTS += ["mochitest.ini"]
METRO_CHROME_MANIFESTS += ["metro.toml"]
MOCHITEST_MANIFESTS += ["mochitest.toml"]
MOCHITEST_CHROME_MANIFESTS += ["chrome.toml"]
XPCSHELL_TESTS_MANIFESTS += ["xpcshell.ini"]
XPCSHELL_TESTS_MANIFESTS += ["xpcshell.toml"]
REFTEST_MANIFESTS += ["reftest.list"]
CRASHTEST_MANIFESTS += ["crashtest.list"]
PYTHON_UNITTEST_MANIFESTS += ["python.ini"]
PYTHON_UNITTEST_MANIFESTS += ["python.toml"]

View file

@ -0,0 +1,3 @@
[DEFAULT]
["test_foo.py"]

View file

@ -1,5 +0,0 @@
[DEFAULT]
head = head1 head2
dupe-manifest =
[test_xpcshell.js]

View file

@ -0,0 +1,8 @@
[DEFAULT]
head = [
"head1",
"head2",
]
dupe-manifest = true
["test_xpcshell.js"]

View file

@ -1,4 +1,4 @@
# Any copyright is dedicated to the Public Domain.
# http://creativecommons.org/publicdomain/zero/1.0/
XPCSHELL_TESTS_MANIFESTS += ["does_not_exist.ini"]
XPCSHELL_TESTS_MANIFESTS += ["does_not_exist.toml"]

View file

@ -1,4 +1,4 @@
# Any copyright is dedicated to the Public Domain.
# http://creativecommons.org/publicdomain/zero/1.0/
XPCSHELL_TESTS_MANIFESTS += ["xpcshell.ini"]
XPCSHELL_TESTS_MANIFESTS += ["xpcshell.toml"]

View file

@ -1,4 +0,0 @@
[DEFAULT]
support-files = support/**
[missing.js]

View file

@ -0,0 +1,4 @@
[DEFAULT]
support-files = ["support/**"]
["missing.js"]

View file

@ -0,0 +1,3 @@
[DEFAULT]
["test_missing.html"]

View file

@ -1,4 +1,4 @@
# Any copyright is dedicated to the Public Domain.
# http://creativecommons.org/publicdomain/zero/1.0/
MOCHITEST_MANIFESTS += ["mochitest.ini"]
MOCHITEST_MANIFESTS += ["mochitest.toml"]

View file

@ -1,4 +0,0 @@
[DEFAULT]
support-files = ../support-file.txt
[test_foo.js]

View file

@ -0,0 +1,4 @@
[DEFAULT]
support-files = ["../support-file.txt"]
["test_foo.js"]

View file

@ -1,4 +1,4 @@
# Any copyright is dedicated to the Public Domain.
# http://creativecommons.org/publicdomain/zero/1.0/
MOCHITEST_MANIFESTS += ["child/mochitest.ini"]
MOCHITEST_MANIFESTS += ["child/mochitest.toml"]

View file

@ -1,9 +0,0 @@
[DEFAULT]
support-files =
support-file.txt
!/child/test_sub.js
!/child/another-file.sjs
!/child/data/**
!/does/not/exist.sjs
[test_foo.js]

View file

@ -0,0 +1,10 @@
[DEFAULT]
support-files = [
"support-file.txt",
"!/child/test_sub.js",
"!/child/another-file.sjs",
"!/child/data/**",
"!/does/not/exist.sjs",
]
["test_foo.js"]

View file

@ -1,5 +1,5 @@
# Any copyright is dedicated to the Public Domain.
# http://creativecommons.org/publicdomain/zero/1.0/
MOCHITEST_MANIFESTS += ["mochitest.ini"]
MOCHITEST_MANIFESTS += ["mochitest.toml"]
BROWSER_CHROME_MANIFESTS += ["child/browser.toml"]

View file

@ -1,8 +0,0 @@
[DEFAULT]
support-files =
support-file.txt
!/child/test_sub.js
!/child/another-file.sjs
!/child/data/**
[test_foo.js]

View file

@ -0,0 +1,9 @@
[DEFAULT]
support-files = [
"support-file.txt",
"!/child/test_sub.js",
"!/child/another-file.sjs",
"!/child/data/**",
]
["test_foo.js"]

View file

@ -1,5 +1,5 @@
# Any copyright is dedicated to the Public Domain.
# http://creativecommons.org/publicdomain/zero/1.0/
MOCHITEST_MANIFESTS += ["mochitest.ini"]
MOCHITEST_MANIFESTS += ["mochitest.toml"]
BROWSER_CHROME_MANIFESTS += ["child/browser.toml"]

View file

@ -710,7 +710,7 @@ class TestEmitterBasic(unittest.TestCase):
expected = {
"mochitest": ["runtests.py", "utils.py"],
"testing/mochitest": ["mochitest.py", "mochitest.ini"],
"testing/mochitest": ["mochitest.py", "mochitest.toml"],
}
for path, strings in objs[0].files.walk():
@ -842,7 +842,7 @@ class TestEmitterBasic(unittest.TestCase):
self.assertEqual(len(o.installs), 3)
expected = [
mozpath.normpath(mozpath.join(o.install_prefix, "../.well-known/foo.txt")),
mozpath.join(o.install_prefix, "absolute-support.ini"),
mozpath.join(o.install_prefix, "absolute-support.toml"),
mozpath.join(o.install_prefix, "test_file.js"),
]
paths = sorted([v[0] for v in o.installs.values()])
@ -879,18 +879,18 @@ class TestEmitterBasic(unittest.TestCase):
self.read_topsrcdir(reader)
def test_test_manifest_install_includes(self):
"""Ensure that any [include:foo.ini] are copied to the objdir."""
"""Ensure that any [include:foo.toml] are copied to the objdir."""
reader = self.reader("test-manifest-install-includes")
objs = self.read_topsrcdir(reader)
self.assertEqual(len(objs), 1)
o = objs[0]
self.assertEqual(len(o.installs), 3)
self.assertEqual(o.manifest_relpath, "mochitest.ini")
self.assertEqual(o.manifest_obj_relpath, "mochitest.ini")
self.assertEqual(o.manifest_relpath, "mochitest.toml")
self.assertEqual(o.manifest_obj_relpath, "mochitest.toml")
expected = [
mozpath.normpath(mozpath.join(o.install_prefix, "common.ini")),
mozpath.normpath(mozpath.join(o.install_prefix, "mochitest.ini")),
mozpath.normpath(mozpath.join(o.install_prefix, "common.toml")),
mozpath.normpath(mozpath.join(o.install_prefix, "mochitest.toml")),
mozpath.normpath(mozpath.join(o.install_prefix, "test_foo.html")),
]
paths = sorted([v[0] for v in o.installs.values()])
@ -935,20 +935,20 @@ class TestEmitterBasic(unittest.TestCase):
"support2": False,
},
},
"mochitest.ini": {
"mochitest.toml": {
"flavor": "mochitest",
"installs": {"mochitest.ini": False, "test_mochitest.js": True},
"installs": {"mochitest.toml": False, "test_mochitest.js": True},
"external": {"external1", "external2"},
},
"chrome.toml": {
"flavor": "chrome",
"installs": {"chrome.toml": False, "test_chrome.js": True},
},
"xpcshell.ini": {
"xpcshell.toml": {
"flavor": "xpcshell",
"dupe": True,
"installs": {
"xpcshell.ini": False,
"xpcshell.toml": False,
"test_xpcshell.js": True,
"head1": False,
"head2": False,
@ -956,7 +956,7 @@ class TestEmitterBasic(unittest.TestCase):
},
"reftest.list": {"flavor": "reftest", "installs": {}},
"crashtest.list": {"flavor": "crashtest", "installs": {}},
"python.ini": {"flavor": "python", "installs": {"python.ini": False}},
"python.toml": {"flavor": "python", "installs": {"python.toml": False}},
}
for o in objs:

View file

@ -1,2 +0,0 @@
[DEFAULT]
skip-if = os = "win"

View file

@ -1,11 +0,0 @@
# See https://bugzilla.mozilla.org/show_bug.cgi?id=813674
[test_0180_fileInUse_xp_win_complete.js]
[test_0181_fileInUse_xp_win_partial.js]
[test_0182_rmrfdirFileInUse_xp_win_complete.js]
[test_0183_rmrfdirFileInUse_xp_win_partial.js]
[test_0184_fileInUse_xp_win_complete.js]
[test_0185_fileInUse_xp_win_partial.js]
[test_0186_rmrfdirFileInUse_xp_win_complete.js]
[test_0187_rmrfdirFileInUse_xp_win_partial.js]
# [test_0202_app_launch_apply_update_dirlocked.js] # Test disabled, bug 757632

View file

@ -1,22 +0,0 @@
[DEFAULT]
skip-if = os == 'win' && debug # a pesky comment
[test1]
skip-if = debug
[test2]
skip-if = os == 'linux'
[test3]
skip-if = os == 'win'
[test4]
skip-if = os == 'win' && debug
[test5]
foo = bar
[test6]
skip-if = debug # a second pesky comment

View file

@ -1,5 +0,0 @@
[test1]
subsuite = baz
[test2]
subsuite = foo

View file

@ -1,9 +0,0 @@
[DEFAULT]
support-files = foo.js # a comment
[test7]
[test8]
support-files = bar.js # another comment
[test9]
foo = bar

View file

@ -1,11 +0,0 @@
# illustrate test filters based on various categories
[windowstest]
skip-if = os != 'win'
[fleem]
skip-if = os == 'mac'
[linuxtest]
skip-if = (os == 'mac') || (os == 'win')
fail-if = toolkit == 'cocoa'

View file

@ -1,11 +0,0 @@
[DEFAULT]
foo = bar
[include:include/bar.ini]
[fleem]
[include:include/foo.ini]
red = roses
blue = violets
yellow = daffodils

View file

@ -1 +0,0 @@
[include:invalid.ini]

View file

@ -1 +1 @@
["include:invalid.ini"]
["include:invalid.toml"]

View file

@ -1,2 +0,0 @@
[DEFAULT]
foo = bar

View file

@ -1,2 +0,0 @@
[foo]
[bar]

View file

@ -1,80 +0,0 @@
[testAddons/testDisableEnablePlugin.js]
[testAddons/testGetAddons.js]
[testAddons/testSearchAddons.js]
[testAwesomeBar/testAccessLocationBar.js]
[testAwesomeBar/testCheckItemHighlight.js]
[testAwesomeBar/testEscapeAutocomplete.js]
[testAwesomeBar/testFaviconInAutocomplete.js]
[testAwesomeBar/testGoButton.js]
[testAwesomeBar/testLocationBarSearches.js]
[testAwesomeBar/testPasteLocationBar.js]
[testAwesomeBar/testSuggestHistoryBookmarks.js]
[testAwesomeBar/testVisibleItemsMax.js]
[testBookmarks/testAddBookmarkToMenu.js]
[testCookies/testDisableCookies.js]
[testCookies/testEnableCookies.js]
[testCookies/testRemoveAllCookies.js]
[testCookies/testRemoveCookie.js]
[testDownloading/testCloseDownloadManager.js]
[testDownloading/testDownloadStates.js]
[testDownloading/testOpenDownloadManager.js]
[testFindInPage/testFindInPage.js]
[testFormManager/testAutoCompleteOff.js]
[testFormManager/testBasicFormCompletion.js]
[testFormManager/testClearFormHistory.js]
[testFormManager/testDisableFormManager.js]
[testGeneral/testGoogleSuggestions.js]
[testGeneral/testStopReloadButtons.js]
[testInstallation/testBreakpadInstalled.js]
[testLayout/testNavigateFTP.js]
[testPasswordManager/testPasswordNotSaved.js]
[testPasswordManager/testPasswordSavedAndDeleted.js]
[testPopups/testPopupsAllowed.js]
[testPopups/testPopupsBlocked.js]
[testPreferences/testPaneRetention.js]
[testPreferences/testPreferredLanguage.js]
[testPreferences/testRestoreHomepageToDefault.js]
[testPreferences/testSetToCurrentPage.js]
[testPreferences/testSwitchPanes.js]
[testPrivateBrowsing/testAboutPrivateBrowsing.js]
[testPrivateBrowsing/testCloseWindow.js]
[testPrivateBrowsing/testDisabledElements.js]
[testPrivateBrowsing/testDisabledPermissions.js]
[testPrivateBrowsing/testDownloadManagerClosed.js]
[testPrivateBrowsing/testGeolocation.js]
[testPrivateBrowsing/testStartStopPBMode.js]
[testPrivateBrowsing/testTabRestoration.js]
[testPrivateBrowsing/testTabsDismissedOnStop.js]
[testSearch/testAddMozSearchProvider.js]
[testSearch/testFocusAndSearch.js]
[testSearch/testGetMoreSearchEngines.js]
[testSearch/testOpenSearchAutodiscovery.js]
[testSearch/testRemoveSearchEngine.js]
[testSearch/testReorderSearchEngines.js]
[testSearch/testRestoreDefaults.js]
[testSearch/testSearchSelection.js]
[testSearch/testSearchSuggestions.js]
[testSecurity/testBlueLarry.js]
[testSecurity/testDefaultPhishingEnabled.js]
[testSecurity/testDefaultSecurityPrefs.js]
[testSecurity/testEncryptedPageWarning.js]
[testSecurity/testGreenLarry.js]
[testSecurity/testGreyLarry.js]
[testSecurity/testIdentityPopupOpenClose.js]
[testSecurity/testSSLDisabledErrorPage.js]
[testSecurity/testSafeBrowsingNotificationBar.js]
[testSecurity/testSafeBrowsingWarningPages.js]
[testSecurity/testSecurityInfoViaMoreInformation.js]
[testSecurity/testSecurityNotification.js]
[testSecurity/testSubmitUnencryptedInfoWarning.js]
[testSecurity/testUnknownIssuer.js]
[testSecurity/testUntrustedConnectionErrorPage.js]
[testSessionStore/testUndoTabFromContextMenu.js]
[testTabbedBrowsing/testBackgroundTabScrolling.js]
[testTabbedBrowsing/testCloseTab.js]
[testTabbedBrowsing/testNewTab.js]
[testTabbedBrowsing/testNewWindow.js]
[testTabbedBrowsing/testOpenInBackground.js]
[testTabbedBrowsing/testOpenInForeground.js]
[testTechnicalTools/testAccessPageInfoDialog.js]
[testToolbar/testBackForwardButtons.js]

View file

@ -1,26 +0,0 @@
[DEFAULT]
type = restart
[restartTests/testExtensionInstallUninstall/test2.js]
foo = bar
[restartTests/testExtensionInstallUninstall/test1.js]
foo = baz
[restartTests/testExtensionInstallUninstall/test3.js]
[restartTests/testSoftwareUpdateAutoProxy/test2.js]
[restartTests/testSoftwareUpdateAutoProxy/test1.js]
[restartTests/testPrimaryPassword/test1.js]
[restartTests/testExtensionInstallGetAddons/test2.js]
[restartTests/testExtensionInstallGetAddons/test1.js]
[restartTests/testMultipleExtensionInstallation/test2.js]
[restartTests/testMultipleExtensionInstallation/test1.js]
[restartTests/testThemeInstallUninstall/test2.js]
[restartTests/testThemeInstallUninstall/test1.js]
[restartTests/testThemeInstallUninstall/test3.js]
[restartTests/testDefaultBookmarks/test1.js]
[softwareUpdate/testFallbackUpdate/test2.js]
[softwareUpdate/testFallbackUpdate/test1.js]
[softwareUpdate/testFallbackUpdate/test3.js]
[softwareUpdate/testDirectUpdate/test2.js]
[softwareUpdate/testDirectUpdate/test1.js]

View file

@ -1,2 +0,0 @@
[DEFAULT]
foo = bar

View file

@ -1 +0,0 @@
xyz = 123

View file

@ -1,2 +1 @@
["foo.js"]
xyz =
xyz = "123"

View file

@ -1,2 +0,0 @@
[foo]
path = fleem

View file

@ -1,5 +0,0 @@
[foo]
path = ../fleem
[bar]
path = ../testsSIBLING/example

View file

@ -1,13 +0,0 @@
[test1]
subsuite=bar,foo=="bar" # this has a comment
[test2]
subsuite=bar,foo=="bar"
[test3]
subsuite=baz
[test4]
[test5]
[test6]
subsuite=bar,foo=="szy" || foo=="bar"

View file

@ -22,34 +22,6 @@ def deepstrip(txt):
class TestDefaultSkipif(unittest.TestCase):
"""Tests applying a skip-if condition in [DEFAULT] and || with the value for the test"""
def test_defaults(self):
default = os.path.join(here, "default-skipif.ini")
parser = ManifestParser(manifests=(default,), use_toml=False)
for test in parser.tests:
if test["name"] == "test1":
self.assertEqual(
deepstrip(test["skip-if"]), "os == 'win' && debug\ndebug"
)
elif test["name"] == "test2":
self.assertEqual(
deepstrip(test["skip-if"]), "os == 'win' && debug\nos == 'linux'"
)
elif test["name"] == "test3":
self.assertEqual(
deepstrip(test["skip-if"]), "os == 'win' && debug\nos == 'win'"
)
elif test["name"] == "test4":
self.assertEqual(
deepstrip(test["skip-if"]),
"os == 'win' && debug\nos == 'win' && debug",
)
elif test["name"] == "test5":
self.assertEqual(deepstrip(test["skip-if"]), "os == 'win' && debug")
elif test["name"] == "test6":
self.assertEqual(
deepstrip(test["skip-if"]), "os == 'win' && debug\ndebug"
)
def test_defaults_toml(self):
default = os.path.join(here, "default-skipif.toml")
parser = ManifestParser(manifests=(default,), use_toml=True)
@ -82,18 +54,6 @@ class TestDefaultSkipif(unittest.TestCase):
class TestDefaultSupportFiles(unittest.TestCase):
"""Tests combining support-files field in [DEFAULT] with the value for a test"""
def test_defaults(self):
default = os.path.join(here, "default-suppfiles.ini")
parser = ManifestParser(manifests=(default,), use_toml=False)
expected_supp_files = {
"test7": "foo.js",
"test8": "foo.js bar.js",
"test9": "foo.js",
}
for test in parser.tests:
expected = expected_supp_files[test["name"]]
self.assertEqual(test["support-files"], expected)
def test_defaults_toml(self):
default = os.path.join(here, "default-suppfiles.toml")
parser = ManifestParser(manifests=(default,), use_toml=True)
@ -110,50 +70,6 @@ class TestDefaultSupportFiles(unittest.TestCase):
class TestOmitDefaults(unittest.TestCase):
"""Tests passing omit-defaults prevents defaults from propagating to definitions."""
def test_defaults(self):
manifests = (
os.path.join(here, "default-suppfiles.ini"),
os.path.join(here, "default-skipif.ini"),
)
parser = ManifestParser(
manifests=manifests, handle_defaults=False, use_toml=False
)
expected_supp_files = {
"test8": "bar.js",
}
expected_skip_ifs = {
"test1": "debug",
"test2": "os == 'linux'",
"test3": "os == 'win'",
"test4": "os == 'win' && debug",
"test6": "debug",
}
for test in parser.tests:
for field, expectations in (
("support-files", expected_supp_files),
("skip-if", expected_skip_ifs),
):
expected = expectations.get(test["name"])
if not expected:
self.assertNotIn(field, test)
else:
self.assertEqual(test[field].strip(), expected)
expected_defaults = {
os.path.join(here, "default-suppfiles.ini"): {
"support-files": "foo.js",
},
os.path.join(here, "default-skipif.ini"): {
"skip-if": "os == 'win' && debug",
},
}
for path, defaults in expected_defaults.items():
self.assertIn(path, parser.manifest_defaults)
actual_defaults = parser.manifest_defaults[path]
for key, value in defaults.items():
self.assertIn(key, actual_defaults)
self.assertEqual(value, actual_defaults[key].strip())
def test_defaults_toml(self):
manifests = (
os.path.join(here, "default-suppfiles.toml"),
@ -203,20 +119,6 @@ class TestSubsuiteDefaults(unittest.TestCase):
"""Test that subsuites are handled correctly when managing defaults
outside of the manifest parser."""
def test_subsuite_defaults(self):
manifest = os.path.join(here, "default-subsuite.ini")
parser = ManifestParser(
manifests=(manifest,), handle_defaults=False, use_toml=False
)
expected_subsuites = {
"test1": "baz",
"test2": "foo",
}
defaults = parser.manifest_defaults[manifest]
for test in parser.tests:
value = combine_fields(defaults, test)
self.assertEqual(expected_subsuites[value["name"]], value["subsuite"])
def test_subsuite_defaults_toml(self):
manifest = os.path.join(here, "default-subsuite.toml")
parser = ManifestParser(

View file

@ -26,48 +26,6 @@ class TestManifestParser(unittest.TestCase):
Run ``python manifestparser.py setup develop`` with setuptools installed.
"""
def test_sanity(self):
"""Ensure basic parser is sane"""
parser = ManifestParser(use_toml=False)
mozmill_example = os.path.join(here, "mozmill-example.ini")
parser.read(mozmill_example)
tests = parser.tests
self.assertEqual(
len(tests), len(open(mozmill_example).read().strip().splitlines())
)
# Ensure that capitalization and order aren't an issue:
lines = ["[%s]" % test["name"] for test in tests]
self.assertEqual(lines, open(mozmill_example).read().strip().splitlines())
# Show how you select subsets of tests:
mozmill_restart_example = os.path.join(here, "mozmill-restart-example.ini")
parser.read(mozmill_restart_example)
restart_tests = parser.get(type="restart")
self.assertTrue(len(restart_tests) < len(parser.tests))
self.assertEqual(
len(restart_tests), len(parser.get(manifest=mozmill_restart_example))
)
self.assertFalse(
[
test
for test in restart_tests
if test["manifest"] != os.path.join(here, "mozmill-restart-example.ini")
]
)
self.assertEqual(
parser.get("name", tags=["foo"]),
[
"restartTests/testExtensionInstallUninstall/test2.js",
"restartTests/testExtensionInstallUninstall/test1.js",
],
)
self.assertEqual(
parser.get("name", foo="bar"),
["restartTests/testExtensionInstallUninstall/test2.js"],
)
def test_sanity_toml(self):
"""Ensure basic parser is sane (TOML)"""
@ -114,7 +72,7 @@ class TestManifestParser(unittest.TestCase):
def test_include(self):
"""Illustrate how include works"""
include_example = os.path.join(here, "include-example.ini")
include_example = os.path.join(here, "include-example.toml")
parser = ManifestParser(manifests=(include_example,), use_toml=False)
# All of the tests should be included, in order:
@ -125,9 +83,9 @@ class TestManifestParser(unittest.TestCase):
for test in parser.tests
],
[
("crash-handling", "bar.ini"),
("fleem", "include-example.ini"),
("flowers", "foo.ini"),
("crash-handling", "bar.toml"),
("fleem", "include-example.toml"),
("flowers", "foo.toml"),
],
)
@ -135,7 +93,7 @@ class TestManifestParser(unittest.TestCase):
self.assertTrue(
all(
[
t["ancestor_manifest"] == "include-example.ini"
t["ancestor_manifest"] == "include-example.toml"
for t in parser.tests
if t["name"] != "fleem"
]
@ -149,8 +107,8 @@ class TestManifestParser(unittest.TestCase):
self.assertEqual(here, parser.rootdir)
# DEFAULT values should persist across includes, unless they're
# overwritten. In this example, include-example.ini sets foo=bar, but
# it's overridden to fleem in bar.ini
# overwritten. In this example, include-example.toml sets foo=bar, but
# it's overridden to fleem in bar.toml
self.assertEqual(parser.get("name", foo="bar"), ["fleem", "flowers"])
self.assertEqual(parser.get("name", foo="fleem"), ["crash-handling"])
@ -271,41 +229,6 @@ yellow = submarine""" # noqa
self.assertEqual(buffer.getvalue().strip(), expected_output)
def test_include_manifest_defaults(self):
"""
Test that manifest_defaults and manifests() are correctly populated
when includes are used.
"""
include_example = os.path.join(here, "include-example.ini")
noinclude_example = os.path.join(here, "just-defaults.ini")
bar_path = os.path.join(here, "include", "bar.ini")
foo_path = os.path.join(here, "include", "foo.ini")
parser = ManifestParser(
manifests=(include_example, noinclude_example), rootdir=here, use_toml=False
)
# Standalone manifests must be appear as-is.
self.assertTrue(include_example in parser.manifest_defaults)
self.assertTrue(noinclude_example in parser.manifest_defaults)
# Included manifests must only appear together with the parent manifest
# that included the manifest.
self.assertFalse(bar_path in parser.manifest_defaults)
self.assertFalse(foo_path in parser.manifest_defaults)
ancestor_ini = os.path.relpath(include_example, parser.rootdir)
self.assertTrue((ancestor_ini, bar_path) in parser.manifest_defaults)
self.assertTrue((ancestor_ini, foo_path) in parser.manifest_defaults)
# manifests() must only return file paths (strings).
manifests = parser.manifests()
self.assertEqual(len(manifests), 4)
self.assertIn(foo_path, manifests)
self.assertIn(bar_path, manifests)
self.assertIn(include_example, manifests)
self.assertIn(noinclude_example, manifests)
def test_include_manifest_defaults_toml(self):
"""
Test that manifest_defaults and manifests() are correctly populated
@ -341,39 +264,6 @@ yellow = submarine""" # noqa
self.assertIn(include_example, manifests)
self.assertIn(noinclude_example, manifests)
def test_include_handle_defaults_False(self):
"""
Test that manifest_defaults and manifests() are correct even when
handle_defaults is set to False.
"""
manifest = os.path.join(here, "include-example.ini")
foo_path = os.path.join(here, "include", "foo.ini")
parser = ManifestParser(
manifests=(manifest,), handle_defaults=False, rootdir=here, use_toml=False
)
ancestor_ini = os.path.relpath(manifest, parser.rootdir)
self.assertIn(manifest, parser.manifest_defaults)
self.assertNotIn(foo_path, parser.manifest_defaults)
self.assertIn((ancestor_ini, foo_path), parser.manifest_defaults)
self.assertEqual(
parser.manifest_defaults[manifest],
{
"foo": "bar",
"here": here,
},
)
self.assertEqual(
parser.manifest_defaults[(ancestor_ini, foo_path)],
{
"here": os.path.join(here, "include"),
"red": "roses",
"blue": "ocean",
"yellow": "daffodils",
},
)
def test_include_handle_defaults_False_toml(self):
"""
Test that manifest_defaults and manifests() are correct even when
@ -407,87 +297,6 @@ yellow = submarine""" # noqa
},
)
def test_include_repeated(self):
"""
Test that repeatedly included manifests are independent of each other.
"""
include_example = os.path.join(here, "include-example.ini")
included_foo = os.path.join(here, "include", "foo.ini")
# In the expected output, blue and yellow have the values from foo.ini
# (ocean, submarine) instead of the ones from include-example.ini
# (violets, daffodils), because the defaults in the included file take
# precedence over the values from the parent.
include_output = """[include/crash-handling]
foo = fleem
[fleem]
foo = bar
[include/flowers]
blue = ocean
foo = bar
red = roses
yellow = submarine
"""
included_output = """[include/flowers]
blue = ocean
yellow = submarine
"""
parser = ManifestParser(
manifests=(include_example, included_foo), rootdir=here, use_toml=False
)
self.assertEqual(
parser.get("name"), ["crash-handling", "fleem", "flowers", "flowers"]
)
self.assertEqual(
[
(test["name"], os.path.basename(test["manifest"]))
for test in parser.tests
],
[
("crash-handling", "bar.ini"),
("fleem", "include-example.ini"),
("flowers", "foo.ini"),
("flowers", "foo.ini"),
],
)
self.check_included_repeat(
parser,
parser.tests[3],
parser.tests[2],
"%s%s" % (include_output, included_output),
)
# Same tests, but with the load order of the manifests swapped.
parser = ManifestParser(
manifests=(included_foo, include_example), rootdir=here, use_toml=False
)
self.assertEqual(
parser.get("name"), ["flowers", "crash-handling", "fleem", "flowers"]
)
self.assertEqual(
[
(test["name"], os.path.basename(test["manifest"]))
for test in parser.tests
],
[
("flowers", "foo.ini"),
("crash-handling", "bar.ini"),
("fleem", "include-example.ini"),
("flowers", "foo.ini"),
],
)
self.check_included_repeat(
parser,
parser.tests[0],
parser.tests[3],
"%s%s" % (included_output, include_output),
)
def test_include_repeated_toml(self):
"""
Test that repeatedly included manifests are independent of each other. (TOML)
@ -578,8 +387,8 @@ yellow = submarine
include_example_filename = "include-example.toml"
foo_filename = "foo.toml"
else:
include_example_filename = "include-example.ini"
foo_filename = "foo.ini"
include_example_filename = "include-example.toml"
foo_filename = "foo.toml"
include_example = os.path.join(here, include_example_filename)
included_foo = os.path.join(here, "include", foo_filename)
ancestor_ini = os.path.relpath(include_example, parser.rootdir)
@ -606,40 +415,13 @@ yellow = submarine
parser.write(fp=buffer)
self.assertEqual(buffer.getvalue(), expected_output)
def test_invalid_path(self):
"""
Test invalid path should not throw when not strict
"""
manifest = os.path.join(here, "include-invalid.ini")
ManifestParser(manifests=(manifest,), strict=False)
def test_invalid_path_toml(self):
"""
Test invalid path should not throw when not strict (TOML)
"""
manifest = os.path.join(here, "include-invalid.ini")
manifest = os.path.join(here, "include-invalid.toml")
ManifestParser(manifests=(manifest,), strict=False, use_toml=True)
def test_copy(self):
"""Test our ability to copy a set of manifests"""
tempdir = tempfile.mkdtemp()
include_example = os.path.join(here, "include-example.ini")
manifest = ManifestParser(manifests=(include_example,), use_toml=False)
manifest.copy(tempdir)
self.assertEqual(
sorted(os.listdir(tempdir)), ["fleem", "include", "include-example.ini"]
)
self.assertEqual(
sorted(os.listdir(os.path.join(tempdir, "include"))),
["bar.ini", "crash-handling", "flowers", "foo.ini"],
)
from_manifest = ManifestParser(manifests=(include_example,))
to_manifest = os.path.join(tempdir, "include-example.ini")
to_manifest = ManifestParser(manifests=(to_manifest,))
self.assertEqual(to_manifest.get("name"), from_manifest.get("name"))
shutil.rmtree(tempdir)
def test_copy_toml(self):
"""Test our ability to copy a set of manifests (TOML)"""
@ -660,13 +442,6 @@ yellow = submarine
self.assertEqual(to_manifest.get("name"), from_manifest.get("name"))
shutil.rmtree(tempdir)
def test_path_override(self):
"""You can override the path in the section too.
This shows that you can use a relative path"""
path_example = os.path.join(here, "path-example.ini")
manifest = ManifestParser(manifests=(path_example,))
self.assertEqual(manifest.tests[0]["path"], os.path.join(here, "fleem"))
def test_path_override_toml(self):
"""You can override the path in the section too.
This shows that you can use a relative path"""
@ -674,20 +449,6 @@ yellow = submarine
manifest = ManifestParser(manifests=(path_example,), use_toml=True)
self.assertEqual(manifest.tests[0]["path"], os.path.join(here, "fleem"))
def test_relative_path(self):
"""
Relative test paths are correctly calculated.
"""
relative_path = os.path.join(here, "relative-path.toml")
manifest = ManifestParser(manifests=(relative_path,))
self.assertEqual(
manifest.tests[0]["path"], os.path.join(os.path.dirname(here), "fleem")
)
self.assertEqual(manifest.tests[0]["relpath"], os.path.join("..", "fleem"))
self.assertEqual(
manifest.tests[1]["relpath"], os.path.join("..", "testsSIBLING", "example")
)
def test_relative_path_toml(self):
"""
Relative test paths are correctly calculated. (TOML)
@ -712,17 +473,6 @@ yellow = submarine
self.assertEqual(manifest.tests[0]["relpath"], "fleem")
self.assertEqual(manifest.tests[0]["manifest"], None)
def test_comments(self):
"""
ensure comments work, see
https://bugzilla.mozilla.org/show_bug.cgi?id=813674
"""
comment_example = os.path.join(here, "comment-example.ini")
manifest = ManifestParser(manifests=(comment_example,))
self.assertEqual(len(manifest.tests), 8)
names = [i["name"] for i in manifest.tests]
self.assertFalse("test_0202_app_launch_apply_update_dirlocked.js" in names)
def test_comments_toml(self):
"""
ensure comments work, see
@ -735,29 +485,6 @@ yellow = submarine
names = [i["name"] for i in manifest.tests]
self.assertFalse("test_0202_app_launch_apply_update_dirlocked.js" in names)
def test_verifyDirectory(self):
directory = os.path.join(here, "verifyDirectory")
# correct manifest
manifest_path = os.path.join(directory, "verifyDirectory.ini")
manifest = ManifestParser(manifests=(manifest_path,))
missing = manifest.verifyDirectory(directory, extensions=(".js",))
self.assertEqual(missing, (set(), set()))
# manifest is missing test_1.js
test_1 = os.path.join(directory, "test_1.js")
manifest_path = os.path.join(directory, "verifyDirectory_incomplete.ini")
manifest = ManifestParser(manifests=(manifest_path,))
missing = manifest.verifyDirectory(directory, extensions=(".js",))
self.assertEqual(missing, (set(), set([test_1])))
# filesystem is missing test_notappearinginthisfilm.js
missing_test = os.path.join(directory, "test_notappearinginthisfilm.js")
manifest_path = os.path.join(directory, "verifyDirectory_toocomplete.ini")
manifest = ManifestParser(manifests=(manifest_path,))
missing = manifest.verifyDirectory(directory, extensions=(".js",))
self.assertEqual(missing, (set([missing_test]), set()))
def test_verifyDirectory_toml(self):
directory = os.path.join(here, "verifyDirectory")
@ -776,21 +503,11 @@ yellow = submarine
# filesystem is missing test_notappearinginthisfilm.js
missing_test = os.path.join(directory, "test_notappearinginthisfilm.js")
manifest_path = os.path.join(directory, "verifyDirectory_toocomplete.ini")
manifest_path = os.path.join(directory, "verifyDirectory_toocomplete.toml")
manifest = ManifestParser(manifests=(manifest_path,), use_toml=True)
missing = manifest.verifyDirectory(directory, extensions=(".js",))
self.assertEqual(missing, (set([missing_test]), set()))
def test_just_defaults(self):
"""Ensure a manifest with just a DEFAULT section exposes that data."""
parser = ManifestParser()
manifest = os.path.join(here, "just-defaults.ini")
parser.read(manifest)
self.assertEqual(len(parser.tests), 0)
self.assertTrue(manifest in parser.manifest_defaults)
self.assertEqual(parser.manifest_defaults[manifest]["foo"], "bar")
def test_just_defaults_toml(self):
"""Ensure a manifest with just a DEFAULT section exposes that data. (TOML)"""
@ -801,18 +518,6 @@ yellow = submarine
self.assertTrue(manifest in parser.manifest_defaults)
self.assertEqual(parser.manifest_defaults[manifest]["foo"], "bar")
def test_manifest_list(self):
"""
Ensure a manifest with just a DEFAULT section still returns
itself from the manifests() method.
"""
parser = ManifestParser(use_toml=False)
manifest = os.path.join(here, "no-tests.ini")
parser.read(manifest)
self.assertEqual(len(parser.tests), 0)
self.assertTrue(len(parser.manifests()) == 1)
def test_manifest_list_toml(self):
"""
Ensure a manifest with just a DEFAULT section still returns
@ -825,19 +530,6 @@ yellow = submarine
self.assertEqual(len(parser.tests), 0)
self.assertTrue(len(parser.manifests()) == 1)
def test_manifest_with_invalid_condition(self):
"""
Ensure a skip-if or similar condition with an assignment in it
causes errors.
"""
parser = ManifestParser()
manifest = os.path.join(here, "broken-skip-if.ini")
with self.assertRaisesRegex(
Exception, "Should not assign in skip-if condition for DEFAULT"
):
parser.read(manifest)
def test_manifest_with_invalid_condition_toml(self):
"""
Ensure a skip-if or similar condition with an assignment in it
@ -851,19 +543,6 @@ yellow = submarine
):
parser.read(manifest)
def test_parse_error(self):
"""
Verify handling of a mal-formed INI file
"""
parser = ManifestParser(use_toml=False)
manifest = os.path.join(here, "parse-error.ini")
with self.assertRaisesRegex(
Exception,
r"Error parsing manifest file '.*parse-error.ini', line 1: Expected a comment or section, instead found 'xyz = 123'",
):
parser.read(manifest)
def test_parse_error_toml(self):
"""
Verify handling of a mal-formed TOML file
@ -873,7 +552,7 @@ yellow = submarine
manifest = os.path.join(here, "parse-error.toml")
with self.assertRaisesRegex(
Exception,
r".*Error parsing TOML manifest file .*parse-error.toml: .*",
r".*'str' object has no attribute 'keys'.*",
):
parser.read(manifest)
@ -886,7 +565,7 @@ yellow = submarine
manifest = os.path.join(here, "parse-error.toml")
with self.assertRaisesRegex(
Exception,
r".*Error parsing TOML manifest file .*parse-error.toml: .*",
r".*'String' object has no attribute 'keys'.*",
):
parser.read(manifest)

View file

@ -15,35 +15,6 @@ here = os.path.dirname(os.path.abspath(__file__))
class TestTestManifest(unittest.TestCase):
"""Test the Test Manifest"""
def test_testmanifest(self):
# Test filtering based on platform:
filter_example = os.path.join(here, "filter-example.ini")
manifest = TestManifest(manifests=(filter_example,), strict=False)
self.assertEqual(
[
i["name"]
for i in manifest.active_tests(os="win", disabled=False, exists=False)
],
["windowstest", "fleem"],
)
self.assertEqual(
[
i["name"]
for i in manifest.active_tests(os="linux", disabled=False, exists=False)
],
["fleem", "linuxtest"],
)
# Look for existing tests. There is only one:
self.assertEqual([i["name"] for i in manifest.active_tests()], ["fleem"])
# You should be able to expect failures:
last = manifest.active_tests(exists=False, toolkit="gtk")[-1]
self.assertEqual(last["name"], "linuxtest")
self.assertEqual(last["expected"], "pass")
last = manifest.active_tests(exists=False, toolkit="cocoa")[-1]
self.assertEqual(last["expected"], "fail")
def test_testmanifest_toml(self):
# Test filtering based on platform:
filter_example = os.path.join(here, "filter-example.toml")
@ -75,20 +46,6 @@ class TestTestManifest(unittest.TestCase):
last = manifest.active_tests(exists=False, toolkit="cocoa")[-1]
self.assertEqual(last["expected"], "fail")
def test_missing_paths(self):
"""
Test paths that don't exist raise an exception in strict mode.
"""
tempdir = tempfile.mkdtemp()
missing_path = os.path.join(here, "missing-path.ini")
manifest = TestManifest(manifests=(missing_path,), strict=True)
self.assertRaises(IOError, manifest.active_tests)
self.assertRaises(IOError, manifest.copy, tempdir)
self.assertRaises(IOError, manifest.update, tempdir)
shutil.rmtree(tempdir)
def test_missing_paths_toml(self):
"""
Test paths that don't exist raise an exception in strict mode. (TOML)
@ -103,17 +60,6 @@ class TestTestManifest(unittest.TestCase):
shutil.rmtree(tempdir)
def test_comments(self):
"""
ensure comments work, see
https://bugzilla.mozilla.org/show_bug.cgi?id=813674
"""
comment_example = os.path.join(here, "comment-example.toml")
manifest = TestManifest(manifests=(comment_example,))
self.assertEqual(len(manifest.tests), 8)
names = [i["name"] for i in manifest.tests]
self.assertFalse("test_0202_app_launch_apply_update_dirlocked.js" in names)
def test_comments_toml(self):
"""
ensure comments work, see
@ -126,40 +72,6 @@ class TestTestManifest(unittest.TestCase):
names = [i["name"] for i in manifest.tests]
self.assertFalse("test_0202_app_launch_apply_update_dirlocked.js" in names)
def test_manifest_subsuites(self):
"""
test subsuites and conditional subsuites
"""
relative_path = os.path.join(here, "subsuite.ini")
manifest = TestManifest(manifests=(relative_path,))
info = {"foo": "bar"}
# 6 tests total
tests = manifest.active_tests(exists=False, **info)
self.assertEqual(len(tests), 6)
# only 3 tests for subsuite bar when foo==bar
tests = manifest.active_tests(exists=False, filters=[subsuite("bar")], **info)
self.assertEqual(len(tests), 3)
# only 1 test for subsuite baz, regardless of conditions
other = {"something": "else"}
tests = manifest.active_tests(exists=False, filters=[subsuite("baz")], **info)
self.assertEqual(len(tests), 1)
tests = manifest.active_tests(exists=False, filters=[subsuite("baz")], **other)
self.assertEqual(len(tests), 1)
# 4 tests match when the condition doesn't match (all tests except
# the unconditional subsuite)
info = {"foo": "blah"}
tests = manifest.active_tests(exists=False, filters=[subsuite()], **info)
self.assertEqual(len(tests), 5)
# test for illegal subsuite value
manifest.tests[0]["subsuite"] = 'subsuite=bar,foo=="bar",type="nothing"'
with self.assertRaises(ParseError):
manifest.active_tests(exists=False, filters=[subsuite("foo")], **info)
def test_manifest_subsuites_toml(self):
"""
test subsuites and conditional subsuites (TOML)
@ -194,19 +106,6 @@ class TestTestManifest(unittest.TestCase):
with self.assertRaises(ParseError):
manifest.active_tests(exists=False, filters=[subsuite("foo")], **info)
def test_none_and_empty_manifest(self):
"""
Test TestManifest for None and empty manifest, see
https://bugzilla.mozilla.org/show_bug.cgi?id=1087682
"""
none_manifest = TestManifest(manifests=None, strict=False)
self.assertEqual(len(none_manifest.test_paths()), 0)
self.assertEqual(len(none_manifest.active_tests()), 0)
empty_manifest = TestManifest(manifests=[], strict=False)
self.assertEqual(len(empty_manifest.test_paths()), 0)
self.assertEqual(len(empty_manifest.active_tests()), 0)
def test_none_and_empty_manifest_toml(self):
"""
Test TestManifest for None and empty manifest, see

View file

@ -6,25 +6,25 @@
PYTHON_UNITTEST_MANIFESTS += [
"manifestparser/tests/manifest.toml",
"mozcrash/tests/manifest.ini",
"mozdebug/tests/manifest.ini",
"mozdevice/tests/manifest.ini",
"mozfile/tests/manifest.ini",
"mozgeckoprofiler/tests/manifest.ini",
"mozhttpd/tests/manifest.ini",
"mozinfo/tests/manifest.ini",
"mozinstall/tests/manifest.ini",
"mozleak/tests/manifest.ini",
"mozlog/tests/manifest.ini",
"moznetwork/tests/manifest.ini",
"mozpower/tests/manifest.ini",
"mozprocess/tests/manifest.ini",
"mozprofile/tests/manifest.ini",
"mozproxy/tests/manifest.ini",
"mozrunner/tests/manifest.ini",
"mozsystemmonitor/tests/manifest.ini",
"moztest/tests/manifest.ini",
"mozversion/tests/manifest.ini",
"mozcrash/tests/manifest.toml",
"mozdebug/tests/manifest.toml",
"mozdevice/tests/manifest.toml",
"mozfile/tests/manifest.toml",
"mozgeckoprofiler/tests/manifest.toml",
"mozhttpd/tests/manifest.toml",
"mozinfo/tests/manifest.toml",
"mozinstall/tests/manifest.toml",
"mozleak/tests/manifest.toml",
"mozlog/tests/manifest.toml",
"moznetwork/tests/manifest.toml",
"mozpower/tests/manifest.toml",
"mozprocess/tests/manifest.toml",
"mozprofile/tests/manifest.toml",
"mozproxy/tests/manifest.toml",
"mozrunner/tests/manifest.toml",
"mozsystemmonitor/tests/manifest.toml",
"moztest/tests/manifest.toml",
"mozversion/tests/manifest.toml",
]
python_modules = [

View file

@ -1,7 +0,0 @@
[DEFAULT]
subsuite = mozbase
[test_basic.py]
[test_java_exception.py]
[test_save_path.py]
[test_stackwalk.py]
[test_symbols_path.py]

View file

@ -0,0 +1,12 @@
[DEFAULT]
subsuite = "mozbase"
["test_basic.py"]
["test_java_exception.py"]
["test_save_path.py"]
["test_stackwalk.py"]
["test_symbols_path.py"]

View file

@ -1,3 +0,0 @@
[DEFAULT]
subsuite = mozbase
[test.py]

Some files were not shown because too many files have changed in this diff Show more