def run_cppunit_test(self, **params): import mozinfo from mozlog import commandline import runcppunittests as cppunittests log = commandline.setup_logging("cppunittest", {}, {"tbpl": sys.stdout}) if len(params['test_files']) == 0: testdir = os.path.join(self.distdir, 'cppunittests') manifest = os.path.join(self.topsrcdir, 'testing', 'cppunittest.ini') tests = cppunittests.extract_unittests_from_args([testdir], mozinfo.info, manifest) else: tests = cppunittests.extract_unittests_from_args(params['test_files'], mozinfo.info, None) # See if we have crash symbols symbols_path = os.path.join(self.distdir, 'crashreporter-symbols') if not os.path.isdir(symbols_path): symbols_path = None tester = cppunittests.CPPUnitTests() try: result = tester.run_tests(tests, self.bindir, symbols_path, interactive=True) except Exception as e: log.error("Caught exception running cpp unit tests: %s" % str(e)) result = False return 0 if result else 1
def run_cppunit_test(self, **params): import mozinfo from mozlog.structured import commandline import runcppunittests as cppunittests log = commandline.setup_logging("cppunittest", {}, {"tbpl": sys.stdout}) if len(params['test_files']) == 0: testdir = os.path.join(self.distdir, 'cppunittests') tests = cppunittests.extract_unittests_from_args([testdir], mozinfo.info) else: tests = cppunittests.extract_unittests_from_args( params['test_files'], mozinfo.info) # See if we have crash symbols symbols_path = os.path.join(self.distdir, 'crashreporter-symbols') if not os.path.isdir(symbols_path): symbols_path = None tester = cppunittests.CPPUnitTests() try: result = tester.run_tests(tests, self.bindir, symbols_path, interactive=True) except Exception as e: log.error("Caught exception running cpp unit tests: %s" % str(e)) result = False return 0 if result else 1
def run_cppunit_test(self, **params): from mozlog.structured import commandline import runcppunittests as cppunittests log = commandline.setup_logging("cppunittest", {}, {"tbpl": sys.stdout}) if len(params["test_files"]) == 0: testdir = os.path.join(self.distdir, "cppunittests") progs = cppunittests.extract_unittests_from_args([testdir], None) else: progs = cppunittests.extract_unittests_from_args(params["test_files"], None) # See if we have crash symbols symbols_path = os.path.join(self.distdir, "crashreporter-symbols") if not os.path.isdir(symbols_path): symbols_path = None tester = cppunittests.CPPUnitTests() try: result = tester.run_tests(progs, self.bindir, symbols_path, interactive=True) except Exception as e: log.error("Caught exception running cpp unit tests: %s" % str(e)) result = False return 0 if result else 1
def main(): parser = RemoteCPPUnittestOptions() structured.commandline.add_logging_group(parser) options, args = parser.parse_args() if not args: print >>sys.stderr, """Usage: %s <test binary> [<test binary>...]""" % sys.argv[0] sys.exit(1) if options.local_lib is not None and not os.path.isdir(options.local_lib): print >>sys.stderr, """Error: --localLib directory %s not found""" % options.local_lib sys.exit(1) if options.local_apk is not None and not os.path.isfile(options.local_apk): print >>sys.stderr, """Error: --apk file %s not found""" % options.local_apk sys.exit(1) if not options.xre_path: print >>sys.stderr, """Error: --xre-path is required""" sys.exit(1) if options.with_b2g_emulator: from mozrunner import B2GEmulatorRunner runner = B2GEmulatorRunner(b2g_home=options.with_b2g_emulator) runner.start() if options.dm_trans == "adb": if options.with_b2g_emulator: # because we just started the emulator, we need more than the # default number of retries here. retryLimit = 50 else: retryLimit = 5 try: if options.device_ip: dm = devicemanagerADB.DeviceManagerADB(options.device_ip, options.device_port, packageName=None, deviceRoot=options.remote_test_root, retryLimit=retryLimit) else: dm = devicemanagerADB.DeviceManagerADB(packageName=None, deviceRoot=options.remote_test_root, retryLimit=retryLimit) except: if options.with_b2g_emulator: runner.cleanup() runner.wait() raise else: dm = devicemanagerSUT.DeviceManagerSUT(options.device_ip, options.device_port, deviceRoot=options.remote_test_root) if not options.device_ip: print "Error: you must provide a device IP to connect to via the --deviceIP option" sys.exit(1) log = structured.commandline.setup_logging("remotecppunittests", options, {"tbpl": sys.stdout}) 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) tester = RemoteCPPUnitTests(dm, options, progs) try: result = tester.run_tests(progs, options.xre_path, options.symbols_path) except Exception, e: log.error(str(e)) result = False
def run_test_harness(options, args): options.xre_path = os.path.abspath(options.xre_path) cppunittests.update_mozinfo() progs = cppunittests.extract_unittests_from_args(args, mozinfo.info, options.manifest_path) tester = RemoteCPPUnitTests(options, [item[0] for item in progs]) result = tester.run_tests(progs, options.xre_path, options.symbols_path) return result
def main(): parser = RemoteCPPUnittestOptions() mozlog.commandline.add_logging_group(parser) options, args = parser.parse_args() if not args: print >>sys.stderr, """Usage: %s <test binary> [<test binary>...]""" % sys.argv[0] sys.exit(1) if options.local_lib is not None and not os.path.isdir(options.local_lib): print >>sys.stderr, """Error: --localLib directory %s not found""" % options.local_lib sys.exit(1) if options.local_apk is not None and not os.path.isfile(options.local_apk): print >>sys.stderr, """Error: --apk file %s not found""" % options.local_apk sys.exit(1) if not options.xre_path: print >>sys.stderr, """Error: --xre-path is required""" sys.exit(1) if options.with_b2g_emulator: from mozrunner import B2GEmulatorRunner runner = B2GEmulatorRunner(b2g_home=options.with_b2g_emulator) runner.start() if options.dm_trans == "adb": if options.with_b2g_emulator: # because we just started the emulator, we need more than the # default number of retries here. retryLimit = 50 else: retryLimit = 5 try: if options.device_ip: dm = devicemanagerADB.DeviceManagerADB(options.device_ip, options.device_port, packageName=None, deviceRoot=options.remote_test_root, retryLimit=retryLimit) else: dm = devicemanagerADB.DeviceManagerADB(packageName=None, deviceRoot=options.remote_test_root, retryLimit=retryLimit) except: if options.with_b2g_emulator: runner.cleanup() runner.wait() raise else: dm = devicemanagerSUT.DeviceManagerSUT(options.device_ip, options.device_port, deviceRoot=options.remote_test_root) if not options.device_ip: print "Error: you must provide a device IP to connect to via the --deviceIP option" sys.exit(1) log = mozlog.commandline.setup_logging("remotecppunittests", options, {"tbpl": sys.stdout}) options.xre_path = os.path.abspath(options.xre_path) cppunittests.update_mozinfo() progs = cppunittests.extract_unittests_from_args(args, mozinfo.info, options.manifest_path) tester = RemoteCPPUnitTests(dm, options, [item[0] for item in progs]) try: result = tester.run_tests(progs, options.xre_path, options.symbols_path) except Exception, e: log.error(str(e)) result = False
def run_test_harness(options, args): if options.with_b2g_emulator: from mozrunner import B2GEmulatorRunner runner = B2GEmulatorRunner(arch=options.emulator, b2g_home=options.with_b2g_emulator) runner.start() if options.dm_trans == "adb": if options.with_b2g_emulator: # because we just started the emulator, we need more than the # default number of retries here. retryLimit = 50 else: retryLimit = 5 try: if options.device_ip: dm = devicemanagerADB.DeviceManagerADB( options.device_ip, options.device_port, packageName=None, deviceRoot=options.remote_test_root, retryLimit=retryLimit) else: dm = devicemanagerADB.DeviceManagerADB( packageName=None, deviceRoot=options.remote_test_root, retryLimit=retryLimit) except: if options.with_b2g_emulator: runner.cleanup() runner.wait() raise else: dm = devicemanagerSUT.DeviceManagerSUT( options.device_ip, options.device_port, deviceRoot=options.remote_test_root) if not options.device_ip: 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) cppunittests.update_mozinfo() progs = cppunittests.extract_unittests_from_args(args, mozinfo.info, options.manifest_path) tester = RemoteCPPUnitTests(dm, options, [item[0] for item in progs]) try: result = tester.run_tests(progs, options.xre_path, options.symbols_path) finally: if options.with_b2g_emulator: runner.cleanup() runner.wait() return result
def run_cppunit_test(self, **params): import runcppunittests as cppunittests import logging if len(params['test_files']) == 0: testdir = os.path.join(self.distdir, 'cppunittests') progs = cppunittests.extract_unittests_from_args([testdir], None) else: progs = cppunittests.extract_unittests_from_args( params['test_files'], None) # See if we have crash symbols symbols_path = os.path.join(self.distdir, 'crashreporter-symbols') if not os.path.isdir(symbols_path): symbols_path = None tester = cppunittests.CPPUnitTests() try: result = tester.run_tests(progs, self.bindir, symbols_path) except Exception, e: self.log(logging.ERROR, 'cppunittests', {'exception': str(e)}, 'Caught exception running cpp unit tests: {exception}') result = False
def run_cppunit_test(self, **params): import runcppunittests as cppunittests import logging if len(params['test_files']) == 0: testdir = os.path.join(self.distdir, 'cppunittests') progs = cppunittests.extract_unittests_from_args([testdir], None) else: progs = cppunittests.extract_unittests_from_args(params['test_files'], None) # See if we have crash symbols symbols_path = os.path.join(self.distdir, 'crashreporter-symbols') if not os.path.isdir(symbols_path): symbols_path = None tester = cppunittests.CPPUnitTests() try: result = tester.run_tests(progs, self.bindir, symbols_path) except Exception, e: self.log(logging.ERROR, 'cppunittests', {'exception': str(e)}, 'Caught exception running cpp unit tests: {exception}') result = False
def main(): parser = RemoteCPPUnittestOptions() options, args = parser.parse_args() if not args: print >> sys.stderr, """Usage: %s <test binary> [<test binary>...]""" % sys.argv[ 0] sys.exit(1) if options.local_lib is None and options.local_apk is None: print >> sys.stderr, """Error: --localLib or --apk is required""" sys.exit(1) if options.local_lib is not None and not os.path.isdir(options.local_lib): print >> sys.stderr, """Error: --localLib directory %s not found""" % options.local_lib sys.exit(1) if options.local_apk is not None and not os.path.isfile(options.local_apk): print >> sys.stderr, """Error: --apk file %s not found""" % options.local_apk sys.exit(1) if not options.xre_path: print >> sys.stderr, """Error: --xre-path is required""" sys.exit(1) if options.dm_trans == "adb": if options.device_ip: dm = devicemanagerADB.DeviceManagerADB( options.device_ip, options.device_port, packageName=None, deviceRoot=options.remote_test_root) else: dm = devicemanagerADB.DeviceManagerADB( packageName=None, deviceRoot=options.remote_test_root) else: dm = devicemanagerSUT.DeviceManagerSUT( options.device_ip, options.device_port, deviceRoot=options.remote_test_root) if not options.device_ip: 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, options.manifest_file) tester = RemoteCPPUnitTests(dm, options, progs) try: result = tester.run_tests(progs, options.xre_path, options.symbols_path) except Exception, e: log.error(str(e)) result = False
def run_test_harness(options, args): if options.with_b2g_emulator: from mozrunner import B2GEmulatorRunner runner = B2GEmulatorRunner( arch=options.emulator, b2g_home=options.with_b2g_emulator) runner.start() # because we just started the emulator, we need more than the # default number of retries here. retryLimit = 50 else: retryLimit = 5 try: dm_args = {'deviceRoot': options.remote_test_root} dm_args['retryLimit'] = retryLimit if options.device_ip: dm_args['host'] = options.device_ip dm_args['port'] = options.device_port if options.adb_path: dm_args['adbPath'] = options.adb_path if options.log_tbpl_level == 'debug' or options.log_mach_level == 'debug': dm_args['logLevel'] = logging.DEBUG # noqa python 2 / 3 dm = devicemanagerADB.DeviceManagerADB(**dm_args) except BaseException: if options.with_b2g_emulator: runner.cleanup() runner.wait() raise options.xre_path = os.path.abspath(options.xre_path) cppunittests.update_mozinfo() progs = cppunittests.extract_unittests_from_args(args, mozinfo.info, options.manifest_path) tester = RemoteCPPUnitTests(dm, options, [item[0] for item in progs]) try: result = tester.run_tests( progs, options.xre_path, options.symbols_path) finally: if options.with_b2g_emulator: runner.cleanup() runner.wait() return result
def run_test_harness(options, args): if options.with_b2g_emulator: from mozrunner import B2GEmulatorRunner runner = B2GEmulatorRunner(arch=options.emulator, b2g_home=options.with_b2g_emulator) runner.start() if options.dm_trans == "adb": if options.with_b2g_emulator: # because we just started the emulator, we need more than the # default number of retries here. retryLimit = 50 else: retryLimit = 5 try: if options.device_ip: dm = devicemanagerADB.DeviceManagerADB(options.device_ip, options.device_port, packageName=None, deviceRoot=options.remote_test_root, retryLimit=retryLimit) else: dm = devicemanagerADB.DeviceManagerADB(packageName=None, deviceRoot=options.remote_test_root, retryLimit=retryLimit) except: if options.with_b2g_emulator: runner.cleanup() runner.wait() raise else: dm = devicemanagerSUT.DeviceManagerSUT(options.device_ip, options.device_port, deviceRoot=options.remote_test_root) if not options.device_ip: 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) cppunittests.update_mozinfo() progs = cppunittests.extract_unittests_from_args(args, mozinfo.info, options.manifest_path) tester = RemoteCPPUnitTests(dm, options, [item[0] for item in progs]) try: result = tester.run_tests(progs, options.xre_path, options.symbols_path) finally: if options.with_b2g_emulator: runner.cleanup() runner.wait() return result
def run_test_harness(options, args): if options.with_b2g_emulator: from mozrunner import B2GEmulatorRunner runner = B2GEmulatorRunner(arch=options.emulator, b2g_home=options.with_b2g_emulator) runner.start() # because we just started the emulator, we need more than the # default number of retries here. retryLimit = 50 else: retryLimit = 5 try: dm_args = {'deviceRoot': options.remote_test_root} dm_args['retryLimit'] = retryLimit if options.device_ip: dm_args['host'] = options.device_ip dm_args['port'] = options.device_port if options.adb_path: dm_args['adbPath'] = options.adb_path if options.log_tbpl_level == 'debug' or options.log_mach_level == 'debug': dm_args['logLevel'] = logging.DEBUG # noqa python 2 / 3 dm = devicemanagerADB.DeviceManagerADB(**dm_args) except: if options.with_b2g_emulator: runner.cleanup() runner.wait() raise options.xre_path = os.path.abspath(options.xre_path) cppunittests.update_mozinfo() progs = cppunittests.extract_unittests_from_args(args, mozinfo.info, options.manifest_path) tester = RemoteCPPUnitTests(dm, options, [item[0] for item in progs]) try: result = tester.run_tests(progs, options.xre_path, options.symbols_path) finally: if options.with_b2g_emulator: runner.cleanup() runner.wait() return result
def main(): parser = RemoteCPPUnittestOptions() options, args = parser.parse_args() if not args: print >>sys.stderr, """Usage: %s <test binary> [<test binary>...]""" % sys.argv[0] sys.exit(1) if options.local_lib is None and options.local_apk is None: print >>sys.stderr, """Error: --localLib or --apk is required""" sys.exit(1) if options.local_lib is not None and not os.path.isdir(options.local_lib): print >>sys.stderr, """Error: --localLib directory %s not found""" % options.local_lib sys.exit(1) if options.local_apk is not None and not os.path.isfile(options.local_apk): print >>sys.stderr, """Error: --apk file %s not found""" % options.local_apk sys.exit(1) if not options.xre_path: print >>sys.stderr, """Error: --xre-path is required""" sys.exit(1) if options.dm_trans == "adb": if options.device_ip: dm = devicemanagerADB.DeviceManagerADB(options.device_ip, options.device_port, packageName=None, deviceRoot=options.remote_test_root) else: dm = devicemanagerADB.DeviceManagerADB(packageName=None, deviceRoot=options.remote_test_root) else: dm = devicemanagerSUT.DeviceManagerSUT(options.device_ip, options.device_port, deviceRoot=options.remote_test_root) if not options.device_ip: 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, options.manifest_file) tester = RemoteCPPUnitTests(dm, options, progs) try: result = tester.run_tests(progs, options.xre_path, options.symbols_path) except Exception, e: log.error(str(e)) result = False