Exemple #1
0
    def setup_job(self):
        PhoneTest.setup_job(self)
        self.perfherder_artifact = None

        if not self._resulturl:
            self._resultfile = open("autophone-results-%s.csv" % self.phone.id, "ab")
            self._resultfile.seek(0, 2)
            self._resultwriter = csv.writer(self._resultfile)
            if self._resultfile.tell() == 0:
                self._resultwriter.writerow(
                    [
                        "phoneid",
                        "testname",
                        "starttime",
                        "throbberstartraw",
                        "throbberstopraw",
                        "throbberstart",
                        "throbberstop",
                        "blddate",
                        "cached",
                        "rejected",
                        "revision",
                        "productname",
                        "productversion",
                        "osver",
                        "bldtype",
                        "machineid",
                    ]
                )
Exemple #2
0
 def setup_job(self):
     PhoneTest.setup_job(self)
     self.crash_processor = AutophoneCrashProcessor(self.dm,
                                                    self.loggerdeco,
                                                    self.profile_path,
                                                    self.upload_dir)
     self.crash_processor.clear()
Exemple #3
0
    def setup_job(self):
        PhoneTest.setup_job(self)
        self.crash_processor = AutophoneCrashProcessor(self.dm,
                                                       self.loggerdeco,
                                                       self.profile_path,
                                                       self.upload_dir)
        self.crash_processor.clear()

        if self._resulturl.lower() == 'none':
            self._resulturl = None
            self._resultfile = open('autophone-results-%s.csv' %
                                    self.phone.id, 'ab')
            self._resultfile.seek(0, 2)
            self._resultwriter = csv.writer(self._resultfile)
            if self._resultfile.tell() == 0:
                self._resultwriter.writerow([
                    'phoneid',
                    'testname',
                    'starttime',
                    'throbberstartraw',
                    'throbberstopraw',
                    'throbberstart',
                    'throbberstop',
                    'blddate',
                    'cached',
                    'rejected',
                    'revision',
                    'productname',
                    'productversion',
                    'osver',
                    'bldtype',
                    'machineid'])
        elif not self._resulturl.endswith('/'):
            self._resulturl += '/'
Exemple #4
0
    def setup_job(self):
        PhoneTest.setup_job(self)
        self.perfherder_artifact = None

        if not self._resulturl:
            self._resultfile = open('autophone-results-%s.csv' %
                                    self.phone.id, 'ab')
            self._resultfile.seek(0, 2)
            self._resultwriter = csv.writer(self._resultfile)
            if self._resultfile.tell() == 0:
                self._resultwriter.writerow([
                    'phoneid',
                    'testname',
                    'starttime',
                    'throbberstartraw',
                    'throbberstopraw',
                    'throbberstart',
                    'throbberstop',
                    'blddate',
                    'cached',
                    'rejected',
                    'revision',
                    'productname',
                    'productversion',
                    'osver',
                    'bldtype',
                    'machineid'])
Exemple #5
0
    def __init__(self, dm=None, phone=None, options=None, config_file=None, chunk=1, repos=None):
        if repos is None:
            repos = []
        PhoneTest.__init__(self, dm=dm, phone=phone, options=options, config_file=config_file, chunk=chunk, repos=repos)
        self._result_server = None
        self._resulturl = None
        self.perfherder_artifact = None
        if options.phonedash_url:
            self._resulturl = urlparse.urljoin(options.phonedash_url, "/api/s1s2/")
            self.loggerdeco.debug("PerfTest._resulturl: %s" % self._resulturl)

        # [signature]
        self._signer = None
        self._jwt = {"id": options.phonedash_user, "key": options.phonedash_password}
        # phonedash requires both an id and a key.
        if self._jwt["id"] and self._jwt["key"]:
            self._signer = jws.HmacSha(key=self._jwt["key"], key_id=self._jwt["id"])
        # [settings]
        try:
            self._iterations = self.cfg.getint("settings", "iterations")
        except (ConfigParser.NoSectionError, ConfigParser.NoOptionError):
            self._iterations = 1
        try:
            self.stderrp_accept = self.cfg.getfloat("settings", "stderrp_accept")
        except (ConfigParser.NoSectionError, ConfigParser.NoOptionError):
            self.stderrp_accept = 0
        try:
            self.stderrp_reject = self.cfg.getfloat("settings", "stderrp_reject")
        except (ConfigParser.NoSectionError, ConfigParser.NoOptionError):
            self.stderrp_reject = 100
        try:
            self.stderrp_attempts = self.cfg.getint("settings", "stderrp_attempts")
        except (ConfigParser.NoSectionError, ConfigParser.NoOptionError):
            self.stderrp_attempts = 1
        self._resultfile = None
