Added metadata and basic script support
This commit is contained in:
Родитель
7c1a78f785
Коммит
0fe0a596ae
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -225,7 +225,8 @@ class ErrorBundle(object):
|
|||
"errors": len(self.errors),
|
||||
"warnings": len(self.warnings),
|
||||
"infos": len(self.infos),
|
||||
"message_tree": self.message_tree}
|
||||
"message_tree": self.message_tree,
|
||||
"metadata": self.metadata}
|
||||
|
||||
messages = output["messages"]
|
||||
|
||||
|
|
|
@ -146,6 +146,8 @@ def _test_id(err, value):
|
|||
|
||||
id_pattern = re.compile("(\{[0-9a-f]{8}-([0-9a-f]{4}-){3}[0-9a-f]{12}\}|[a-z0-9-\.\+_]*\@[a-z0-9-\._]+)", re.I)
|
||||
|
||||
err.metadata["id"] = value
|
||||
|
||||
# Must be a valid UUID string.
|
||||
if not id_pattern.match(value):
|
||||
err.error(("testcases_installrdf",
|
||||
|
@ -163,6 +165,8 @@ def _test_version(err, value):
|
|||
whitespace_pattern = re.compile("\s")
|
||||
version_pattern = re.compile("\d+(\+|\w+)?(\.\d+(\+|\w+)?)*")
|
||||
|
||||
err.metadata["version"] = value
|
||||
|
||||
# Cannot have whitespace in the pattern.
|
||||
if whitespace_pattern.search(value):
|
||||
err.error(("testcases_installrdf",
|
||||
|
@ -189,6 +193,8 @@ def _test_name(err, value):
|
|||
|
||||
ff_pattern = re.compile("(mozilla|firefox)", re.I)
|
||||
|
||||
err.metadata["name"] = value
|
||||
|
||||
if ff_pattern.match(value):
|
||||
err.error(("testcases_installrdf",
|
||||
"_test_name",
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
import subprocess
|
||||
from subprocess import Popen
|
||||
import json
|
||||
|
||||
from validator.constants import *
|
||||
|
||||
|
@ -7,27 +6,13 @@ def test_js_file(err, name, data):
|
|||
"Tests a JS file by parsing and analyzing its tokens"
|
||||
|
||||
print data
|
||||
print _get_tree(data)
|
||||
#print _get_tree(name, data)
|
||||
|
||||
|
||||
|
||||
def _get_tree(code):
|
||||
pipe = Popen(["/usr/bin/ssh",
|
||||
"mbasta@khan.mozilla.org"],
|
||||
stdin=subprocess.PIPE,
|
||||
stdout=subprocess.PIPE)
|
||||
def _get_tree(name, code):
|
||||
|
||||
pipe_out = pipe.stdin
|
||||
pipe_in = pipe.stdout
|
||||
|
||||
print pipe.communicate(
|
||||
"cd ../clouserw/temp/spidermonkey/js/src/Linux_DBG.OBJ/\n")
|
||||
|
||||
print pipe.communicate("./js\n")
|
||||
|
||||
js = code.replace("\n", "\\n")
|
||||
js = js.replace("\r", "\\r")
|
||||
js = js.replace('"', '\\"')
|
||||
|
||||
print pipe.communicate('Reflect.parse("%s");' % js)
|
||||
|
||||
pipe.terminate()
|
||||
f = open("testfiles/js_ast/%s" % name)
|
||||
data = f.read()
|
||||
f.close()
|
||||
tree = json.loads(data)
|
||||
return tree
|
||||
|
|
Загрузка…
Ссылка в новой задаче