Bug 915245 - Add manifest support to cpp unittest harness; r=ted

This commit is contained in:
Dan Minor 2013-09-24 07:18:58 -04:00
parent 224a14c928
commit c9da574285
4 changed files with 28 additions and 7 deletions

View File

@ -0,0 +1,5 @@
# This is just a list of tests to skip, one test per line
TestTXMgr # Bug 919595
TestPlainTextSerializer # Bug 919599
TestNativeXMLHttpRequest # Bug 919642
mediapipeline_unittest # Bug 919646

View File

@ -227,7 +227,7 @@ def main():
print "Error: you must provide a device IP to connect to via the --deviceIP option"
sys.exit(1)
options.xre_path = os.path.abspath(options.xre_path)
progs = cppunittests.extract_unittests_from_args(args)
progs = cppunittests.extract_unittests_from_args(args, options.manifest_file)
tester = RemoteCPPUnitTests(dm, options, progs)
try:
result = tester.run_tests(progs, options.xre_path, options.symbols_path)

View File

@ -137,19 +137,33 @@ class CPPUnittestOptions(OptionParser):
action = "store", type = "string", dest = "symbols_path",
default = None,
help = "absolute path to directory containing breakpad symbols, or the URL of a zip file containing symbols")
self.add_option("--skip-manifest",
action = "store", type = "string", dest = "manifest_file",
default = None,
help = "absolute path to a manifest file")
def extract_unittests_from_args(args):
def extract_unittests_from_args(args, manifest_file):
"""Extract unittests from args, expanding directories as needed"""
progs = []
skipped_progs = set()
if manifest_file:
skipped_progs.add(os.path.basename(manifest_file))
with open(manifest_file) as f:
for line in f:
# strip out comment, if any
prog = line.split('#')[0]
if prog:
skipped_progs.add(prog.strip())
for p in args:
if os.path.isdir(p):
#filter out .py files packaged with the unit tests
progs.extend([os.path.abspath(os.path.join(p, x)) for x in os.listdir(p) if not x.endswith('.py')])
else:
progs.extend([os.path.abspath(os.path.join(p, x)) for x in os.listdir(p) if not x in skipped_progs])
elif p not in skipped_progs:
progs.append(os.path.abspath(p))
return progs
#filter out python files packaged with the unit tests
return filter(lambda x: not x.endswith('.py') and not x.endswith('.pyc'), progs)
def main():
parser = CPPUnittestOptions()
@ -160,7 +174,8 @@ def main():
if not options.xre_path:
print >>sys.stderr, """Error: --xre-path is required"""
sys.exit(1)
progs = extract_unittests_from_args(args)
progs = extract_unittests_from_args(args, options.manifest_file)
options.xre_path = os.path.abspath(options.xre_path)
tester = CPPUnitTests()
try:

View File

@ -504,6 +504,7 @@ else
endif
$(NSINSTALL) $(topsrcdir)/testing/runcppunittests.py $(PKG_STAGE)/cppunittests
$(NSINSTALL) $(topsrcdir)/testing/remotecppunittests.py $(PKG_STAGE)/cppunittests
$(NSINSTALL) $(topsrcdir)/testing/android_cppunittest_manifest.txt $(PKG_STAGE)/cppunittests
stage-jittest:
$(NSINSTALL) -D $(PKG_STAGE)/jit-test/tests