Exemple #6
0
 def teardown_job(self):
     PhoneTest.teardown_job(self)
     roboexampletest = 'org.mozilla.roboexample.test'
     if self.dm.is_app_installed(roboexampletest):
         self.dm.uninstall_app(roboexampletest)
     if self.dm.is_app_installed(FLASH_PACKAGE):
         self.dm.uninstall_app(FLASH_PACKAGE)
Exemple #7
0
    def setup_job(self):
        PhoneTest.setup_job(self)
        self.perfherder_artifact = None

        if not self._resulturl:
            self._resultfile = open('autophone-results-%s.csv' %
                                    self.phone.id, 'ab')
            self._resultfile.seek(0, 2)
            self._resultwriter = csv.writer(self._resultfile)
            if self._resultfile.tell() == 0:
                self._resultwriter.writerow([
                    'phoneid',
                    'testname',
                    'starttime',
                    'throbberstartraw',
                    'throbberstopraw',
                    'throbberstart',
                    'throbberstop',
                    'blddate',
                    'cached',
                    'rejected',
                    'revision',
                    'productname',
                    'productversion',
                    'osver',
                    'bldtype',
                    'machineid'])
    def setup_job(self):
        PhoneTest.setup_job(self)
        build_dir = self.build.dir
        symbols_path = self.build.symbols
        if symbols_path and not os.path.exists(symbols_path):
            symbols_path = None
        re_revision = re.compile(r'http.*/rev/(.*)')
        match = re_revision.match(self.build.revision)
        if match:
            revision = match.group(1)
        else:
            revision = self.build.revision

        self.parms['app_name'] = self.build.app_name
        self.parms['build_dir'] = build_dir
        self.parms['symbols_path'] = symbols_path
        self.parms['revision'] = revision
        self.parms['buildid'] = self.build.id
        self.parms['tree'] = self.build.tree

        self._log = '%s/tests/%s-%s-%s.log' % (build_dir,
                                               self.parms['test_name'],
                                               self.chunk,
                                               self.parms['phoneid'])
        os.putenv('MINIDUMP_STACKWALK', self.options.minidump_stackwalk)
        os.putenv('MINIDUMP_SAVE_PATH', self.upload_dir)
        os.putenv('MOZ_UPLOAD_DIR', self.upload_dir)
Exemple #9
0
    def __init__(self, dm=None, phone=None, options=None,
                 config_file=None, chunk=1, repos=[]):
        PhoneTest.__init__(self, dm=dm, phone=phone, options=options,
                           config_file=config_file, chunk=chunk, repos=repos)
        self._result_server = None
        self._resulturl = None
        if options.phonedash_url:
            self._resulturl = urlparse.urljoin(options.phonedash_url, '/api/s1s2/')
            self.loggerdeco.debug('PerfTest._resulturl: %s' % self._resulturl)

        # [signature]
        self._signer = None
        self._jwt = {'id': options.phonedash_user, 'key': options.phonedash_password}
        # phonedash requires both an id and a key.
        if self._jwt['id'] and self._jwt['key']:
            self._signer = jws.HmacSha(key=self._jwt['key'],
                                       key_id=self._jwt['id'])
        # [settings]
        try:
            self._iterations = self.cfg.getint('settings', 'iterations')
        except (ConfigParser.NoSectionError, ConfigParser.NoOptionError):
            self._iterations = 1
        try:
            self.stderrp_accept = self.cfg.getfloat('settings', 'stderrp_accept')
        except (ConfigParser.NoSectionError, ConfigParser.NoOptionError):
            self.stderrp_accept = 0
        try:
            self.stderrp_reject = self.cfg.getfloat('settings', 'stderrp_reject')
        except (ConfigParser.NoSectionError, ConfigParser.NoOptionError):
            self.stderrp_reject = 100
        try:
            self.stderrp_attempts = self.cfg.getint('settings', 'stderrp_attempts')
        except (ConfigParser.NoSectionError, ConfigParser.NoOptionError):
            self.stderrp_attempts = 1
        self._resultfile = None
