Exemple #1
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
Exemple #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
Exemple #3
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
Exemple #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
Exemple #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
Exemple #6
0
 def setup_job(self):
     PerfTest.setup_job(self)
     # [paths]
     autophone_directory = os.path.dirname(os.path.abspath(sys.argv[0]))
     self._paths = {}
     self._paths['webappstartup_apk'] = os.path.join(autophone_directory,
                                                     'tests/webapp-startup-test.apk')
     # Try to get the webappstartup package name if it is already installed.
     self.get_webappstartup_name()
     # Perform an initial install of the webapp to confirm it
     # can be installed.
     if not self.install_webappstartup():
         raise Exception('Unable to install %s' % self._paths['webappstartup_apk'])
Exemple #7
0
 def teardown_job(self):
     # We must tear down the PerfTest before uninstalling
     # webappstartup, because we need the profile and minidumps
     # directory for crash processing.
     PerfTest.teardown_job(self)
     if self.webappstartup_name:
         try:
             # Make certain to catch any exceptions in order
             # to ensure that the test teardown completes.
             self.dm.uninstall_app(self.webappstartup_name)
         except:
             self.loggerdeco.exception('Exception uninstalling %s',
                                       self.webappstartup_name)
Exemple #8
0
 def teardown_job(self):
     # We must tear down the PerfTest before uninstalling
     # webappstartup, because we need the profile and minidumps
     # directory for crash processing.
     PerfTest.teardown_job(self)
     if self.webappstartup_name:
         try:
             # Make certain to catch any exceptions in order
             # to ensure that the test teardown completes.
             self.dm.uninstall_app(self.webappstartup_name)
         except:
             self.loggerdeco.exception('Exception uninstalling %s' %
                                       self.webappstartup_name)
Exemple #9
0
 def setup_job(self):
     PerfTest.setup_job(self)
     # [paths]
     autophone_directory = os.path.dirname(os.path.abspath(sys.argv[0]))
     self._paths = {}
     self._paths['webappstartup_apk'] = os.path.join(
         autophone_directory, 'tests/webapp-startup-test.apk')
     # Try to get the webappstartup package name if it is already installed.
     self.get_webappstartup_name()
     # Perform an initial install of the webapp to confirm it
     # can be installed.
     if not self.install_webappstartup():
         raise Exception('Unable to install %s' %
                         self._paths['webappstartup_apk'])
Exemple #10
0
    def create_profile(self):
        retVal = PerfTest.create_profile(self)

        config_file = os.path.join(self.build.dir, 'robotium.config')
        with open(config_file, 'w') as fHandle:
            fHandle.write("profile=%s\n" % self.profile_path)

            remoteLog = self._paths['dest'] + "/tcheck3.log"
            fHandle.write("logfile=%s\n" % remoteLog)
            fHandle.write("host=%s\n" % self.options.webserver_url)
            fHandle.write("rawhost=%s\n" % self.options.webserver_url)
            envstr = ""
            delim = ""
            # This is not foolproof and the ideal solution would be to have
            # one env/line instead of a single string
            env_vars = {'MOZ_CRASHREPORTER_SHUTDOWN': 1,
                        'NO_EM_RESTART': 1,
                        'MOZ_CRASHREPORTER_NO_REPORT': 1,
                        'MOZ_CRASHREPORTER': 1}
#TODO: disabled until we have a single device and we can tweak the test for
#      network access
#                        'MOZ_DISABLE_NONLOCAL_CONNECTIONS': 1}
            for item in env_vars:
                envstr += "%s%s=%s" % (delim, item, env_vars[item])
                delim = ","
            fHandle.write("envvars=%s\n" % envstr)

        self.dm.push(config_file, self._paths['dest'])
        return retVal
Exemple #11
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__)
Exemple #12
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__)
Exemple #13
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')
Exemple #14
0
 def setup_job(self):
     PerfTest.setup_job(self)
Exemple #15
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
Exemple #16
0
 def teardown_job(self):
     if self.webappstartup_name:
         self.dm.uninstall_app(self.webappstartup_name)
     PerfTest.teardown_job(self)
    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__)
Exemple #18
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'