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

Side by Side Diff: tests/stub-generator/testcfg.py

Issue 8437103: In stub-generator tests, look for dartc with the arch the test is configured for (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 9 years, 1 month 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 | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file 1 # Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file
2 # for details. All rights reserved. Use of this source code is governed by a 2 # for details. All rights reserved. Use of this source code is governed by a
3 # BSD-style license that can be found in the LICENSE file. 3 # BSD-style license that can be found in the LICENSE file.
4 4
5 import os 5 import os
6 import re 6 import re
7 import shutil 7 import shutil
8 import sys 8 import sys
9 import tempfile 9 import tempfile
10 10
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 (interface, classes, _) = self.GetStubs() 48 (interface, classes, _) = self.GetStubs()
49 if interface is None: 49 if interface is None:
50 return 50 return
51 d = join(self.GetPath(), 'generated') 51 d = join(self.GetPath(), 'generated')
52 if not isdir(d): 52 if not isdir(d):
53 os.mkdir(d) 53 os.mkdir(d)
54 tmpdir = tempfile.mkdtemp() 54 tmpdir = tempfile.mkdtemp()
55 src = join(self.GetPath(), interface) 55 src = join(self.GetPath(), interface)
56 dest = join(self.GetPath(), GeneratedName(interface)) 56 dest = join(self.GetPath(), GeneratedName(interface))
57 (_, tmp) = tempfile.mkstemp() 57 (_, tmp) = tempfile.mkstemp()
58 command = self.context.GetDartC(self.mode, 'dartc') 58 command = self.context.GetDartC(self.mode, self.arch)
59 self.RunCommand(command + [ src, 59 self.RunCommand(command + [ src,
60 # dartc generates output even if it has no 60 # dartc generates output even if it has no
61 # output to generate. 61 # output to generate.
62 '-out', tmpdir, 62 '-out', tmpdir,
63 '-isolate-stub-out', tmp, 63 '-isolate-stub-out', tmp,
64 '-generate-isolate-stubs', classes ]) 64 '-generate-isolate-stubs', classes ])
65 shutil.rmtree(tmpdir) 65 shutil.rmtree(tmpdir)
66 66
67 # Copy comments and # commands from the beginning of the source to 67 # Copy comments and # commands from the beginning of the source to
68 # the beginning of the generated file, then copy the remaining 68 # the beginning of the generated file, then copy the remaining
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 if dart_options: command += dart_options 101 if dart_options: command += dart_options
102 else: command += files 102 else: command += files
103 return command 103 return command
104 104
105 105
106 class DartStubTestConfiguration(test_configuration.StandardTestConfiguration): 106 class DartStubTestConfiguration(test_configuration.StandardTestConfiguration):
107 def __init__(self, context, root): 107 def __init__(self, context, root):
108 super(DartStubTestConfiguration, self).__init__(context, root) 108 super(DartStubTestConfiguration, self).__init__(context, root)
109 109
110 def ListTests(self, current_path, path, mode, arch, component): 110 def ListTests(self, current_path, path, mode, arch, component):
111 dartc = self.context.GetDartC(mode, 'dartc') 111 dartc = self.context.GetDartC(mode, arch)
112 self.context.generate = os.access(dartc[0], os.X_OK) 112 self.context.generate = os.access(dartc[0], os.X_OK)
113 tests = [] 113 tests = []
114 for root, dirs, files in os.walk(join(self.root, 'src')): 114 for root, dirs, files in os.walk(join(self.root, 'src')):
115 # Skip remnants from the subdirectory that used to be used for 115 # Skip remnants from the subdirectory that used to be used for
116 # generated code. 116 # generated code.
117 if root.endswith('generated'): 117 if root.endswith('generated'):
118 continue 118 continue
119 for f in [x for x in files if self.IsTest(x)]: 119 for f in [x for x in files if self.IsTest(x)]:
120 # If we can generate code, do not use the checked-in generated 120 # If we can generate code, do not use the checked-in generated
121 # code. Conversely, if we cannot, then only use the 121 # code. Conversely, if we cannot, then only use the
122 # checked-in generated code. 122 # checked-in generated code.
123 if self.context.generate == f.endswith('-generatedTest.dart'): 123 if self.context.generate == f.endswith('-generatedTest.dart'):
124 continue 124 continue
125 test_path = current_path + [ f[:-5] ] # Remove .dart suffix. 125 test_path = current_path + [ f[:-5] ] # Remove .dart suffix.
126 if not self.Contains(path, test_path): 126 if not self.Contains(path, test_path):
127 continue 127 continue
128 tests.append(DartStubTestCase(self.context, 128 tests.append(DartStubTestCase(self.context,
129 test_path, 129 test_path,
130 join(root, f), 130 join(root, f),
131 mode, 131 mode,
132 arch, 132 arch,
133 component)) 133 component))
134 return tests 134 return tests
135 135
136 136
137 def GetConfiguration(context, root): 137 def GetConfiguration(context, root):
138 return DartStubTestConfiguration(context, root) 138 return DartStubTestConfiguration(context, root)
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698