Example #1
0
    def __init__(self, dm=None, phone=None, options=None,
                 config_file=None, chunk=1, repos=None):

        if repos is None:
            repos = []
        PerfTest.__init__(self, dm=dm, phone=phone, options=options,
                          config_file=config_file, chunk=chunk, repos=repos)

        # Map URLS - {urlname: url} - urlname serves as testname
        self._urls = {}
        config_vars = {'webserver_url': options.webserver_url}

        try:
            location_items = self.cfg.items('locations', False, config_vars)
        except ConfigParser.NoSectionError:
            location_items = [('local', None)]

        # Finialize test configuration
        for test_location, test_path in location_items:
            if test_location in config_vars:
                # Ignore the pseudo-options which result from passing
                # the config_vars for interpolation.
                continue
            for test_name in self._tests:
                if test_path:
                    test_url = urlparse.urljoin(test_path, self._tests[test_name])
                else:
                    test_url = 'file://' + os.path.join(self._paths['dest'],
                                                        self._tests[test_name])
                self.loggerdeco.debug(
                    'test_location: %s, test_name: %s, test_path: %s, '
                    'test: %s, test_url: %s' %
                    (test_location, test_name, test_path,
                     self._tests[test_name], test_url))
                self._urls["%s-%s" % (test_location, test_name)] = test_url
Example #2
0
 def __init__(self, dm=None, phone=None, options=None,
              config_file=None, chunk=1, repos=[]):
     PerfTest.__init__(self, dm=dm, phone=phone, options=options,
                       config_file=config_file, chunk=chunk, repos=repos)
     self.webappstartup_name = None
     # Enable the consoleservice for logcat in release builds.
     self.preferences["consoleservice.logcat"] = True
Example #3
0
    def __init__(self, dm=None, phone=None, options=None,
                 config_file=None, chunk=1, repos=[]):

        PerfTest.__init__(self, dm=dm, phone=phone, options=options,
                          config_file=config_file, chunk=chunk, repos=repos)

        self.enable_unittests = True
        self._test_args = {}
        config_vars = {'webserver_url': options.webserver_url}

        try:
            location_items = self.cfg.items('locations', False, config_vars)
        except ConfigParser.NoSectionError:
            location_items = [('local', None)]

        # Finialize test configuration
        for test_location, test_path in location_items:
            if test_location in config_vars:
                # Ignore the pseudo-options which result from passing
                # the config_vars for interpolation.
                continue

            for test_name in self._tests:
                test_url = ('am instrument -w -e deviceroot %s %s' %
                            (self._paths['dest'],
                             self.cfg.get('settings', 'tcheck_args')
                           ))

                self.loggerdeco.debug(
                    'test_location: %s, test_name: %s, test_path: %s, '
                    'test: %s, adb args: %s' %
                    (test_location, test_name, test_path,
                     self._tests[test_name], test_url))
                self._test_args["%s-%s" % (test_location, test_name)] = test_url
Example #4
0
 def __init__(self, phone, options, config_file=None,
              enable_unittests=False, test_devices_repos={},
              chunk=1):
     PerfTest.__init__(self, phone, options,
                       config_file=config_file,
                       enable_unittests=enable_unittests,
                       test_devices_repos=test_devices_repos,
                       chunk=chunk)
     self.webappstartup_name = None
Example #5
0
    def __init__(self, dm=None, phone=None, options=None,
                 config_file=None, chunk=1, repos=[]):

        PerfTest.__init__(self, dm=dm, phone=phone, options=options,
                          config_file=config_file, chunk=chunk, repos=repos)

        self._test_args = {}
        config_vars = {'webserver_url': options.webserver_url}

        try:
            location_items = self.cfg.items('locations', False, config_vars)
        except ConfigParser.NoSectionError:
            location_items = [('local', None)]

        # Finialize test configuration
        for test_location, test_path in location_items:
            if test_location in config_vars:
                # Ignore the pseudo-options which result from passing
                # the config_vars for interpolation.
                continue

            for test_name in self._tests:
                tpname = self._tests[test_name]
                tpargs = self.cfg.get('settings', 'tpargs')
                manifest_root = "file:%s" % self._paths['dest']
                tppath = os.path.join(manifest_root, tpname)
                extra_args = "-tp %s.develop %s" % (tppath, tpargs)

                try:
                    for source in self._paths['sources']:
                        fname = os.path.join(self.autophone_directory,
                                             source, tpname)
                        if not os.path.exists(fname):
                            continue

                        with open(fname, 'r') as fHandle:
                            lines = fHandle.readlines()

                        if test_location == 'remote':
                            manifest_root = options.webserver_url

                        manifest = "%s.develop" % fname
                        with open(manifest, 'w') as fHandle:
                            for line in lines:
                                fHandle.write(line.replace('%webserver%',
                                                           manifest_root))
                        self._pushes[manifest] = "%s.develop" % self._pushes[fname]

                except Exception:
                    pass

                self.loggerdeco.debug(
                    'test_location: %s, test_name: %s, test_path: %s, '
                    'test: %s, extra_args: %s' %
                    (test_location, test_name, test_path,
                     self._tests[test_name], extra_args))
                self._test_args["%s-%s" % (test_location, test_name)] = extra_args
