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

Side by Side Diff: test/preparser/testcfg.py

Issue 7782023: Reintroduce duplicate identifier detection in preparser. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Removed dependency on platform.h in conversions-inl.h Created 9 years, 3 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 # Copyright 2011 the V8 project authors. All rights reserved. 1 # Copyright 2011 the V8 project authors. All rights reserved.
2 # Redistribution and use in source and binary forms, with or without 2 # Redistribution and use in source and binary forms, with or without
3 # modification, are permitted provided that the following conditions are 3 # modification, are permitted provided that the following conditions are
4 # met: 4 # met:
5 # 5 #
6 # * Redistributions of source code must retain the above copyright 6 # * Redistributions of source code must retain the above copyright
7 # notice, this list of conditions and the following disclaimer. 7 # notice, this list of conditions and the following disclaimer.
8 # * Redistributions in binary form must reproduce the above 8 # * Redistributions in binary form must reproduce the above
9 # copyright notice, this list of conditions and the following 9 # copyright notice, this list of conditions and the following
10 # disclaimer in the documentation and/or other materials provided 10 # disclaimer in the documentation and/or other materials provided
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 if (rule_match.group(2)): 91 if (rule_match.group(2)):
92 expects = expects + [rule_match.group(2)] 92 expects = expects + [rule_match.group(2)]
93 if (rule_match.group(3)): 93 if (rule_match.group(3)):
94 expects = expects + [rule_match.group(3), rule_match.group(4)] 94 expects = expects + [rule_match.group(3), rule_match.group(4)]
95 map[rule_match.group(1)] = expects 95 map[rule_match.group(1)] = expects
96 return map; 96 return map;
97 97
98 def ParsePythonTestTemplates(self, result, filename, 98 def ParsePythonTestTemplates(self, result, filename,
99 executable, current_path, mode): 99 executable, current_path, mode):
100 pathname = join(self.root, filename + ".pyt") 100 pathname = join(self.root, filename + ".pyt")
101 source = open(pathname).read();
102 def Test(name, source, expectation): 101 def Test(name, source, expectation):
103 throws = None 102 throws = None
104 if (expectation is not None): 103 if (expectation is not None):
105 throws = [expectation] 104 throws = [expectation]
106 test = PreparserTestCase(self.root, 105 test = PreparserTestCase(self.root,
107 current_path + [filename, name], 106 current_path + [filename, name],
108 executable, 107 executable,
109 mode, throws, self.context, 108 mode, throws, self.context,
110 source.replace("\n", " ")) 109 source.replace("\n", " "))
111 result.append(test) 110 result.append(test)
112 def Template(name, source): 111 def Template(name, source):
113 def MkTest(replacement, expectation): 112 def MkTest(replacement, expectation):
114 testname = name 113 testname = name
115 testsource = source 114 testsource = source
116 for key in replacement.keys(): 115 for key in replacement.keys():
117 testname = testname.replace("$"+key, replacement[key]); 116 testname = testname.replace("$"+key, replacement[key]);
118 testsource = testsource.replace("$"+key, replacement[key]); 117 testsource = testsource.replace("$"+key, replacement[key]);
119 Test(testname, testsource, expectation) 118 Test(testname, testsource, expectation)
120 return MkTest 119 return MkTest
121 eval(compile(source, pathname, "exec"), 120 execfile(pathname, {"Test": Test, "Template": Template})
122 {"Test": Test, "Template": Template}, {})
123 121
124 def ListTests(self, current_path, path, mode, variant_flags): 122 def ListTests(self, current_path, path, mode, variant_flags):
125 executable = 'preparser' 123 executable = 'preparser'
126 if utils.IsWindows(): 124 if utils.IsWindows():
127 executable += '.exe' 125 executable += '.exe'
128 executable = join(self.context.buildspace, executable) 126 executable = join(self.context.buildspace, executable)
129 if not isfile(executable): 127 if not isfile(executable):
130 executable = join('obj', 'preparser', mode, 'preparser') 128 executable = join('obj', 'preparser', mode, 'preparser')
131 if utils.IsWindows(): 129 if utils.IsWindows():
132 executable += '.exe' 130 executable += '.exe'
133 executable = join(self.context.buildspace, executable) 131 executable = join(self.context.buildspace, executable)
134 expectations = self.GetExpectations() 132 expectations = self.GetExpectations()
135 result = [] 133 result = []
136 # Find all .js files in tests/preparser directory. 134 # Find all .js files in tests/preparser directory.
137 filenames = [f[:-3] for f in os.listdir(self.root) if f.endswith(".js")] 135 filenames = [f[:-3] for f in os.listdir(self.root) if f.endswith(".js")]
138 filenames.sort() 136 filenames.sort()
139 for file in filenames: 137 for file in filenames:
140 throws = None; 138 throws = None;
141 if (file in expectations): 139 if (file in expectations):
142 throws = expectations[file] 140 throws = expectations[file]
143 result.append(PreparserTestCase(self.root, 141 result.append(PreparserTestCase(self.root,
144 current_path + [file], executable, 142 current_path + [file], executable,
145 mode, throws, self.context, None)) 143 mode, throws, self.context, None))
146 # Find all .pyt files in test/preparser directory. 144 # Find all .pyt files in test/preparser directory.
147 filenames = [f[:-4] for f in os.listdir(self.root) if f.endswith(".pyt")] 145 filenames = [f[:-4] for f in os.listdir(self.root) if f.endswith(".pyt")]
148 filenames.sort() 146 filenames.sort()
149 for file in filenames: 147 for file in filenames:
150 # Each file as a python source file to be executed in a specially 148 # Each file as a python source file to be executed in a specially
151 # perparsed environment (defining the Template and Test functions) 149 # created environment (defining the Template and Test functions)
152 self.ParsePythonTestTemplates(result, file, 150 self.ParsePythonTestTemplates(result, file,
153 executable, current_path, mode) 151 executable, current_path, mode)
154 return result 152 return result
155 153
156 def GetTestStatus(self, sections, defs): 154 def GetTestStatus(self, sections, defs):
157 status_file = join(self.root, 'preparser.status') 155 status_file = join(self.root, 'preparser.status')
158 if exists(status_file): 156 if exists(status_file):
159 test.ReadConfigurationInto(status_file, sections, defs) 157 test.ReadConfigurationInto(status_file, sections, defs)
160 158
161 def VariantFlags(self): 159 def VariantFlags(self):
162 return [[]]; 160 return [[]];
163 161
164 162
165 def GetConfiguration(context, root): 163 def GetConfiguration(context, root):
166 return PreparserTestConfiguration(context, root) 164 return PreparserTestConfiguration(context, root)
OLDNEW
« src/globals.h ('K') | « test/preparser/duplicate-property.pyt ('k') | tools/gyp/v8.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698