Bug 1171299 - Support mozinfo.json in cppunit tests; r=dminor

This commit is contained in:
Geoff Brown 2015-06-04 10:51:14 -06:00
parent 7adcf3798b
commit fcee5d1fb7
3 changed files with 18 additions and 5 deletions

View File

@ -11,6 +11,7 @@ from zipfile import ZipFile
import runcppunittests as cppunittests
import mozcrash
import mozfile
import mozinfo
import StringIO
import posixpath
from mozdevice import devicemanager, devicemanagerADB, devicemanagerSUT
@ -254,11 +255,8 @@ def main():
options.xre_path = os.path.abspath(options.xre_path)
if options.with_b2g_emulator:
environ = {'os': 'b2g'}
else:
environ = {'os': 'android'}
progs = cppunittests.extract_unittests_from_args(args, environ)
cppunittests.update_mozinfo()
progs = cppunittests.extract_unittests_from_args(args, mozinfo.info)
tester = RemoteCPPUnitTests(dm, options, progs)
try:
result = tester.run_tests(progs, options.xre_path, options.symbols_path)

View File

@ -16,6 +16,8 @@ from contextlib import contextmanager
from mozlog import structured
from subprocess import PIPE
SCRIPT_DIR = os.path.abspath(os.path.realpath(os.path.dirname(__file__)))
class CPPUnitTests(object):
# Time (seconds) to wait for test process to complete
TEST_PROC_TIMEOUT = 900
@ -200,6 +202,17 @@ def extract_unittests_from_args(args, environ):
return tests
def update_mozinfo():
"""walk up directories to find mozinfo.json update the info"""
path = SCRIPT_DIR
dirs = set()
while path != os.path.expanduser('~'):
if path in dirs:
break
dirs.add(path)
path = os.path.split(path)[0]
mozinfo.find_and_update_from_json(*dirs)
def main():
parser = CPPUnittestOptions()
structured.commandline.add_logging_group(parser)
@ -215,6 +228,7 @@ def main():
options,
{"tbpl": sys.stdout})
update_mozinfo()
progs = extract_unittests_from_args(args, mozinfo.info)
options.xre_path = os.path.abspath(options.xre_path)
if mozinfo.isMac:

View File

@ -520,6 +520,7 @@ endif
cp $(topsrcdir)/testing/runcppunittests.py $(PKG_STAGE)/cppunittests
cp $(topsrcdir)/testing/remotecppunittests.py $(PKG_STAGE)/cppunittests
cp $(topsrcdir)/testing/cppunittest.ini $(PKG_STAGE)/cppunittests
cp $(DEPTH)/mozinfo.json $(PKG_STAGE)/cppunittests
ifeq ($(MOZ_DISABLE_STARTUPCACHE),)
cp $(topsrcdir)/startupcache/test/TestStartupCacheTelemetry.js $(PKG_STAGE)/cppunittests
cp $(topsrcdir)/startupcache/test/TestStartupCacheTelemetry.manifest $(PKG_STAGE)/cppunittests