Example #6
0
    def __init__(self,
                 dm=None,
                 phone=None,
                 options=None,
                 config_file=None,
                 chunk=1,
                 repos=[]):

        PerfTest.__init__(self,
                          dm=dm,
                          phone=phone,
                          options=options,
                          config_file=config_file,
                          chunk=chunk,
                          repos=repos)

        # Map URLS - {urlname: url} - urlname serves as testname
        self._urls = {}
        config_vars = {'webserver_url': options.webserver_url}

        try:
            location_items = self.cfg.items('locations', False, config_vars)
        except ConfigParser.NoSectionError:
            location_items = [('local', None)]

        # Finialize test configuration
        for test_location, test_path in location_items:
            if test_location in config_vars:
                # Ignore the pseudo-options which result from passing
                # the config_vars for interpolation.
                continue
            for test_name in self._tests:
                if test_path:
                    test_url = urlparse.urljoin(test_path,
                                                self._tests[test_name])
                else:
                    test_url = 'file://' + os.path.join(
                        self._paths['dest'], self._tests[test_name])
                self.loggerdeco.debug(
                    'test_location: %s, test_name: %s, test_path: %s, '
                    'test: %s, test_url: %s' %
                    (test_location, test_name, test_path,
                     self._tests[test_name], test_url))
                self._urls["%s-%s" % (test_location, test_name)] = test_url

        self.loggerdeco.debug('S1S2Test: %s', self.__dict__)
Example #7
0
    def __init__(self,
                 dm=None,
                 phone=None,
                 options=None,
                 config_file=None,
                 chunk=1,
                 repos=[]):
        PerfTest.__init__(self,
                          dm=dm,
                          phone=phone,
                          options=options,
                          config_file=config_file,
                          chunk=chunk,
                          repos=repos)
        self.webappstartup_name = None
        # Enable the consoleservice for logcat in release builds.
        self.preferences["consoleservice.logcat"] = True
        self.testname = 'webappstartup'

        self.loggerdeco.debug('WebappStartupTest: %s', self.__dict__)
    def __init__(self,
                 dm=None,
                 phone=None,
                 options=None,
                 config_file=None,
                 chunk=1,
                 repos=[]):

        PerfTest.__init__(self,
                          dm=dm,
                          phone=phone,
                          options=options,
                          config_file=config_file,
                          chunk=chunk,
                          repos=repos)

        self._test_args = {}
        config_vars = {'webserver_url': options.webserver_url}

        try:
            location_items = self.cfg.items('locations', False, config_vars)
        except ConfigParser.NoSectionError:
            location_items = [('local', None)]

        # Finialize test configuration
        tpargs = self.cfg.get('settings', 'tpargs')
        for test_location, test_path in location_items:
            if test_location in config_vars:
                # Ignore the pseudo-options which result from passing
                # the config_vars for interpolation.
                continue

            for test_name in self._tests:
                try:
                    manifest = self._tests[test_name]

                    if not os.path.exists(manifest):
                        self.loggerdeco.debug('ignoring manifest for %s',
                                              manifest)
                        continue

                    with open(manifest, 'r') as fHandle:
                        lines = fHandle.readlines()

                    manifest_path = os.path.dirname(manifest)
                    manifest_file = os.path.basename(manifest)
                    test_manifest_path = os.path.join(manifest_path,
                                                      'manifest')
                    test_manifest_file = "%s.%s" % (manifest_file,
                                                    test_location)
                    test_manifest = os.path.join(test_manifest_path,
                                                 test_manifest_file)

                    if not os.path.isdir(test_manifest_path):
                        os.mkdir(test_manifest_path)

                    if test_location == 'remote':
                        url_root = test_path
                    else:
                        url_root = 'file://' + self._paths['dest']

                    with open(test_manifest, 'w') as fHandle:
                        for line in lines:
                            fHandle.write(line.replace('%webserver%',
                                                       url_root))
                    dest_manifest = os.path.join(self._paths['dest'],
                                                 test_manifest_path,
                                                 test_manifest_file)
                    self._pushes[test_manifest] = dest_manifest

                    extra_args = "-tp file://%s %s" % (dest_manifest, tpargs)

                    self._test_args["%s-%s" %
                                    (test_location, test_name)] = extra_args

                    self.loggerdeco.debug(
                        'generating manifest: test_location: %s, test_path: %s, '
                        'test_name: %s, manifest: %s, extra_args: %s',
                        test_location, test_name, test_path, manifest,
                        extra_args)

                except Exception:
                    self.loggerdeco.exception(
                        'generating manifest: test_location: %s, test_path: %s, '
                        'test_name: %s, manifest: %s', test_location,
                        test_name, test_path, manifest)
                    raise

        self.loggerdeco.debug('TalosTest: %s', self.__dict__)
