Bug 1069648 - Add instrumentation manifests to moz.build. r=ted

These manifests are special in that they don't package their test files
into the test package.  Each test listed in an instrumentation manifest
serves as an identifier rather than a file.

--HG--
extra : rebase_source : 0321528a2dc380e57b824746efbcf61d295204a9
This commit is contained in:
Nick Alexander 2014-09-26 11:44:58 -07:00
parent 3b76ec3191
commit 0a9a9e30db
12 changed files with 127 additions and 15 deletions

View File

@ -0,0 +1,47 @@
[DEFAULT]
subsuite = background
[src/common/TestAndroidLogWriters.java]
[src/common/TestBrowserContractHelpers.java]
[src/common/TestDateUtils.java]
[src/common/TestUtils.java]
[src/common/TestWaitHelper.java]
[src/db/TestAndroidBrowserBookmarksRepository.java]
[src/db/TestAndroidBrowserHistoryDataExtender.java]
[src/db/TestAndroidBrowserHistoryRepository.java]
[src/db/TestBookmarks.java]
[src/db/TestCachedSQLiteOpenHelper.java]
[src/db/TestClientsDatabase.java]
[src/db/TestClientsDatabaseAccessor.java]
[src/db/TestFennecTabsRepositorySession.java]
[src/db/TestFennecTabsStorage.java]
[src/db/TestFormHistoryRepositorySession.java]
[src/db/TestPasswordsRepository.java]
[src/fxa/TestBrowserIDKeyPairGeneration.java]
[src/fxa/authenticator/TestAccountPickler.java]
[src/healthreport/TestEnvironmentBuilder.java]
[src/healthreport/TestEnvironmentV1HashAppender.java]
[src/healthreport/TestHealthReportBroadcastService.java]
[src/healthreport/TestHealthReportDatabaseStorage.java]
[src/healthreport/TestHealthReportGenerator.java]
[src/healthreport/TestHealthReportProvider.java]
[src/healthreport/TestHealthReportSQLiteOpenHelper.java]
[src/healthreport/TestProfileInformationCache.java]
[src/healthreport/prune/TestHealthReportPruneService.java]
[src/healthreport/prune/TestPrunePolicyDatabaseStorage.java]
[src/healthreport/upload/TestAndroidSubmissionClient.java]
[src/healthreport/upload/TestHealthReportUploadService.java]
[src/nativecode/test/TestNativeCrypto.java]
[src/sync/TestAccountPickler.java]
[src/sync/TestClientsStage.java]
[src/sync/TestConfigurationMigrator.java]
[src/sync/TestResetting.java]
[src/sync/TestSendTabData.java]
[src/sync/TestStoreTracking.java]
[src/sync/TestSyncAccounts.java]
[src/sync/TestSyncAuthenticatorService.java]
[src/sync/TestSyncConfiguration.java]
[src/sync/TestTabsRecord.java]
[src/sync/TestUpgradeRequired.java]
[src/sync/TestWebURLFinder.java]
[src/telemetry/TestTelemetryRecorder.java]

View File

@ -21,3 +21,5 @@ main.referenced_projects += ['Fennec']
main.add_classpathentry('src', SRCDIR + '/src',
dstdir='src/org/mozilla/gecko/background')
ANDROID_INSTRUMENTATION_MANIFESTS += ['instrumentation.ini']

View File

@ -0,0 +1,10 @@
[DEFAULT]
subsuite = browser
[src/TestDistribution.java]
[src/TestGeckoSharedPrefs.java]
[src/TestImageDownloader.java]
[src/TestJarReader.java]
[src/TestRawResource.java]
[src/TestSuggestedSites.java]
[src/TestTopSitesCursorWrapper.java]

View File

@ -37,3 +37,5 @@ main.referenced_projects += ['Fennec']
main.add_classpathentry('src', SRCDIR + '/src',
dstdir='src/org/mozilla/gecko')
ANDROID_INSTRUMENTATION_MANIFESTS += ['instrumentation.ini']

View File

