Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(257)

Unified Diff: test/preparser/testcfg.py

Issue 11035053: Rollback trunk to bleeding_edge revision 12525 (Closed) Base URL: https://v8.googlecode.com/svn/trunk
Patch Set: Created 8 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « test/mozilla/testcfg.py ('k') | test/sputnik/testcfg.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/preparser/testcfg.py
diff --git a/test/preparser/testcfg.py b/test/preparser/testcfg.py
index 61c14c9bd3ca80f71f4598a4c6b3e6f470fd3da8..88c06a31adcfe6a4737b8e28218c4bf1acda9975 100644
--- a/test/preparser/testcfg.py
+++ b/test/preparser/testcfg.py
@@ -25,109 +25,13 @@
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
+import test
import os
+from os.path import join, dirname, exists, isfile
+import platform
+import utils
import re
-from testrunner.local import testsuite
-from testrunner.local import utils
-from testrunner.objects import testcase
-
-
-class PreparserTestSuite(testsuite.TestSuite):
- def __init__(self, name, root):
- super(PreparserTestSuite, self).__init__(name, root)
-
- def shell(self):
- return "preparser"
-
- def _GetExpectations(self):
- expects_file = join(self.root, "preparser.expectation")
- expectations_map = {}
- if not os.path.exists(expects_file): return expectations_map
- rule_regex = re.compile("^([\w\-]+)(?::([\w\-]+))?(?::(\d+),(\d+))?$")
- for line in utils.ReadLinesFrom(expects_file):
- rule_match = rule_regex.match(line)
- if not rule_match: continue
- expects = []
- if (rule_match.group(2)):
- expects += [rule_match.group(2)]
- if (rule_match.group(3)):
- expects += [rule_match.group(3), rule_match.group(4)]
- expectations_map[rule_match.group(1)] = " ".join(expects)
- return expectations_map
-
- def _ParsePythonTestTemplates(self, result, filename):
- pathname = join(self.root, filename + ".pyt")
- def Test(name, source, expectation):
- source = source.replace("\n", " ")
- testname = os.path.join(filename, name)
- flags = ["-e", source]
- if expectation:
- flags += ["throws", expectation]
- test = testcase.TestCase(self, testname, flags=flags)
- result.append(test)
- def Template(name, source):
- def MkTest(replacement, expectation):
- testname = name
- testsource = source
- for key in replacement.keys():
- testname = testname.replace("$" + key, replacement[key]);
- testsource = testsource.replace("$" + key, replacement[key]);
- Test(testname, testsource, expectation)
- return MkTest
- execfile(pathname, {"Test": Test, "Template": Template})
-
- def ListTests(self, context):
- expectations = self._GetExpectations()
- result = []
-
- # Find all .js files in this directory.
- filenames = [f[:-3] for f in os.listdir(self.root) if f.endswith(".js")]
- filenames.sort()
- for f in filenames:
- throws = expectations.get(f, None)
- flags = [f + ".js"]
- if throws:
- flags += ["throws", throws]
- test = testcase.TestCase(self, f, flags=flags)
- result.append(test)
-
- # Find all .pyt files in this directory.
- filenames = [f[:-4] for f in os.listdir(self.root) if f.endswith(".pyt")]
- filenames.sort()
- for f in filenames:
- self._ParsePythonTestTemplates(result, f)
- return result
-
- def GetFlagsForTestCase(self, testcase, context):
- first = testcase.flags[0]
- if first != "-e":
- testcase.flags[0] = os.path.join(self.root, first)
- return testcase.flags
-
- def GetSourceForTest(self, testcase):
- if testcase.flags[0] == "-e":
- return testcase.flags[1]
- with open(testcase.flags[0]) as f:
- return f.read()
-
- def VariantFlags(self):
- return [[]];
-
-
-def GetSuite(name, root):
- return PreparserTestSuite(name, root)
-
-
-# Deprecated definitions below.
-# TODO(jkummerow): Remove when SCons is no longer supported.
-
-
-from os.path import join, exists, isfile
-import test
-
-
class PreparserTestCase(test.TestCase):
def __init__(self, root, path, executable, mode, throws, context, source):
@@ -146,7 +50,7 @@ class PreparserTestCase(test.TestCase):
def HasSource(self):
return self.source is not None
- def GetSource(self):
+ def GetSource():
return self.source
def BuildCommand(self, path):
« no previous file with comments | « test/mozilla/testcfg.py ('k') | test/sputnik/testcfg.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698