Bug 976733 - part 3 - convert testing/mozbase/ to use TEST_HARNESS_FILES; r=gps

This commit is contained in:
Nathan Froyd 2014-08-29 11:03:11 -04:00
parent 071791c0ea
commit 51efcd8004
5 changed files with 43 additions and 39 deletions

View File

@ -871,6 +871,10 @@ class RecursiveMakeBackend(CommonBackend):
dest = '%s/%s' % (path, mozpath.basename(source))
self._install_manifests['tests'].add_symlink(source, dest)
for path, patterns in obj.srcdir_pattern_files.iteritems():
for p in patterns:
self._install_manifests['tests'].add_pattern_symlink(obj.srcdir, p, path)
for path, files in obj.objdir_files.iteritems():
prefix = 'TEST_HARNESS_%s' % path.replace('/', '_')
backend_file.write("""

View File

@ -216,11 +216,12 @@ class TestHarnessFiles(ContextDerived):
this object fills that role. It just has a reference to the underlying
HierarchicalStringList, which is created when parsing TEST_HARNESS_FILES.
"""
__slots__ = ('srcdir_files', 'objdir_files')
__slots__ = ('srcdir_files', 'srcdir_pattern_files', 'objdir_files')
def __init__(self, context, srcdir_files, objdir_files):
def __init__(self, context, srcdir_files, srcdir_pattern_files, objdir_files):
ContextDerived.__init__(self, context)
self.srcdir_files = srcdir_files
self.srcdir_pattern_files = srcdir_pattern_files
self.objdir_files = objdir_files
class Resources(ContextDerived):

View File

@ -491,6 +491,7 @@ class TreeMetadataEmitter(LoggingMixin):
test_harness_files = context.get('TEST_HARNESS_FILES')
if test_harness_files:
srcdir_files = defaultdict(list)
srcdir_pattern_files = defaultdict(list)
objdir_files = defaultdict(list)
for path, strings in test_harness_files.walk():
@ -506,12 +507,16 @@ class TreeMetadataEmitter(LoggingMixin):
objdir_files[path].append(s[1:])
else:
resolved = context.resolve_path(s)
if not os.path.exists(resolved):
if '*' in s:
srcdir_pattern_files[path].append(s);
elif not os.path.exists(resolved):
raise SandboxValidationError(
'File listed in TEST_HARNESS_FILES does not exist: %s' % s, context)
srcdir_files[path].append(resolved)
else:
srcdir_files[path].append(resolved)
yield TestHarnessFiles(context, srcdir_files, objdir_files)
yield TestHarnessFiles(context, srcdir_files,
srcdir_pattern_files, objdir_files)
defines = context.get('DEFINES')
if defines:

View File

@ -4,40 +4,7 @@
include $(topsrcdir)/config/rules.mk
# Harness packages from the srcdir
MOZBASE_PACKAGES = \
manifestparser \
mozcrash \
mozdebug \
mozfile \
mozhttpd \
mozinfo \
mozinstall \
mozlog \
mozprocess \
mozprofile \
mozrunner \
mozdevice \
moznetwork \
mozsystemmonitor \
moztest \
mozversion \
$(NULL)
MOZBASE_EXTRAS = \
setup_development.py \
test.py \
test-manifest.ini \
$(NULL)
_DEST_DIR = $(DEPTH)/_tests/mozbase
libs:: $(MOZBASE_PACKAGES)
$(PYTHON) $(topsrcdir)/config/nsinstall.py $^ $(_DEST_DIR)
libs:: $(MOZBASE_EXTRAS)
$(PYTHON) $(topsrcdir)/config/nsinstall.py $^ $(_DEST_DIR)
stage-package: PKG_STAGE = $(DIST)/test-stage
stage-package:
$(NSINSTALL) -D $(PKG_STAGE)/mozbase
@(cd $(srcdir) && tar $(TAR_CREATE_FLAGS) - $(MOZBASE_PACKAGES)) | (cd $(PKG_STAGE)/mozbase && tar -xf -)
@(cd $(srcdir) && tar $(TAR_CREATE_FLAGS) - $(MOZBASE_EXTRAS)) | (cd $(PKG_STAGE)/mozbase && tar -xf -)
@(cd $(DEPTH)/_tests/ && tar $(TAR_CREATE_FLAGS) - mozbase) | (cd $(PKG_STAGE) && tar -xf -)

View File

@ -7,3 +7,30 @@
PYTHON_UNIT_TESTS += [
'test.py',
]
python_modules = [
'manifestparser',
'mozcrash',
'mozdebug',
'mozdevice',
'mozfile',
'mozhttpd',
'mozinfo',
'mozinstall',
'mozlog',
'moznetwork',
'mozprocess',
'mozprofile',
'mozrunner',
'mozsystemmonitor',
'moztest',
'mozversion',
]
TEST_HARNESS_FILES.mozbase += [m + '/**' for m in python_modules]
TEST_HARNESS_FILES.mozbase += [
'setup_development.py',
'test-manifest.ini',
'test.py',
]