Example #1
0
def main(request, response):
    path = os.path.join(root, "MANIFEST.json")
    manifest_file = manifest.load(path)
    manifest.update(root, "/", manifest_file)
    manifest.write(manifest_file, path)

    return [("Content-Type", "application/json")], json.dumps({"url": "/MANIFEST.json"})
Example #2
0
File: update.py Project: xfq/servo
def update_from_cli(**kwargs):
    tests_root = kwargs["tests_root"]
    path = kwargs["path"]
    assert tests_root is not None

    m = None
    logger = get_logger()

    if not kwargs.get("rebuild", False):
        try:
            m = manifest.load(tests_root, path)
        except manifest.ManifestVersionMismatch:
            logger.info("Manifest version changed, rebuilding")
            m = None
        else:
            logger.info("Updating manifest")

    if m is None:
        m = manifest.Manifest(None)

    update(tests_root,
           kwargs["url_base"],
           m,
           ignore_local=kwargs.get("ignore_local", False))
    manifest.write(m, path)
Example #3
0
def update_from_cli(**kwargs):
    tests_root = kwargs["tests_root"]
    path = kwargs["path"]
    assert tests_root is not None

    m = None
    logger = get_logger()

    if not kwargs.get("rebuild", False):
        try:
            m = manifest.load(tests_root, path)
        except manifest.ManifestVersionMismatch:
            logger.info("Manifest version changed, rebuilding")
            m = None
        else:
            logger.info("Updating manifest")

    if m is None:
        m = manifest.Manifest(kwargs["url_base"])

    changed = update(tests_root,
                     m,
                     working_copy=kwargs["work"])
    if changed:
        manifest.write(m, path)
def main(request, response):
    path = os.path.join(root, "MANIFEST.json")
    manifest_file = manifest.load(path)
    manifest.update(root, "/", manifest_file)
    manifest.write(manifest_file, path)

    return [("Content-Type", "application/json")
            ], json.dumps({"url": "/MANIFEST.json"})
Example #5
0
def load_manifest(test_root):
    if manifest is None:
        do_test_relative_imports(test_root)

    mainfest_path = os.path.abspath(os.path.join(os.path.split(__file__)[0],
                                                 "metadata", "MANIFEST.json"))

    manifest.setup_git(test_root)
    test_manifest = manifest.load(mainfest_path)
    manifest.update(test_manifest)
    return test_manifest
Example #6
0
 def _load_manifest(self, filename, directory=None, do_raise=True, is_link=False):
   if not directory:
     directory = os.path.dirname(filename)
   mf = manifest.load(filename, directory=directory)
   if any(f.errors for f in manifest.validate(mf)):
     if do_raise:
       raise InvalidPackageManifest("invalid package manifest: {!r}".format(filename))
     print('Warning: invalid package manifest')
     print("  at '{}'".format(filename))
     return None
   mf['__is_link'] = is_link
   return mf
Example #7
0
    def load_manifest(self, tests_path, metadata_path, url_base="/"):
        manifest_path = os.path.join(metadata_path, "MANIFEST.json")
        if (not os.path.exists(manifest_path) or self.force_manifest_update):
            self.update_manifest(manifest_path, tests_path, url_base)
        manifest_file = manifest.load(manifest_path)
        if manifest_file.url_base != url_base:
            self.logger.info("Updating url_base in manifest from %s to %s" %
                             (manifest_file.url_base, url_base))
            manifest_file.url_base = url_base
            manifest.write(manifest_file, manifest_path)

        return manifest_file
Example #8
0
    def load_manifest(self, tests_path, metadata_path, url_base="/"):
        manifest_path = os.path.join(metadata_path, "MANIFEST.json")
        if (not os.path.exists(manifest_path) or
            self.force_manifest_update):
            self.update_manifest(manifest_path, tests_path, url_base)
        manifest_file = manifest.load(manifest_path)
        if manifest_file.url_base != url_base:
            self.logger.info("Updating url_base in manifest from %s to %s" % (manifest_file.url_base,
                                                                              url_base))
            manifest_file.url_base = url_base
            manifest.write(manifest_file, manifest_path)

        return manifest_file
Example #9
0
def load_manifest(filename):
  """
  Loads a manifest and reports issues after it is validated.
  """

  data = manifest.load(filename)
  for field in manifest.validate(data):
    name = field.cfg or ''
    if name and name[-1] != '.':
      name += '>'
    name += field.name
    for msg in field.warnings:
      print('WARNING: {}@{} {}'.format(filename, name, msg))
    for msg in field.errors:
      print('CRITICAL: {}@{} {}'.format(filename, name, msg))
  return data
Example #10
0
def update_from_cli(**kwargs):
    tests_root = kwargs["tests_root"]
    path = kwargs["path"]
    assert tests_root is not None

    m = None

    if kwargs["download"]:
        download_from_github(path, tests_root)

    if not kwargs.get("rebuild", False):
        try:
            m = manifest.load(tests_root, path)
        except manifest.ManifestVersionMismatch:
            logger.info("Manifest version changed, rebuilding")
            m = None

    if m is None:
        m = manifest.Manifest(kwargs["url_base"])

    changed = update(tests_root, m, working_copy=kwargs["work"])
    if changed:
        manifest.write(m, path)
