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

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

Issue 6685088: Merge isolates to bleeding_edge. (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 9 years, 9 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
« no previous file with comments | « test/mjsunit/regress/regress-334.js ('k') | tools/gyp/v8.gyp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright 2008 the V8 project authors. All rights reserved. 1 # Copyright 2008 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 20 matching lines...) Expand all
31 import re 31 import re
32 import tempfile 32 import tempfile
33 33
34 FLAGS_PATTERN = re.compile(r"//\s+Flags:(.*)") 34 FLAGS_PATTERN = re.compile(r"//\s+Flags:(.*)")
35 FILES_PATTERN = re.compile(r"//\s+Files:(.*)") 35 FILES_PATTERN = re.compile(r"//\s+Files:(.*)")
36 SELF_SCRIPT_PATTERN = re.compile(r"//\s+Env: TEST_FILE_NAME") 36 SELF_SCRIPT_PATTERN = re.compile(r"//\s+Env: TEST_FILE_NAME")
37 37
38 38
39 class MjsunitTestCase(test.TestCase): 39 class MjsunitTestCase(test.TestCase):
40 40
41 def __init__(self, path, file, mode, context, config): 41 def __init__(self, path, file, mode, context, config, isolates):
42 super(MjsunitTestCase, self).__init__(context, path, mode) 42 super(MjsunitTestCase, self).__init__(context, path, mode)
43 self.file = file 43 self.file = file
44 self.config = config 44 self.config = config
45 self.self_script = False 45 self.self_script = False
46 self.isolates = isolates
46 47
47 def GetLabel(self): 48 def GetLabel(self):
48 return "%s %s" % (self.mode, self.GetName()) 49 return "%s %s" % (self.mode, self.GetName())
49 50
50 def GetName(self): 51 def GetName(self):
51 return self.path[-1] 52 return self.path[-1] + ["", "-isolates"][self.isolates]
52 53
53 def GetCommand(self): 54 def TestsIsolates(self):
55 return self.isolates
56
57 def GetVmCommand(self, source):
54 result = self.config.context.GetVmCommand(self, self.mode) 58 result = self.config.context.GetVmCommand(self, self.mode)
55 source = open(self.file).read()
56 flags_match = FLAGS_PATTERN.search(source) 59 flags_match = FLAGS_PATTERN.search(source)
57 if flags_match: 60 if flags_match:
58 result += flags_match.group(1).strip().split() 61 result += flags_match.group(1).strip().split()
62 return result
63
64 def GetVmArguments(self, source):
65 result = []
59 additional_files = [] 66 additional_files = []
60 files_match = FILES_PATTERN.search(source); 67 files_match = FILES_PATTERN.search(source);
61 # Accept several lines of 'Files:' 68 # Accept several lines of 'Files:'
62 while True: 69 while True:
63 if files_match: 70 if files_match:
64 additional_files += files_match.group(1).strip().split() 71 additional_files += files_match.group(1).strip().split()
65 files_match = FILES_PATTERN.search(source, files_match.end()) 72 files_match = FILES_PATTERN.search(source, files_match.end())
66 else: 73 else:
67 break 74 break
68 for a_file in additional_files: 75 for a_file in additional_files:
69 result.append(join(dirname(self.config.root), '..', a_file)) 76 result.append(join(dirname(self.config.root), '..', a_file))
70 framework = join(dirname(self.config.root), 'mjsunit', 'mjsunit.js') 77 framework = join(dirname(self.config.root), 'mjsunit', 'mjsunit.js')
71 if SELF_SCRIPT_PATTERN.search(source): 78 if SELF_SCRIPT_PATTERN.search(source):
72 result.append(self.CreateSelfScript()) 79 result.append(self.CreateSelfScript())
73 result += [framework, self.file] 80 result += [framework, self.file]
74 return result 81 return result
75 82
83 def GetCommand(self):
84 source = open(self.file).read()
85 result = self.GetVmCommand(source)
86 result += self.GetVmArguments(source)
87 if self.isolates:
88 result.append("--isolate")
89 result += self.GetVmArguments(source)
90 return result
91
76 def GetSource(self): 92 def GetSource(self):
77 return open(self.file).read() 93 return open(self.file).read()
78 94
79 def CreateSelfScript(self): 95 def CreateSelfScript(self):
80 (fd_self_script, self_script) = tempfile.mkstemp(suffix=".js") 96 (fd_self_script, self_script) = tempfile.mkstemp(suffix=".js")
81 def MakeJsConst(name, value): 97 def MakeJsConst(name, value):
82 return "var %(name)s=\'%(value)s\';\n" % \ 98 return "var %(name)s=\'%(value)s\';\n" % \
83 {'name': name, \ 99 {'name': name, \
84 'value': value.replace('\\', '\\\\').replace('\'', '\\\'') } 100 'value': value.replace('\\', '\\\\').replace('\'', '\\\'') }
85 try: 101 try:
(...skipping 29 matching lines...) Expand all
115 regress.sort() 131 regress.sort()
116 bugs.sort() 132 bugs.sort()
117 third_party.sort() 133 third_party.sort()
118 tools.sort() 134 tools.sort()
119 compiler.sort() 135 compiler.sort()
120 all_tests = mjsunit + regress + bugs + third_party + tools + compiler 136 all_tests = mjsunit + regress + bugs + third_party + tools + compiler
121 result = [] 137 result = []
122 for test in all_tests: 138 for test in all_tests:
123 if self.Contains(path, test): 139 if self.Contains(path, test):
124 file_path = join(self.root, reduce(join, test[1:], "") + ".js") 140 file_path = join(self.root, reduce(join, test[1:], "") + ".js")
125 result.append(MjsunitTestCase(test, file_path, mode, self.context, self) ) 141 result.append(MjsunitTestCase(test, file_path, mode, self.context, self, False))
142 result.append(MjsunitTestCase(test, file_path, mode, self.context, self, True))
126 return result 143 return result
127 144
128 def GetBuildRequirements(self): 145 def GetBuildRequirements(self):
129 return ['sample', 'sample=shell'] 146 return ['sample', 'sample=shell']
130 147
131 def GetTestStatus(self, sections, defs): 148 def GetTestStatus(self, sections, defs):
132 status_file = join(self.root, 'mjsunit.status') 149 status_file = join(self.root, 'mjsunit.status')
133 if exists(status_file): 150 if exists(status_file):
134 test.ReadConfigurationInto(status_file, sections, defs) 151 test.ReadConfigurationInto(status_file, sections, defs)
135 152
136 153
137 154
138 def GetConfiguration(context, root): 155 def GetConfiguration(context, root):
139 return MjsunitTestConfiguration(context, root) 156 return MjsunitTestConfiguration(context, root)
OLDNEW
« no previous file with comments | « test/mjsunit/regress/regress-334.js ('k') | tools/gyp/v8.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698