Skip to content

Commit

Permalink
fixup! Update manifest to support reftest chains.
Browse files Browse the repository at this point in the history
  • Loading branch information
jgraham committed Jan 29, 2015
1 parent b886ead commit e3d3a15
Show file tree
Hide file tree
Showing 9 changed files with 36 additions and 41 deletions.
14 changes: 7 additions & 7 deletions README.md
Expand Up @@ -135,14 +135,14 @@ which you've noted an interoperability bug in a browser.

The way to contribute is just as usual:

* fork this repository (and make sure you're still relatively in sync
with it if you forked a while ago);
* create a branch for your changes:
* Fork this repository (and make sure you're still relatively in sync
with it if you forked a while ago)
* Create a branch for your changes:
`git checkout -b your-name/topic`;
* make your changes;
* Make your changes
* Run the lint script described below
* Commit locally push that to your repo;
* and send in a pull request based on the above.
* Commit locally and push that to your repo
* Send in a pull request based on the above.

A lint is available to test for common mistakes in testcases. It can
be run with:
Expand All @@ -162,7 +162,7 @@ Adding command-line scripts ("tools" subdirs)

Sometimes you may want to add a script to the repository that's meant
to be used from the command line, not from a browser (e.g., a script
for generating test files). If you want to ensure (e.g., or security
for generating test files). If you want to ensure (e.g., for security
reasons) that such scripts won't be handled by the HTTP server, but
will instead only be usable from the command line, then place them in
either:
Expand Down
4 changes: 2 additions & 2 deletions docs/reftests.md
Expand Up @@ -32,13 +32,13 @@ only passes if the *test* and *reference* have pixel-perfect identical
rendering. `rel="mismatch"` inverts this so the test only passes when
the renderings differ.

In general the files used in a reftest should follow the follow the
In general the files used in a reftest should follow the
[format][format] and [style][style] guidelines. The *test* should also
be [self-describing][selfdesc], to allow a human to determine whether
the the rendering is as expected.

Note that references can be shared between tests; this is strongly
encouraged since it permits optimisations when running tests.
encouraged since it permits optimizations when running tests.

## Controlling When Comparison Occurs

Expand Down
2 changes: 1 addition & 1 deletion docs/submission-process.md
Expand Up @@ -20,7 +20,7 @@ on, e.g. `git checkout -b topic-name`

* Push your local branch to your GitHub repository

* Using the GitHub UI create a PUll Request for your branch.
* Using the GitHub UI create a Pull Request for your branch.

* When you get review comments, make more commits to your branch to
address the comments (**note**: Do *not* rewrite existing commits using
Expand Down
5 changes: 0 additions & 5 deletions tools/lint/lint.py
Expand Up @@ -5,13 +5,8 @@
import fnmatch

from collections import defaultdict
try:
from xml.etree import cElementTree as ElementTree
except ImportError:
from xml.etree import ElementTree

from .. import localpaths
import html5lib
from manifest.sourcefile import SourceFile

here = os.path.abspath(os.path.split(__file__)[0])
Expand Down
6 changes: 3 additions & 3 deletions tools/manifest/__init__.py
@@ -1,5 +1,5 @@
import manifest
import update
import tree
import item
import manifest
import sourcefile
import tree
import update
2 changes: 2 additions & 0 deletions tools/manifest/item.py
Expand Up @@ -3,6 +3,8 @@

from utils import url_to_rel_path

item_types = ["testharness", "reftest", "manual", "stub", "wdspec"]

class ManifestItem(object):
__metaclass__ = ABCMeta

Expand Down
4 changes: 2 additions & 2 deletions tools/manifest/manifest.py
Expand Up @@ -2,14 +2,14 @@
import os
from collections import defaultdict

from item import ManualTest, WebdriverSpecTest, Stub, RefTest, TestharnessTest
from item import item_types, ManualTest, WebdriverSpecTest, Stub, RefTest, TestharnessTest
from log import get_logger
from sourcefile import SourceFile


class ManifestError(Exception):
pass

item_types = ["testharness", "reftest", "manual", "stub", "wdspec"]

class Manifest(object):
def __init__(self, git_rev=None, url_base="/"):
Expand Down
39 changes: 19 additions & 20 deletions tools/manifest/sourcefile.py
Expand Up @@ -89,29 +89,31 @@ def markup_type(self):
ext = ext[1:]
if ext in ["html", "htm"]:
return "html"
elif ext in ["xhtml", "xht"]:
if ext in ["xhtml", "xht"]:
return "xhtml"
elif ext == "svg":
if ext == "svg":
return "svg"
return None

@cached_property
def root(self):
if self.markup_type:
parser = self.parsers[self.markup_type]
if not self.markup_type:
return None

parser = self.parsers[self.markup_type]

with self.open() as f:
try:
tree = parser(f)
except Exception:
return None
with self.open() as f:
try:
tree = parser(f)
except Exception:
return None

if hasattr(tree, "getroot"):
root = tree.getroot()
else:
root = tree
if hasattr(tree, "getroot"):
root = tree.getroot()
else:
root = tree

return root
return root

@cached_property
def timeout_nodes(self):
Expand Down Expand Up @@ -139,15 +141,15 @@ def content_is_testharness(self):

@cached_property
def reftest_nodes(self):
if not self.root:
return []

match_links = self.root.findall(".//{http://www.w3.org/1999/xhtml}link[@rel='match']")
mismatch_links = self.root.findall(".//{http://www.w3.org/1999/xhtml}link[@rel='mismatch']")
return match_links + mismatch_links

@cached_property
def references(self):
if not self.root:
return []

rv = []
rel_map = {"match": "==", "mismatch": "!="}
for item in self.reftest_nodes:
Expand All @@ -159,9 +161,6 @@ def references(self):

@cached_property
def content_is_ref_node(self):
if not self.root:
return False

return bool(self.references)

def manifest_items(self):
Expand Down
1 change: 0 additions & 1 deletion tools/serve/serve.py
@@ -1,6 +1,5 @@
# -*- coding: utf-8 -*-
import argparse
import imp
import json
import os
import signal
Expand Down

0 comments on commit e3d3a15

Please sign in to comment.