Exemple #10
0
    def __init__(self, dm=None, phone=None, options=None,
                 config_file=None, chunk=1, repos=[]):
        PhoneTest.__init__(self, dm=dm, phone=phone, options=options,
                           config_file=config_file, chunk=chunk, repos=repos)
        self._result_server = None
        self._resulturl = None
        self.perfherder_artifact = None
        if options.phonedash_url:
            self._resulturl = urlparse.urljoin(options.phonedash_url, '/api/s1s2/')
            self.loggerdeco.debug('PerfTest._resulturl: %s' % self._resulturl)

        # [signature]
        self._signer = None
        self._jwt = {'id': options.phonedash_user, 'key': options.phonedash_password}
        # phonedash requires both an id and a key.
        if self._jwt['id'] and self._jwt['key']:
            self._signer = jws.HmacSha(key=self._jwt['key'],
                                       key_id=self._jwt['id'])
        # [settings]
        try:
            self._iterations = self.cfg.getint('settings', 'iterations')
        except (ConfigParser.NoSectionError, ConfigParser.NoOptionError):
            self._iterations = 1
        try:
            self.stderrp_accept = self.cfg.getfloat('settings', 'stderrp_accept')
        except (ConfigParser.NoSectionError, ConfigParser.NoOptionError):
            self.stderrp_accept = 0
        try:
            self.stderrp_reject = self.cfg.getfloat('settings', 'stderrp_reject')
        except (ConfigParser.NoSectionError, ConfigParser.NoOptionError):
            self.stderrp_reject = 100
        try:
            self.stderrp_attempts = self.cfg.getint('settings', 'stderrp_attempts')
        except (ConfigParser.NoSectionError, ConfigParser.NoOptionError):
            self.stderrp_attempts = 1
        self.perfherder_options = {}
        try:
            self.perfherder_options['alert_threshold'] = self.cfg.getint('perfherder',
                                                                         'alert_threshold')
        except (ConfigParser.NoSectionError, ConfigParser.NoOptionError):
            pass
        try:
            self.perfherder_options['min_back_window'] = self.cfg.getint('perfherder',
                                                                         'min_back_window')
        except (ConfigParser.NoSectionError, ConfigParser.NoOptionError):
            pass
        try:
            self.perfherder_options['max_back_window'] = self.cfg.getint('perfherder',
                                                                         'max_back_window')
        except (ConfigParser.NoSectionError, ConfigParser.NoOptionError):
            pass
        try:
            self.perfherder_options['fore_window'] = self.cfg.getint('perfherder', 'fore_window')
        except (ConfigParser.NoSectionError, ConfigParser.NoOptionError):
            pass
        self._resultfile = None
        self._resultwriter = None

        self.loggerdeco.debug('PerfTest: %s', self.__dict__)
Exemple #11
0
    def teardown_job(self):
        self.loggerdeco.debug('PerfTest.teardown_job')

        if self._resultfile:
            self._resultfile.close()
            self._resultfile = None

        PhoneTest.teardown_job(self)
Exemple #12
0
 def __init__(self,
              phoneid=None,
              serial=None,
              ip=None,
              sutcmdport=None,
              sutdataport=None,
              osver=None):
     PhoneTest.__init__(self, phoneid, serial, ip, sutcmdport, sutdataport, osver)
Exemple #13
0
    def teardown_job(self):
        self.loggerdeco.debug("PerfTest.teardown_job")

        if self._resultfile:
            self._resultfile.close()
            self._resultfile = None

        PhoneTest.teardown_job(self)
        self.perfherder_artifact = None