Example #9
0
    def __init__(self, dm=None, phone=None, options=None,
                 config_file=None, chunk=1, repos=[]):
        PerfTest.__init__(self, dm=dm, phone=phone, options=options,
                          config_file=config_file, chunk=chunk, repos=repos)

        # [paths]
        autophone_directory = os.path.dirname(os.path.abspath(sys.argv[0]))
        self._paths = {}
        self._paths['dest'] = posixpath.join(self.base_device_path, 's1s2test/')
        try:
            sources = self.cfg.get('paths', 'sources').split()
            self._paths['sources'] = []
            for source in sources:
                if not source.endswith('/'):
                    source += '/'
                self._paths['sources'].append(source)
        except (ConfigParser.NoSectionError, ConfigParser.NoOptionError):
            self._paths['sources'] = [
                os.path.join(autophone_directory, 'files/base/'),
                os.path.join(autophone_directory, 'files/s1s2/')]
        try:
            self._paths['dest'] = self.cfg.get('paths', 'dest')
            if not self._paths['dest'].endswith('/'):
                self._paths['dest'] += '/'
        except (ConfigParser.NoSectionError, ConfigParser.NoOptionError):
            pass
        try:
            self._paths['profile'] = self.cfg.get('paths', 'profile')
            if not self._paths['profile'].endswith('/'):
                self._paths['profile'] += '/'
        except (ConfigParser.NoSectionError, ConfigParser.NoOptionError):
            pass
        if 'profile' in self._paths:
            self.profile_path = self._paths['profile']
        # _pushes = {'sourcepath' : 'destpath', ...}
        self._pushes = {}
        for source in self._paths['sources']:
            for push in glob.glob(source + '*'):
                if push.endswith('~') or push.endswith('.bak'):
                    continue
                push_dest = posixpath.join(self._paths['dest'], os.path.basename(push))
                self._pushes[push] = push_dest
        # [tests]
        self._tests = {}
        try:
            for t in self.cfg.items('tests'):
                self._tests[t[0]] = t[1]
        except ConfigParser.NoSectionError:
            self._tests['blank'] = 'blank.html'
        # Map URLS - {urlname: url} - urlname serves as testname
        self._urls = {}
        config_vars = {'webserver_url': options.webserver_url}
        try:
            location_items = self.cfg.items('locations', False, config_vars)
        except ConfigParser.NoSectionError:
            location_items = [('local', None)]
        for test_location, test_path in location_items:
            if test_location in config_vars:
                # Ignore the pseudo-options which result from passing
                # the config_vars for interpolation.
                continue
            for test_name in self._tests:
                if test_path:
                    test_url = urlparse.urljoin(test_path, self._tests[test_name])
                else:
                    test_url = os.path.join('file://', self._paths['dest'],
                                            self._tests[test_name])
                self.loggerdeco.debug(
                    'test_location: %s, test_name: %s, test_path: %s, '
                    'test: %s, test_url: %s' %
                    (test_location, test_name, test_path,
                     self._tests[test_name], test_url))
                self._urls["%s-%s" % (test_location, test_name)] = test_url
        self._initialize_url = os.path.join('file://', self._paths['dest'],
                                            'initialize_profile.html')
