summaryrefslogtreecommitdiff
path: root/tools/packaging
diff options
context:
space:
mode:
authorDomenic Denicola <d@domenic.me>2014-12-01 15:46:34 -0500
committerDomenic Denicola <d@domenic.me>2014-12-01 15:52:19 -0500
commitdd243a757c695c3000f27e2c71ed41964cb33119 (patch)
treefd1f1bc6596d7dd58288a60ff663c448613e48f3 /tools/packaging
parentbbeafbd3c6082e4d30e76b5867f12b5458c4e9e8 (diff)
downloadqtdeclarative-testsuites-dd243a757c695c3000f27e2c71ed41964cb33119.tar.gz
Remove trailing whitespace from the Python
Diffstat (limited to 'tools/packaging')
-rw-r--r--tools/packaging/common.py8
-rw-r--r--tools/packaging/monkeyYaml.py6
-rw-r--r--tools/packaging/packager.py40
-rw-r--r--tools/packaging/packagerConfig.py26
-rw-r--r--tools/packaging/parseTestRecord.py4
-rw-r--r--tools/packaging/test/test_common.py2
-rw-r--r--tools/packaging/test/test_parseTestRecord.py10
-rw-r--r--tools/packaging/test/test_test262.py2
-rwxr-xr-xtools/packaging/test262.py44
9 files changed, 71 insertions, 71 deletions
diff --git a/tools/packaging/common.py b/tools/packaging/common.py
index 90b483542..21859f5a6 100644
--- a/tools/packaging/common.py
+++ b/tools/packaging/common.py
@@ -1,7 +1,7 @@
-# Copyright (c) 2012 Ecma International. All rights reserved.
+# Copyright (c) 2012 Ecma International. All rights reserved.
# Ecma International makes this code available under the terms and conditions set
-# forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the
-# "Use Terms"). Any redistribution of this code must retain the above
+# forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the
+# "Use Terms"). Any redistribution of this code must retain the above
# copyright and this notice and otherwise comply with the Use Terms.
#--Imports---------------------------------------------------------------------
@@ -17,5 +17,5 @@ def convertDocString(docString):
envelope = parseTestRecord.parseTestRecord(docString, '')
envelope.pop('header', None)
envelope.pop('test', None)
-
+
return envelope
diff --git a/tools/packaging/monkeyYaml.py b/tools/packaging/monkeyYaml.py
index 2adbea7f6..d86c03ab9 100644
--- a/tools/packaging/monkeyYaml.py
+++ b/tools/packaging/monkeyYaml.py
@@ -21,7 +21,7 @@ def load(str):
line = lines.pop(0)
if myIsAllSpaces(line):
continue
- result = mYamlKV.match(line)
+ result = mYamlKV.match(line)
if result:
if not dict:
dict = {}
@@ -62,7 +62,7 @@ def myMultilineList(lines, value):
indent = indent or leading
value += [myReadOneLine(myRemoveListHeader(indent, line))]
return (lines, value)
-
+
def myRemoveListHeader(indent, line):
line = line[indent:]
return mYamlMultilineList.match(line).group(1)
@@ -81,7 +81,7 @@ def myReadOneLine(value):
except ValueError:
pass
return value
-
+
def myFlowList(value):
result = mYamlListPattern.match(value)
values = result.group(1).split(",")
diff --git a/tools/packaging/packager.py b/tools/packaging/packager.py
index 163173210..4433850f3 100644
--- a/tools/packaging/packager.py
+++ b/tools/packaging/packager.py
@@ -1,7 +1,7 @@
-# Copyright (c) 2012 Ecma International. All rights reserved.
+# Copyright (c) 2012 Ecma International. All rights reserved.
# Ecma International makes this code available under the terms and conditions set
-# forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the
-# "Use Terms"). Any redistribution of this code must retain the above
+# forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the
+# "Use Terms"). Any redistribution of this code must retain the above
# copyright and this notice and otherwise comply with the Use Terms.
#--Imports---------------------------------------------------------------------
@@ -87,14 +87,14 @@ def createDepDirs(dirName):
os.mkdir(dirName)
def test262PathToConsoleFile(path):
- stuff = os.path.join(TEST262_CONSOLE_CASES_DIR,
+ stuff = os.path.join(TEST262_CONSOLE_CASES_DIR,
path.replace("/", os.path.sep))
createDepDirs(os.path.dirname(stuff))
return stuff
-
+
def getJSCount(dirName):
'''
- Returns the total number of *.js files (recursively) under a given
+ Returns the total number of *.js files (recursively) under a given
directory, dirName.
'''
retVal = 0
@@ -143,7 +143,7 @@ def dirWalker(dirName):
def isTestStarted(line):
'''
Used to detect if we've gone past extraneous test comments in a test case.
-
+
Note this is a naive approach on the sense that "/*abc*/" could be on one
line. However, we know for a fact this is not the case in IE Test Center
or Sputnik tests.
@@ -170,7 +170,7 @@ for temp in os.listdir(TEST262_CASES_DIR):
if not os.path.exists(temp):
print "The expected ES5 test directory,", temp, "did not exist!"
sys.exit(1)
-
+
if temp.find("/.") != -1:
# skip hidden files on Unix, such as ".DS_Store" on Mac
continue
@@ -187,11 +187,11 @@ for chapter in TEST_SUITE_SECTIONS:
testsList = {}
sect = {}
sect["name"] = "Chapter - " + chapterName
-
+
#create an array for tests in a chapter
tests = []
sourceFiles = getAllJSFiles(chapter)
-
+
if len(sourceFiles)!=0:
excluded = 0
testCount = 0
@@ -199,13 +199,13 @@ for chapter in TEST_SUITE_SECTIONS:
#TODO - use something other than the hard-coded 'TestCases' below
testPath = "TestCases" + \
test.split(TEST262_CASES_DIR, 1)[1].replace("\\", "/")
- testName=test.rsplit(".", 1)[0]
+ testName=test.rsplit(".", 1)[0]
testName=testName.rsplit(os.path.sep, 1)[1]
if EXCLUDE_LIST.count(testName)==0:
# dictionary for each test
testDict = {}
testDict["path"] = testPath
-
+
tempFile = open(test, "rb")
scriptCode = tempFile.readlines()
tempFile.close()
@@ -232,7 +232,7 @@ for chapter in TEST_SUITE_SECTIONS:
scriptCodeContentB64 = base64.b64encode(scriptCodeContent)
#add the test encoded code node to our test dictionary
- testDict["code"] = scriptCodeContentB64
+ testDict["code"] = scriptCodeContentB64
#now close the dictionary for the test
#now get the metadata added.
@@ -245,7 +245,7 @@ for chapter in TEST_SUITE_SECTIONS:
#this adds the test to our tests array
tests.append(testDict)
-
+
if ARGS.console:
with open(test262PathToConsoleFile(testDict["path"]),
"w") as fConsole:
@@ -268,7 +268,7 @@ for chapter in TEST_SUITE_SECTIONS:
#create a node for the tests and add it to our testsLists
testsList["testsCollection"] = sect
- with open(os.path.join(TEST262_WEB_CASES_DIR, chapterName + ".json"),
+ with open(os.path.join(TEST262_WEB_CASES_DIR, chapterName + ".json"),
"w") as f:
json.dump(testsList, f, separators=(',',':'), sort_keys=True,
indent=0)
@@ -279,12 +279,12 @@ for chapter in TEST_SUITE_SECTIONS:
CHAPTER_TEST_CASES_JSON["numTests"] = int(sect["numTests"])
CHAPTER_TEST_CASES_JSON["testSuite"] = \
[WEBSITE_CASES_PATH + chapterName + ".json"]
- with open(os.path.join(TEST262_WEB_CASES_DIR,
- "testcases_%s.json" % chapterName),
+ with open(os.path.join(TEST262_WEB_CASES_DIR,
+ "testcases_%s.json" % chapterName),
"w") as f:
json.dump(CHAPTER_TEST_CASES_JSON, f, separators=(',',':'),
sort_keys=True, indent=0)
- generateHarness(ARGS.type, "testcases_%s.json" % chapterName,
+ generateHarness(ARGS.type, "testcases_%s.json" % chapterName,
chapterName.replace("ch", "Chapter "))
#add the name of the chapter test to our complete list
@@ -321,9 +321,9 @@ if TEST262_HARNESS_DIR!=TEST262_WEB_HARNESS_DIR:
if x.endswith(".js")]:
toFilenameList = [ os.path.join(TEST262_WEB_HARNESS_DIR, filename)]
if ARGS.console:
- toFilenameList.append(os.path.join(TEST262_CONSOLE_HARNESS_DIR,
+ toFilenameList.append(os.path.join(TEST262_CONSOLE_HARNESS_DIR,
filename))
-
+
for toFilename in toFilenameList:
if not os.path.exists(os.path.dirname(toFilename)):
os.mkdir(os.path.dirname(toFilename))
diff --git a/tools/packaging/packagerConfig.py b/tools/packaging/packagerConfig.py
index 16fe7dbc6..adbd25320 100644
--- a/tools/packaging/packagerConfig.py
+++ b/tools/packaging/packagerConfig.py
@@ -1,7 +1,7 @@
-# Copyright (c) 2012 Ecma International. All rights reserved.
+# Copyright (c) 2012 Ecma International. All rights reserved.
# Ecma International makes this code available under the terms and conditions set
-# forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the
-# "Use Terms"). Any redistribution of this code must retain the above
+# forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the
+# "Use Terms"). Any redistribution of this code must retain the above
# copyright and this notice and otherwise comply with the Use Terms.
#--Imports---------------------------------------------------------------------
@@ -22,7 +22,7 @@ ONE_JSON_PER_CHAPTER = False
TESTCASELIST_PER_JSON = True
#Path to the root of the Hg repository (relative to this file's location)
-TEST262_ROOT = os.path.join(os.path.dirname(os.path.realpath(__file__)),
+TEST262_ROOT = os.path.join(os.path.dirname(os.path.realpath(__file__)),
"..", "..")
TEST262_ROOT = os.path.abspath(TEST262_ROOT)
@@ -40,9 +40,9 @@ TEST262_CONSOLE_CASES_DIR = os.path.join(TEST262_ROOT, CONSOLE_SHORT_NAME)
#Directory containing the website's test harness (ported over from
#TEST262_HARNESS_DIR)
-TEST262_WEB_HARNESS_DIR = os.path.join(TEST262_ROOT, WEBSITE_SHORT_NAME,
+TEST262_WEB_HARNESS_DIR = os.path.join(TEST262_ROOT, WEBSITE_SHORT_NAME,
"harness")
-TEST262_CONSOLE_HARNESS_DIR = os.path.join(TEST262_ROOT, CONSOLE_SHORT_NAME,
+TEST262_CONSOLE_HARNESS_DIR = os.path.join(TEST262_ROOT, CONSOLE_SHORT_NAME,
"harness")
#Path to the ported test case files on the actual website as opposed
@@ -66,20 +66,20 @@ __lastHarnessType = None
def generateHarness(harnessType, jsonName, title):
global TEMPLATE_LINES
global __lastHarnessType
-
+
#TODO: temp hack to make experimental internationalization tests work
if jsonName=="testcases_intl402.json":
harnessType = "intl402"
elif jsonName=="testcases_bestPractice.json":
harnessType = "bestPractice"
-
+
if TEMPLATE_LINES==None or harnessType!=__lastHarnessType:
__lastHarnessType = harnessType
TEMPLATE_LINES = []
with open(os.path.join(os.getcwd(), "templates",
"runner." + harnessType + ".html"), "r") as f:
TEMPLATE_LINES = f.readlines()
- fileName = os.path.join(TEST262_ROOT, WEBSITE_SHORT_NAME,
+ fileName = os.path.join(TEST262_ROOT, WEBSITE_SHORT_NAME,
jsonName.replace(".json", ".html"))
fileNameExists = False
if os.path.exists(fileName):
@@ -91,7 +91,7 @@ def generateHarness(harnessType, jsonName, title):
f.write(" var TEST_LIST_PATH = \"json/" + jsonName + \
"\";" + os.linesep)
#elif "ECMAScript 5" in line:
- # f.write(line.replace("ECMAScript 5",
+ # f.write(line.replace("ECMAScript 5",
# "ECMAScript 5: %s" % title))
else:
f.write(line)
@@ -101,7 +101,7 @@ def generateHarness(harnessType, jsonName, title):
#------------------------------------------------------------------------------
class SCAbstraction(object):
'''
- A class which abstracts working with source control systems in relation to
+ A class which abstracts working with source control systems in relation to
generated test262 files. Useful when test262 is also used internally by
browser implementors.
'''
@@ -112,11 +112,11 @@ class SCAbstraction(object):
'''
if not(os.stat(filename).st_mode & stat.S_IWRITE):
os.chmod(filename, stat.S_IWRITE)
-
+
def add(self, filename):
'''
Source control add of a file.
'''
subprocess.call(["git", "add", filename])
-
+
SC_HELPER = SCAbstraction()
diff --git a/tools/packaging/parseTestRecord.py b/tools/packaging/parseTestRecord.py
index ce4550a0a..3a76e85ab 100644
--- a/tools/packaging/parseTestRecord.py
+++ b/tools/packaging/parseTestRecord.py
@@ -69,7 +69,7 @@ def oldAttrParser(testRecord, body, name):
raise Exception('Malformed "@" attribute: ' + name)
propName = propMatch.group(0)
propVal = stripStars(propText[len(propName):])
-
+
if propName in testRecord:
raise Exception('duplicate: ' + propName)
testRecord[propName] = propVal;
@@ -89,7 +89,7 @@ def yamlAttrParser(testRecord, attrs, name):
if key == "info":
key = "commentary"
testRecord[key] = value
-
+
if 'flags' in testRecord:
for flag in testRecord['flags']:
testRecord[flag] = ""
diff --git a/tools/packaging/test/test_common.py b/tools/packaging/test/test_common.py
index 3a5f249bf..0d6600b7d 100644
--- a/tools/packaging/test/test_common.py
+++ b/tools/packaging/test/test_common.py
@@ -47,7 +47,7 @@ class TestYAMLParsing(unittest.TestCase):
name = 'fixtures/test262-yaml-headers.js'
contents = slurpFile(name)
record = convertDocString(contents)
-
+
self.assertEqual("The production Block { } in strict code can't contain function declaration;\n", record['commentary'])
self.assertEqual("Trying to declare function at the Block statement",
diff --git a/tools/packaging/test/test_parseTestRecord.py b/tools/packaging/test/test_parseTestRecord.py
index 10da6d519..7d1e9a64d 100644
--- a/tools/packaging/test/test_parseTestRecord.py
+++ b/tools/packaging/test/test_parseTestRecord.py
@@ -29,7 +29,7 @@ class TestOldParsing(unittest.TestCase):
name = 'fixtures/test262-old-headers.js'
contents = slurpFile(name)
record = parseTestRecord(contents, name)
-
+
self.assertEqual("""// Copyright 2009 the Sputnik authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.""",
record['header'])
@@ -69,7 +69,7 @@ declaration;""", record['commentary'])
1;
"""
, "name")
-
+
def test_malformed(self):
with self.assertRaisesRegexp(Exception, 'Malformed "@" attribute: name'):
parseTestRecord("""
@@ -90,7 +90,7 @@ declaration;""", record['commentary'])
self.assertEqual("@foo bar", stripStars("\n* @foo bar"))
self.assertEqual("@foo bar", stripStars("\n *@foo bar"))
-
+
class TestYAMLParsing(unittest.TestCase):
def test_test(self):
self.assertTrue(True)
@@ -112,7 +112,7 @@ flags: [onlyStrict]
def test_yamlParse(self):
text = """
-info: >
+info: >
The production Block { } in strict code can't contain function
declaration;
description: Trying to declare function at the Block statement
@@ -150,7 +150,7 @@ flags: [onlyStrict]"""
name = 'fixtures/test262-yaml-headers.js'
contents = slurpFile(name)
record = parseTestRecord(contents, name)
-
+
self.assertEqual("""// Copyright 2009 the Sputnik authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.""",
record['header'])
diff --git a/tools/packaging/test/test_test262.py b/tools/packaging/test/test_test262.py
index fbd3dd411..8073a3c1f 100644
--- a/tools/packaging/test/test_test262.py
+++ b/tools/packaging/test/test_test262.py
@@ -43,7 +43,7 @@ class MockResult(object):
def __init__(self, case):
self.case = case
-
+
class TestTestSuite(unittest.TestCase):
diff --git a/tools/packaging/test262.py b/tools/packaging/test262.py
index 40c756fc9..cc6a83400 100755
--- a/tools/packaging/test262.py
+++ b/tools/packaging/test262.py
@@ -54,7 +54,7 @@ EXCLUDE_LIST = [x.getAttribute("id") for x in EXCLUDE_LIST]
def BuildOptions():
result = optparse.OptionParser()
result.add_option("--command", default=None, help="The command-line to run")
- result.add_option("--tests", default=path.abspath('.'),
+ result.add_option("--tests", default=path.abspath('.'),
help="Path to the tests")
result.add_option("--cat", default=False, action="store_true",
help="Print packaged test code that would be run")
@@ -62,18 +62,18 @@ def BuildOptions():
help="Print summary after running tests")
result.add_option("--full-summary", default=False, action="store_true",
help="Print summary and test output after running tests")
- result.add_option("--strict_only", default=False, action="store_true",
+ result.add_option("--strict_only", default=False, action="store_true",
help="Test only strict mode")
- result.add_option("--non_strict_only", default=False, action="store_true",
+ result.add_option("--non_strict_only", default=False, action="store_true",
help="Test only non-strict mode")
# TODO: Once enough tests are made strict compat, change the default
# to "both"
- result.add_option("--unmarked_default", default="non_strict",
+ result.add_option("--unmarked_default", default="non_strict",
help="default mode for tests of unspecified strictness")
result.add_option("--logname", help="Filename to save stdout to")
result.add_option("--junitname", help="Filename to save test results in JUnit XML format")
result.add_option("--loglevel", default="warning",
- help="sets log level to debug, info, warning, error, or critical")
+ help="sets log level to debug, info, warning, error, or critical")
result.add_option("--print-handle", default="print", help="Command to print from console")
result.add_option("--list-includes", default=False, action="store_true",
help="List includes required by tests")
@@ -169,13 +169,13 @@ class TestResult(object):
err = self.stderr.strip()
if len(err) > 0:
target.write("--- errors --- \n %s" % err)
-
+
def XmlAssemble(self, result):
test_name = self.case.GetName()
test_mode = self.case.GetMode()
testCaseElement = xmlj.Element("testcase")
testpath = self.TestPathManipulation(test_name)
- testCaseElement.attrib["classname"] = "%s.%s" % (testpath[0] , testpath[1])
+ testCaseElement.attrib["classname"] = "%s.%s" % (testpath[0] , testpath[1])
testCaseElement.attrib["name"] = "%s %s" % (testpath[2].replace('.','_') , test_mode)
if self.HasUnexpectedOutcome():
failureElement = xmlj.Element("failure")
@@ -198,19 +198,19 @@ class TestResult(object):
else:
testpackage = testclass
return(testpackage,testclass,testcase)
-
- def HasFailed(self):
+
+ def HasFailed(self):
return self.exit_code != 0
- def AsyncHasFailed(self):
+ def AsyncHasFailed(self):
return 'Test262:AsyncTestComplete' not in self.stdout
def HasUnexpectedOutcome(self):
- if self.case.IsAsyncTest():
+ if self.case.IsAsyncTest():
return self.AsyncHasFailed() or self.HasFailed()
- elif self.case.IsNegative():
+ elif self.case.IsNegative():
return not (self.HasFailed() and self.case.NegativeMatch(self.GetErrorOutput()))
- else:
+ else:
return self.HasFailed()
def GetErrorOutput(self):
@@ -235,7 +235,7 @@ class TestCase(object):
del testRecord["header"]
testRecord.pop("commentary", None) # do not throw if missing
self.testRecord = testRecord;
-
+
def NegativeMatch(self, stderr):
neg = re.compile(self.GetNegative())
return re.search(neg, stderr)
@@ -264,7 +264,7 @@ class TestCase(object):
def IsNoStrict(self):
return 'noStrict' in self.testRecord
- def IsAsyncTest(self):
+ def IsAsyncTest(self):
return '$DONE' in self.test
def GetIncludeList(self):
@@ -398,7 +398,7 @@ class TestSuite(object):
self.unmarked_default = unmarked_default
self.print_handle = print_handle
self.include_cache = { }
-
+
def Validate(self):
if not path.exists(self.test_root):
@@ -530,7 +530,7 @@ class TestSuite(object):
SkipElement.attrib["message"] = unicode(EXCLUDE_REASON[x].firstChild.nodeValue)
SkipCaseElement.append(SkipElement)
TestSuiteElement.append(SkipCaseElement)
-
+
for case in cases:
result = case.Run(command_template)
if junitfile:
@@ -541,7 +541,7 @@ class TestSuite(object):
if logname:
self.WriteLog(result)
progress.HasRun(result)
-
+
if print_summary:
self.PrintSummary(progress, logname)
if full_summary:
@@ -582,15 +582,15 @@ class TestSuite(object):
includes_dict.update(includes)
print includes_dict
-
+
def Main():
code = 0
parser = BuildOptions()
(options, args) = parser.parse_args()
ValidateOptions(options)
- test_suite = TestSuite(options.tests,
- options.strict_only,
+ test_suite = TestSuite(options.tests,
+ options.strict_only,
options.non_strict_only,
options.unmarked_default,
options.print_handle)
@@ -616,7 +616,7 @@ def Main():
options.logname,
options.junitname)
return code
-
+
if __name__ == '__main__':
try:
code = Main()