Exemple #14
0
    def teardown_job(self):
        self.loggerdeco.debug('PerfTest.teardown_job')

        if self._resultfile:
            self._resultfile.close()
            self._resultfile = None

        PhoneTest.teardown_job(self)
        self.perfherder_artifact = None
Exemple #15
0
    def __init__(self, dm=None, phone=None, options=None,
                 config_file=None, chunk=1, repos=None):
        if repos is None:
            repos = []
        PhoneTest.__init__(self, dm=dm, phone=phone, options=options,
                           config_file=config_file, chunk=chunk, repos=repos)
        # Set the profile relative to the base_device_path. This will
        # match the profile used by the Unit Test runner.
        self.enable_unittests = True
        self.unittest_cfg = ConfigParser.RawConfigParser()

        unittest_config_file = self.cfg.get('runtests', 'unittest_defaults')
        self.unittest_cfg.read(unittest_config_file)

        self.loggerdeco.info('config_file = %s, unittest_config_file = %s' %
                             (config_file, unittest_config_file))

        self.parms = {
            'phoneid': self.phone.id,
            'config_file': config_file,
            'test_name': self.cfg.get('runtests', 'test_name'),
            'test_manifest': self.cfg.get('runtests', 'test_manifest'),
            'test_packages': set(self.cfg.get('runtests',
                                              'test_package_names').split(' ')),
        }

        self.parms['xre_path'] = self.unittest_cfg.get('runtests', 'xre_path')
        self.parms['utility_path'] = self.unittest_cfg.get('runtests', 'utility_path')
        if self.unittest_cfg.has_option('runtests', 'include_pass'):
            self.parms['include_pass'] = self.unittest_cfg.getboolean('runtests', 'include_pass')
        else:
            self.parms['include_pass'] = False

        if self.cfg.has_option('runtests', 'app_name'):
            self.parms['app_name'] = self.cfg.get('runtests', 'app_name')

        self.parms['console_level'] = self.unittest_cfg.get('runtests', 'console_level')
        self.parms['log_level'] = self.unittest_cfg.get('runtests', 'log_level')
        self.parms['time_out'] = self.unittest_cfg.getint('runtests', 'time_out')

        if self.cfg.has_option('runtests', 'iterations'):
            self.parms['iterations'] = self.cfg.getint('runtests', 'iterations')
        else:
            self.parms['iterations'] = 1

        if self.cfg.has_option('runtests', 'total_chunks'):
            self.chunks = self.cfg.getint('runtests', 'total_chunks')
Exemple #16
0
    def __init__(self, phone, options, config_file=None,
                 enable_unittests=False, test_devices_repos={},
                 chunk=1):
        PhoneTest.__init__(self, phone, options,
                           config_file=config_file,
                           enable_unittests=enable_unittests,
                           test_devices_repos=test_devices_repos,
                           chunk=chunk)
        self._result_server = None
        self._resulturl = None

        # [signature]
        self._signer = None
        self._jwt = {'id': '', 'key': None}
        for opt in self._jwt.keys():
            try:
                self._jwt[opt] = self.cfg.get('signature', opt)
            except (ConfigParser.NoSectionError,
                    ConfigParser.NoOptionError):
                break
        # phonedash requires both an id and a key.
        if self._jwt['id'] and self._jwt['key']:
            self._signer = jws.HmacSha(key=self._jwt['key'],
                                       key_id=self._jwt['id'])
        # [settings]
        try:
            self._iterations = self.cfg.getint('settings', 'iterations')
        except (ConfigParser.NoSectionError, ConfigParser.NoOptionError):
            self._iterations = 1
        try:
            self.stderrp_accept = self.cfg.getfloat('settings', 'stderrp_accept')
        except (ConfigParser.NoSectionError, ConfigParser.NoOptionError):
            self.stderrp_accept = 0
        try:
            self.stderrp_reject = self.cfg.getfloat('settings', 'stderrp_reject')
        except (ConfigParser.NoSectionError, ConfigParser.NoOptionError):
            self.stderrp_reject = 100
        try:
            self.stderrp_attempts = self.cfg.getint('settings', 'stderrp_attempts')
        except (ConfigParser.NoSectionError, ConfigParser.NoOptionError):
            self.stderrp_attempts = 1
        self._resultfile = None
        try:
            self._resulturl = self.cfg.get('settings', 'resulturl')
        except (ConfigParser.NoSectionError, ConfigParser.NoOptionError):
            self._resulturl = 'none'