@ -821,6 +821,10 @@ VARIABLES = {
These are commonly named crashtests.list.
""", None),
'ANDROID_INSTRUMENTATION_MANIFESTS': (StrictOrderingOnAppendList, list,
"""List of manifest files defining Android instrumentation tests.
""", None),
'METRO_CHROME_MANIFESTS': (StrictOrderingOnAppendList, list,
"""List of manifest files defining metro browser chrome tests.
""", None),

View File

@ -750,28 +750,32 @@ class TreeMetadataEmitter(LoggingMixin):
# Keys are variable prefixes and values are tuples describing how these
# manifests should be handled:
#
# (flavor, install_prefix, active)
# (flavor, install_prefix, active, package_tests)
#
# flavor identifies the flavor of this test.
# install_prefix is the path prefix of where to install the files in
# the tests directory.
# active indicates whether to filter out inactive tests from the
# manifest.
# package_tests indicates whether to package test files into the test
# package; suites that compile the test files should not install
# them into the test package.
#
# We ideally don't filter out inactive tests. However, not every test
# harness can yet deal with test filtering. Once all harnesses can do
# this, this feature can be dropped.
test_manifests = dict(
A11Y=('a11y', 'testing/mochitest', 'a11y', True),
BROWSER_CHROME=('browser-chrome', 'testing/mochitest', 'browser', True),
JETPACK_PACKAGE=('jetpack-package', 'testing/mochitest', 'jetpack-package', True),
JETPACK_ADDON=('jetpack-addon', 'testing/mochitest', 'jetpack-addon', True),
METRO_CHROME=('metro-chrome', 'testing/mochitest', 'metro', True),
MOCHITEST=('mochitest', 'testing/mochitest', 'tests', True),
MOCHITEST_CHROME=('chrome', 'testing/mochitest', 'chrome', True),
MOCHITEST_WEBAPPRT_CHROME=('webapprt-chrome', 'testing/mochitest', 'webapprtChrome', True),
WEBRTC_SIGNALLING_TEST=('steeplechase', 'steeplechase', '.', True),
XPCSHELL_TESTS=('xpcshell', 'xpcshell', '.', False),
A11Y=('a11y', 'testing/mochitest', 'a11y', True, True),
BROWSER_CHROME=('browser-chrome', 'testing/mochitest', 'browser', True, True),
ANDROID_INSTRUMENTATION=('instrumentation', 'instrumentation', '.', False, False),
JETPACK_PACKAGE=('jetpack-package', 'testing/mochitest', 'jetpack-package', True, True),
JETPACK_ADDON=('jetpack-addon', 'testing/mochitest', 'jetpack-addon', True, False),
METRO_CHROME=('metro-chrome', 'testing/mochitest', 'metro', True, True),
MOCHITEST=('mochitest', 'testing/mochitest', 'tests', True, True),
MOCHITEST_CHROME=('chrome', 'testing/mochitest', 'chrome', True, True),
MOCHITEST_WEBAPPRT_CHROME=('webapprt-chrome', 'testing/mochitest', 'webapprtChrome', True, True),
WEBRTC_SIGNALLING_TEST=('steeplechase', 'steeplechase', '.', True, True),
XPCSHELL_TESTS=('xpcshell', 'xpcshell', '.', False, True),
)
for prefix, info in test_manifests.items():
@ -823,7 +827,7 @@ class TreeMetadataEmitter(LoggingMixin):
return sub
def _process_test_manifest(self, context, info, manifest_path):
flavor, install_root, install_subdir, filter_inactive = info
flavor, install_root, install_subdir, filter_inactive, package_tests = info
manifest_path = mozpath.normpath(manifest_path)
path = mozpath.normpath(mozpath.join(context.srcdir, manifest_path))
@ -930,9 +934,9 @@ class TreeMetadataEmitter(LoggingMixin):
for test in filtered:
obj.tests.append(test)
# Jetpack add-on tests are generated directly in the test
# directory
if flavor != 'jetpack-addon':
# Some test files are compiled and should not be copied into the
# test package. They function as identifiers rather than files.
if package_tests:
obj.installs[mozpath.normpath(test['path'])] = \
(mozpath.join(out_dir, test['relpath']), True)

View File

@ -0,0 +1,10 @@
# Any copyright is dedicated to the Public Domain.
# http://creativecommons.org/publicdomain/zero/1.0/
MOCHITEST_MANIFESTS += [
'mochitest.ini',
]
ANDROID_INSTRUMENTATION_MANIFESTS += [
'instrumentation.ini',
]

View File

@ -687,6 +687,37 @@ class TestRecursiveMakeBackend(BackendTester):
stem = '%s/android_eclipse/%s' % (env.topobjdir, project_name)
self.assertIn(command_template % (stem, stem), lines)
def test_install_manifests_package_tests(self):
"""Ensure test suites honor package_tests=False."""
env = self._consume('test-manifests-package-tests', RecursiveMakeBackend)
tests_dir = mozpath.join(env.topobjdir, '_tests')
all_tests_path = mozpath.join(env.topobjdir, 'all-tests.json')
self.assertTrue(os.path.exists(all_tests_path))
with open(all_tests_path, 'rt') as fh:
o = json.load(fh)
self.assertIn('mochitest.js', o)
self.assertIn('not_packaged.java', o)
man_dir = mozpath.join(env.topobjdir, '_build_manifests', 'install')
self.assertTrue(os.path.isdir(man_dir))
full = mozpath.join(man_dir, 'tests')
self.assertTrue(os.path.exists(full))
m = InstallManifest(path=full)
# Only mochitest.js should be in the install manifest.
self.assertTrue('testing/mochitest/tests/mochitest.js' in m)
# The path is odd here because we do not normalize at test manifest
# processing time. This is a fragile test because there's currently no
# way to iterate the manifest.
self.assertFalse('instrumentation/./not_packaged.java' in m)
if __name__ == '__main__':
main()