Example #10
0
    def __init__(self, dm=None, phone=None, options=None,
                 config_file=None, chunk=1, repos=[]):

        PerfTest.__init__(self, dm=dm, phone=phone, options=options,
                          config_file=config_file, chunk=chunk, repos=repos)

        self._test_args = {}
        config_vars = {'webserver_url': options.webserver_url}

        try:
            location_items = self.cfg.items('locations', False, config_vars)
        except ConfigParser.NoSectionError:
            location_items = [('local', None)]

        # Finialize test configuration
        tpargs = self.cfg.get('settings', 'tpargs')
        for test_location, test_path in location_items:
            if test_location in config_vars:
                # Ignore the pseudo-options which result from passing
                # the config_vars for interpolation.
                continue

            for test_name in self._tests:
                try:
                    manifest = self._tests[test_name]

                    if not os.path.exists(manifest):
                        self.loggerdeco.debug('ignoring manifest for %s' % manifest)
                        continue

                    with open(manifest, 'r') as fHandle:
                        lines = fHandle.readlines()

                    manifest_path = os.path.dirname(manifest)
                    manifest_file = os.path.basename(manifest)
                    test_manifest_path = os.path.join(manifest_path, 'manifest')
                    test_manifest_file = "%s.%s" % (manifest_file, test_location)
                    test_manifest = os.path.join(test_manifest_path, test_manifest_file)

                    if not os.path.isdir(test_manifest_path):
                        os.mkdir(test_manifest_path)

                    if test_location == 'remote':
                        url_root = test_path
                    else:
                        url_root = 'file://' + self._paths['dest']

                    with open(test_manifest, 'w') as fHandle:
                        for line in lines:
                            fHandle.write(line.replace('%webserver%',
                                                       url_root))
                    dest_manifest = os.path.join(self._paths['dest'],
                                                 test_manifest_path,
                                                 test_manifest_file)
                    self._pushes[test_manifest] = dest_manifest

                    extra_args = "-tp file://%s %s" % (dest_manifest, tpargs)

                    self._test_args["%s-%s" % (test_location, test_name)] = extra_args

                    self.loggerdeco.debug(
                        'generating manifest: test_location: %s, test_path: %s, '
                        'test_name: %s, manifest: %s, extra_args: %s' %
                        (test_location, test_name, test_path, manifest,
                         extra_args))

                except Exception:
                    self.loggerdeco.exception(
                        'generating manifest: test_location: %s, test_path: %s, '
                        'test_name: %s, manifest: %s' %
                        (test_location, test_name, test_path, manifest))
                    raise
Example #11
0
    def __init__(self, phone, options, config_file=None,
                 enable_unittests=False, test_devices_repos={},
                 chunk=1):
        PerfTest.__init__(self, phone, options,
                          config_file=config_file,
                          enable_unittests=enable_unittests,
                          test_devices_repos=test_devices_repos,
                          chunk=chunk)

        # [paths]
        autophone_directory = os.path.dirname(os.path.abspath(sys.argv[0]))
        self._paths = {}
        self._paths['dest'] = posixpath.join(self.base_device_path, 's1s2test/')
        try:
            sources = self.cfg.get('paths', 'sources').split()
            self._paths['sources'] = []
            for source in sources:
                if not source.endswith('/'):
                    source += '/'
                self._paths['sources'].append(source)
        except (ConfigParser.NoSectionError, ConfigParser.NoOptionError):
            self._paths['sources'] = [
                os.path.join(autophone_directory, 'files/base/'),
                os.path.join(autophone_directory, 'files/s1s2/')]
        try:
            self._paths['dest'] = self.cfg.get('paths', 'dest')
            if not self._paths['dest'].endswith('/'):
                self._paths['dest'] += '/'
        except (ConfigParser.NoSectionError, ConfigParser.NoOptionError):
            pass
        try:
            self._paths['profile'] = self.cfg.get('paths', 'profile')
            if not self._paths['profile'].endswith('/'):
                self._paths['profile'] += '/'
        except (ConfigParser.NoSectionError, ConfigParser.NoOptionError):
            pass
        if 'profile' in self._paths:
            self.profile_path = self._paths['profile']
        # _pushes = {'sourcepath' : 'destpath', ...}
        self._pushes = {}
        for source in self._paths['sources']:
            for push in glob.glob(source + '*'):
                if push.endswith('~') or push.endswith('.bak'):
                    continue
                push_dest = posixpath.join(self._paths['dest'], os.path.basename(push))
                self._pushes[push] = push_dest
        # [tests]
        self._tests = {}
        try:
            for t in self.cfg.items('tests'):
                self._tests[t[0]] = t[1]
        except ConfigParser.NoSectionError:
            self._tests['blank'] = 'blank.html'
        # Map URLS - {urlname: url} - urlname serves as testname
        self._urls = {}
        try:
            location_items = self.cfg.items('locations')
        except ConfigParser.NoSectionError:
            location_items = [('local', None)]
        for test_location, test_path in location_items:
            for test_name in self._tests:
                if test_path:
                    test_url = test_path + self._tests[test_name]
                else:
                    test_url = 'file://' + self._paths['dest'] + self._tests[test_name]
                self._urls["%s-%s" % (test_location, test_name)] = test_url
        self._initialize_url = 'file://' + self._paths['dest'] + 'initialize_profile.html'