Exemple #17
0
    def setup_job(self):
        PhoneTest.setup_job(self)
        build_dir = self.build.dir
        symbols_path = self.build.symbols
        if symbols_path and not os.path.exists(symbols_path):
            symbols_path = None
        re_revision = re.compile(r'http.*/rev/(.*)')
        match = re_revision.match(self.build.revision)
        if match:
            revision = match.group(1)
        else:
            revision = self.build.revision

        # Check that the device is accessible and that its network is up.
        ping_msg = self.worker_subprocess.ping(test=self, require_ip_address=True)
        if not self.worker_subprocess.is_ok():
            raise Exception(ping_msg)
        # Delay getting the phone's ip address until job setup.
        for attempt in range(1, self.options.device_ready_retry_attempts+1):
            self.phone_ip_address = self.dm.get_ip_address()
            if self.phone_ip_address:
                break
            self.loggerdeco.info('Attempt %d/%d failed to get ip address' %
                                 (attempt,
                                  self.options.device_ready_retry_attempts))
            time.sleep(self.options.device_ready_retry_wait)
        if not self.phone_ip_address:
            raise Exception('PhoneTest: Failed to get phone %s ip address' % self.phone.id)

        self.parms['host_ip_address'] = self.phone.host_ip
        self.parms['app_name'] = self.build.app_name
        self.parms['build_dir'] = build_dir
        self.parms['symbols_path'] = symbols_path
        self.parms['revision'] = revision
        self.parms['buildid'] = self.build.id
        self.parms['tree'] = self.build.tree

        self.unittest_logpath = '%s/tests/%s-%s-%s-%s.log' % (
            build_dir,
            self.parms['test_name'],
            os.path.basename(self.config_file),
            self.chunk,
            self.parms['phoneid'])
Exemple #18
0
 def teardown_job(self):
     self.loggerdeco.debug('PerfTest.teardown_job')
     PhoneTest.teardown_job(self)
Exemple #19
0
    def __init__(self, phone, options, config_file=None,
                 enable_unittests=False, test_devices_repos={},
                 chunk=1):
        PhoneTest.__init__(self, phone, options,
                           config_file=config_file,
                           enable_unittests=enable_unittests,
                           test_devices_repos=test_devices_repos,
                           chunk=chunk)
        self.unittest_cfg = ConfigParser.RawConfigParser()

        unittest_config_file = self.cfg.get('runtests', 'unittest_defaults')
        self.unittest_cfg.read(unittest_config_file)

        self.loggerdeco.info('config_file = %s, unittest_config_file = %s' %
                             (config_file, unittest_config_file))

        # Mochitests in particular are broken when run via adb. We must
        # use the SUTAgent and will need the phone's ip address.
        phone_ip_address = None
        for attempt in range(1, self.options.phone_retry_limit+1):
            phone_ip_address = self.dm.get_ip_address()
            self.loggerdeco.debug(
                'UnitTest: get phone ip address Attempt: %d: %s' %
                (attempt, phone_ip_address))
            if phone_ip_address:
                break
            time.sleep(self.options.phone_retry_wait)
        if not phone_ip_address:
            raise Exception('UnitTest: Failed to get phone %s ip address' % self.phone.id)

        self.parms = {
            'host_ip_address': self.phone.host_ip,
            'phone_ip_address': phone_ip_address,
            'phoneid': self.phone.id,
            'config_file': config_file,
            'test_name': self.cfg.get('runtests', 'test_name'),
            'test_manifest': self.cfg.get('runtests', 'test_manifest'),
        }

        self.parms['xre_path'] = self.unittest_cfg.get('runtests', 'xre_path')
        self.parms['utility_path'] = self.unittest_cfg.get('runtests', 'utility_path')
        if self.unittest_cfg.has_option('runtests', 'include_pass'):
            self.parms['include_pass'] = self.unittest_cfg.getboolean('runtests', 'include_pass')
        else:
            self.parms['include_pass'] = False

        if self.cfg.has_option('runtests', 'app_name'):
            self.parms['app_name'] = self.cfg.get('runtests', 'app_name')

        self.parms['console_level'] = self.unittest_cfg.get('runtests', 'console_level')
        self.parms['log_level'] = self.unittest_cfg.get('runtests', 'log_level')
        self.parms['time_out'] = self.unittest_cfg.getint('runtests', 'time_out')

        if self.cfg.has_option('runtests', 'iterations'):
            self.parms['iterations'] = self.cfg.getint('runtests', 'iterations')
        else:
            self.parms['iterations'] = 1

        if self.cfg.has_option('runtests', 'total_chunks'):
            self.chunks = self.cfg.getint('runtests', 'total_chunks')

        if self.cfg.has_option('runtests', 'prefs'):
            self.parms['prefs'] = self.cfg.get('runtests', 'prefs').split(',')
        else:
            self.parms['prefs'] = []