Example #11
0
 def load_manifest(self):
     if not os.path.exists(self.manifest_path):
         self.create_manifest()
     return manifest.load(self.manifest_path)
Example #12
0
 def load_manifest(self):
     if not os.path.exists(self.manifest_path):
         self.create_manifest()
     return manifest.load(self.manifest_path)
Example #13
0
        OPTIONS.hide_progress = True

    import manifest
    if JS is None:
        xul_tester = manifest.NullXULInfoTester()
    else:
        if OPTIONS.xul_info_src is None:
            xul_info = manifest.XULInfo.create(JS)
        else:
            xul_abi, xul_os, xul_debug = OPTIONS.xul_info_src.split(r':')
            xul_debug = xul_debug.lower() is 'true'
            xul_info = manifest.XULInfo(xul_abi, xul_os, xul_debug)
        xul_tester = manifest.XULInfoTester(xul_info, JS)

    test_dir = os.path.dirname(__file__)
    test_list = manifest.load(test_dir, xul_tester)
    skipped_list = []

    if OPTIONS.make_manifests:
        manifest.make_manifests(OPTIONS.make_manifests, test_list)
        if JS is None:
            sys.exit()

    if OPTIONS.test_file:
        paths = set()
        for test_file in OPTIONS.test_file:
            paths |= set(
                [line.strip() for line in open(test_file).readlines()])
        test_list = [_ for _ in test_list if _.path in paths]

    if args:
Example #14
0
def load_tests(options, js_shell, requested_paths, excluded_paths):
    """
    Returns a tuple: (skipped_tests, test_list)
        skip_list: [iterable<Test>] Tests found but skipped.
        test_list: [iterable<Test>] Tests found that should be run.
    """
    import manifest

    if js_shell is None:
        xul_tester = manifest.NullXULInfoTester()
    else:
        if options.xul_info_src is None:
            xul_info = manifest.XULInfo.create(js_shell)
        else:
            xul_abi, xul_os, xul_debug = options.xul_info_src.split(r':')
            xul_debug = xul_debug.lower() is 'true'
            xul_info = manifest.XULInfo(xul_abi, xul_os, xul_debug)
        xul_tester = manifest.XULInfoTester(xul_info, js_shell)

    test_dir = os.path.dirname(os.path.abspath(__file__))
    test_list = manifest.load(test_dir, xul_tester)
    skip_list = []

    if options.make_manifests:
        manifest.make_manifests(options.make_manifests, test_list)
        sys.exit()

    if options.test_file:
        paths = set()
        for test_file in options.test_file:
            paths |= set([ line.strip() for line in open(test_file).readlines()])
        test_list = [ _ for _ in test_list if _.path in paths ]

    if requested_paths:
        def p(path):
            for arg in requested_paths:
                if path.find(arg) != -1:
                    return True
            return False
        test_list = [ _ for _ in test_list if p(_.path) ]

    if options.exclude_file:
        test_list = [_ for _ in test_list if _.path not in excluded_paths]

    if options.no_extensions:
        pattern = os.sep + 'extensions' + os.sep
        test_list = [_ for _ in test_list if pattern not in _.path]

    if not options.random:
        test_list = [ _ for _ in test_list if not _.random ]

    if options.run_only_skipped:
        options.run_skipped = True
        test_list = [ _ for _ in test_list if not _.enable ]

    if not options.run_slow_tests:
        test_list = [ _ for _ in test_list if not _.slow ]

    if not options.run_skipped:
        skip_list = [ _ for _ in test_list if not _.enable ]
        test_list = [ _ for _ in test_list if _.enable ]

    return skip_list, test_list
Example #15
0
        OPTIONS.hide_progress = True

    import manifest
    if JS is None:
        xul_tester = manifest.NullXULInfoTester()
    else:
        if OPTIONS.xul_info_src is None:
            xul_info = manifest.XULInfo.create(JS)
        else:
            xul_abi, xul_os, xul_debug = OPTIONS.xul_info_src.split(r':')
            xul_debug = xul_debug.lower() is 'true'
            xul_info = manifest.XULInfo(xul_abi, xul_os, xul_debug)
        xul_tester = manifest.XULInfoTester(xul_info, JS)

    test_dir = os.path.dirname(__file__)
    test_list = manifest.load(test_dir, xul_tester)
    skipped_list = []

    if OPTIONS.make_manifests:
        manifest.make_manifests(OPTIONS.make_manifests, test_list)
        if JS is None:
            sys.exit()

    if OPTIONS.test_file:
        paths = set()
        for test_file in OPTIONS.test_file:
            paths |= set([ line.strip() for line in open(test_file).readlines()])
        test_list = [ _ for _ in test_list if _.path in paths ]

    if args:
        def p(path):