예제 #1
0
def get_test_candidate():
    """Download and extract a build candidate.

    Build may either refer to a Firefox release identifier, package, or build directory.
    :param: build: str with firefox build
    :return: Installation path for the Firefox App
    """

    if parse_args().firefox == 'local':
        candidate = get_local_firefox_path()
        if candidate is None:
            logger.critical(
                'Firefox not found. Please download if from https://www.mozilla.org/en-US/firefox/new/'
            )
    else:
        try:
            locale = 'ja-JP-mac' if parse_args(
            ).locale == 'ja' and Settings.is_mac() else parse_args().locale
            type, scraper_details = get_scraper_details(
                parse_args().firefox, Settings.CHANNELS,
                os.path.join(IrisCore.get_working_dir(), 'cache'), locale)
            scraper = FactoryScraper(type, **scraper_details)

            firefox_dmg = scraper.download()
            install_folder = install(src=firefox_dmg,
                                     dest=IrisCore.get_current_run_dir())

            return get_binary(install_folder, 'Firefox')
        except errors.NotFoundError:
            logger.critical(
                'Specified build (%s) has not been found. Closing Iris ...' %
                parse_args().firefox)
    return None
예제 #2
0
def load_tests(master_test_list):
    """Test loading

    Test loading is done by providing a list of test names separated by comma, a path to a file containing a custom list
    of tests or a directory. The provided list of test names can be with or without .py extension.

    The path to the file that contains the list of tests should have .txt extension. The full path is needed. For
    example: '/Users/user_name/full_path/test_suite.txt'. The content of the file should be a simple line-delimited list
    of test paths (full path required including file extensions).
    """

    temp_test_list_1 = []
    temp_test_packages_1 = []
    temp_test_list_2 = []
    temp_test_packages_2 = []

    args = parse_args()

    if args.rerun:
        path = os.path.join(args.workdir, 'runs', 'last_fail.txt')
        args.test = path
        logger.info('Re-running failed tests from previous run.')

    if args.test:
        if args.test.endswith('.txt'):
            logger.debug('Loading tests from text file: %s' % args.test)
            temp_test_list_1, temp_test_packages_1 = get_tests_from_text_file(
                args.test)
        else:
            logger.debug('Loading tests from list.')
            temp_test_list_1, temp_test_packages_1 = get_tests_from_list(
                master_test_list)

    if args.directory:
        if not os.path.exists(args.directory):
            logger.debug('Loading tests from packages.')
            temp_test_list_2, temp_test_packages_2 = get_tests_from_package(
                master_test_list)
        elif not args.test:
            logger.debug('Loading tests from directory: %s' % args.directory)
            temp_test_list_2, temp_test_packages_2 = get_tests_from_directory(
                master_test_list)

    test_list = temp_test_list_1 + temp_test_list_2
    test_packages = temp_test_packages_1 + temp_test_packages_2

    exclude_tests = get_excluded_tests_list(master_test_list)

    for item in exclude_tests:
        try:
            test_list.remove(item)
        except ValueError:
            logger.debug('Excluded item not found in test list: %s' % item)

    logger.debug('Found tests: %s' % ''.join(test_list))
    logger.debug('Found packages: %s' % ''.join(test_packages))

    return test_list, test_packages
예제 #3
0
    def __init__(self):
        path = get_test_candidate()
        if path is None:
            raise ValueError

        self.path = path
        self.channel = get_firefox_channel(path)
        self.version = get_firefox_version(path)
        self.build_id = get_firefox_build_id(path)
        self.locale = parse_args().locale
        self.latest_version = get_firefox_latest_version(path)
예제 #4
0
파일: results.py 프로젝트: exaltcg/iris
def write_test_failures(failures, master_test_list):
    master_run_directory = os.path.join(parse_args().workdir, 'runs')
    path = os.path.join(master_run_directory, 'last_fail.txt')

    if len(failures):
        if os.path.exists(path):
            os.remove(path)
        last_fail = open(path, 'w')
        for item in failures:
            for package in master_test_list:
                for test in master_test_list[package]:
                    if test["name"] == item:
                        last_fail.write(test["module"] + '\n')
        last_fail.close()
예제 #5
0
def get_tests_from_package(master_test_list):
    test_list = []
    test_packages = [
        str(item).strip() for item in parse_args().directory.split(',')
    ]
    for package in test_packages:
        try:
            if master_test_list[package]:
                for test in master_test_list[package]:
                    test_list.append(test["name"])
        except KeyError:
            logger.warning('Could not locate %s' % package)
    if len(test_list) == 0:
        logger.debug('No tests associated with package(s): %s' % test_packages)
    return test_list, test_packages
예제 #6
0
def get_excluded_tests_list(master_test_list):
    args = parse_args()
    if args.exclude:
        exclude_list = [str(item).strip() for item in args.exclude.split(',')]
        logger.debug('Processing exclude list: %s' % ''.join(exclude_list))

        test_list = []
        for item in exclude_list:
            try:
                for test in master_test_list[item]:
                    test_list.append(test["name"])
            except KeyError:
                logger.debug('Could not find package: %s' % item)

        exclude_list += test_list
        return exclude_list
    return []
예제 #7
0
def get_tests_from_list(master_test_list):
    test_list = []
    test_packages = []

    for name in parse_args().test.split(','):
        if '.py' in name:
            name = name.split('.py')[0]
        name = name.strip()
        for package in master_test_list:
            for test in master_test_list[package]:
                if name == test['name']:
                    test_list.append(name)
                    if package not in test_packages:
                        test_packages.append(package)
        if name not in test_list:
            logger.warning('Could not locate test: %s' % name)

    if len(test_list) == 0:
        logger.error('No tests to run. Exiting program ...')
    return test_list, test_packages