Exemple #20
0
    def setup_job(self):
        PhoneTest.setup_job(self)
        # Remove the AutophoneCrashProcessor set in PhoneTest.setup_job
        # since the Unit Test runner will handle crash processing.
        self.crash_processor = None
        build_dir = self.build.dir
        symbols_path = self.build.symbols
        if symbols_path and not os.path.exists(symbols_path):
            symbols_path = None
        re_revision = re.compile(r'http.*/rev/(.*)')
        match = re_revision.match(self.build.revision)
        if match:
            revision = match.group(1)
        else:
            revision = self.build.revision

        # Check that the device is accessible and that its network is up.
        ping_msg = self.worker_subprocess.ping(test=self, require_ip_address=True)
        if not self.worker_subprocess.is_ok():
            raise Exception(ping_msg)
        # Delay getting the phone's ip address until job setup.
        for attempt in range(1, self.options.device_ready_retry_attempts+1):
            self.phone_ip_address = self.dm.get_ip_address()
            if self.phone_ip_address:
                break
            self.loggerdeco.info('Attempt %d/%d failed to get ip address' %
                                 (attempt,
                                  self.options.device_ready_retry_attempts))
            time.sleep(self.options.device_ready_retry_wait)
        if not self.phone_ip_address:
            raise Exception('PhoneTest: Failed to get phone %s ip address' % self.phone.id)

        self.parms['host_ip_address'] = self.phone.host_ip
        self.parms['app_name'] = self.build.app_name
        self.parms['build_dir'] = build_dir
        self.parms['symbols_path'] = symbols_path
        self.parms['revision'] = revision
        self.parms['buildid'] = self.build.id
        self.parms['tree'] = self.build.tree

        self.unittest_logpath = '%s/tests/%s-%s-%s-%s.log' % (
            build_dir,
            self.parms['test_name'],
            os.path.basename(self.config_file),
            self.chunk,
            self.parms['phoneid'])

        if self.parms['test_name'] == 'robocoptest-autophone':
            if self.dm.is_app_installed(FLASH_PACKAGE):
                self.dm.uninstall_app(FLASH_PACKAGE)
            try:
                sdk = int(self.dm.get_prop('ro.build.version.sdk'))
            except ValueError:
                sdk = 9
            if sdk < 14:
                flash_apk = 'apk/install_flash_player_pre_ics.apk'
            else:
                flash_apk = 'apk/install_flash_player_ics.apk'
            if os.path.exists(flash_apk):
                self.dm.install_app(flash_apk)
            else:
                raise Exception('%s does not exist' % flash_apk)
Exemple #21
0
 def __init__(self, phone_cfg, config_file=None, status_cb=None):
     PhoneTest.__init__(self, phone_cfg, config_file, status_cb)
Exemple #22
0
 def teardown_job(self):
     os.unsetenv('MINIDUMP_STACKWALK')
     os.unsetenv('MINIDUMP_SAVE_PATH')
     os.unsetenv('MOZ_UPLOAD_DIR')
     PhoneTest.teardown_job(self)