예제 #1
0
def update_expected(manifest, change_data, results):
    tests_needing_review = set()

    run_info = test_.RunInfo(False)

    for path, items in manifest:
        for manifest_item in items:
            if manifest_item.item_type in ("manual", "helper"):
                continue

            test = test_.from_manifest(manifest_item)

            if test.id in results:
                #XXX might want to allow this?
                assert not test.disabled(run_info)
                new_expected, review_needed  = get_new_expected(test,
                                                                run_info,
                                                                results[test.id],
                                                                change_data.get(test.path, "unchanged"))
                if review_needed:
                    tests_needing_review.add(test)
            #Need some run_info to pass in here
            elif test.disabled(run_info):
                new_expected = test.expected.copy()
            else:
                logger.error("Missing result for test %s" % (test.id,))
                new_expected = None


            expected_path = test.expected.path
            if os.path.exists(expected_path):
                os.unlink(expected_path)

            if new_expected is not None and not new_expected.empty():
                expected_dir = os.path.split(expected_path)[0]
                if not os.path.exists(expected_dir):
                    os.makedirs(expected_dir)

                with open(expected_path, "w") as f:
                    expected.dump(new_expected, f)

    return tests_needing_review
예제 #2
0
def update_expected(manifest, change_data, results):
    tests_needing_review = set()

    run_info = test_.RunInfo(False)

    for path, items in manifest:
        for manifest_item in items:
            if manifest_item.item_type in ("manual", "helper"):
                continue

            test = test_.from_manifest(manifest_item)

            if test.id in results:
                #XXX might want to allow this?
                assert not test.disabled(run_info)
                new_expected, review_needed = get_new_expected(
                    test, run_info, results[test.id],
                    change_data.get(test.path, "unchanged"))
                if review_needed:
                    tests_needing_review.add(test)
            #Need some run_info to pass in here
            elif test.disabled(run_info):
                new_expected = test.expected.copy()
            else:
                logger.error("Missing result for test %s" % (test.id, ))
                new_expected = None

            expected_path = test.expected.path
            if os.path.exists(expected_path):
                os.unlink(expected_path)

            if new_expected is not None and not new_expected.empty():
                expected_dir = os.path.split(expected_path)[0]
                if not os.path.exists(expected_dir):
                    os.makedirs(expected_dir)

                with open(expected_path, "w") as f:
                    expected.dump(new_expected, f)

    return tests_needing_review
예제 #3
0
def queue_tests(test_root, test_types, run_info, include_filters):
    test_ids = []
    tests_by_type = defaultdict(Queue)

    test_manifest = metadata.load_manifest(test_root)

    for test_type in test_types:
        for test in test_manifest.itertype(test_type):
            queue_test = False
            if include_filters:
                for filter_str in include_filters:
                    if test.url.startswith(filter_str):
                        queue_test = True
            else:
                queue_test = True
            if queue_test:
                test = test_.from_manifest(test)
                if not test.disabled(run_info):
                    tests_by_type[test_type].put(test)
                    test_ids.append(test.id)

    return test_ids, tests_by_type