Add a new variable environment for testing, to replace the misusage of 'arch'.

Review URL: http://codereview.chromium.org//8408002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@993 260f80e4-7a28-3924-810f-c04153c831b5
This commit is contained in:
ngeoffray@google.com 2011-11-01 09:12:55 +00:00
parent 161ae6b076
commit 33ec29bf11
22 changed files with 200 additions and 203 deletions

View file

@ -4,31 +4,22 @@
prefix client
[ $arch == dartium ]
[ $component == dartium ]
samples/dartcombat/dartcombat_tests: Skip # Bug 5279716
touch/touch_tests: Skip # Issue 157.
[ $arch == chromium ]
[ $component == chromium ]
layout/layout_tests: Skip # Issue 152.
touch/touch_tests: Skip # Issue 157.
[ $arch == chromium && $mode == release ]
[ $component == chromium && $mode == release ]
html/html_tests: Skip # Timeout
# 'client' tests import the DOM library, so they only make sense in
# a browser environment.
[ $arch == dartc ]
[ $component == dartc ]
*: Skip
[ $arch == ia32 ]
*: Skip
[ $arch == x64 ]
*: Skip
[ $arch == simarm ]
*: Skip
[ $arch == arm ]
[ $component == vm ]
*: Skip

View file

@ -9,17 +9,5 @@ dom/scripts/idlparser_test.dart: Skip # Bogus dartc error; references dart/uti
dom/frog_dom.dart: Skip # Frog-only
testing/unittest/unittest_vm.dart: Skip # Relies on VM libs
[ $arch == ia32 ]
*: Skip
[ $arch == x64 ]
*: Skip
[ $arch == simarm ]
*: Skip
[ $arch == arm ]
[ $component == vm ]
*: Skip

View file

@ -38,14 +38,14 @@ def GetBuildInfo(srcpath):
"""Returns a tuple (name, version, arch, mode, platform) where:
- name: A name for the build - the buildbot host if a buildbot.
- version: A version string corresponding to this build.
- arch: 'dartium' (default) or 'chromium'
- component: 'dartium' (default) or 'chromium'
- mode: 'debug' or 'release' (default)
- platform: 'linux' or 'mac'
"""
name = None
version = None
mode = 'release'
arch = 'dartium'
component = 'dartium'
platform = 'linux'
# Populate via builder environment variables.
@ -56,7 +56,7 @@ def GetBuildInfo(srcpath):
pattern = re.match(BUILDER_PATTERN, name)
if pattern:
platform = pattern.group(1)
arch = pattern.group(2)
component = pattern.group(2)
mode = pattern.group(3)
# Fall back if not on builder.
@ -71,7 +71,7 @@ def GetBuildInfo(srcpath):
version = output[0]
else:
version = 'unknown'
return (name, version, arch, mode, platform)
return (name, version, component, mode, platform)
def RunDartcCompiler(client_path, mode, outdir):
@ -81,7 +81,7 @@ def RunDartcCompiler(client_path, mode, outdir):
return subprocess.call(
[sys.executable, '../tools/build.py', '--mode=' + mode])
def RunBrowserTests(client_path, arch, mode, platform):
def RunBrowserTests(client_path, component, mode, platform):
"""Runs the Dart client tests."""
if platform == 'linux':
cmd = ['xvfb-run']
@ -90,7 +90,7 @@ def RunBrowserTests(client_path, arch, mode, platform):
# Move to the client directory and call the test script
os.chdir(client_path)
cmd += [sys.executable, '../tools/test.py',
'--arch=' + arch, '--mode=' + mode,
'--component=' + component, '--mode=' + mode,
'--time', '--report', '--progress=buildbot', '-v']
return subprocess.call(cmd)
@ -119,18 +119,18 @@ def GetOutDir(utils, mode, name):
'''
return utils.GetBuildRoot(utils.GuessOS(), mode, name)
def ProcessDartClientTests(srcpath, arch, mode, platform, name):
def ProcessDartClientTests(srcpath, component, mode, platform, name):
'''
build and test the dart client applications
args:
srcpath - the location of the source code to build
arch - the architecture we are building for
component - the component we are testing against
mode - the mode release or debug
platform - the platform we are building for
'''
print 'ProcessDartClientTests'
if arch == 'chromium':
if component == 'chromium':
print ('@@@BUILD_STEP dartc dart clients: %s@@@' % name)
utils = GetUtils(srcpath)
@ -139,7 +139,7 @@ def ProcessDartClientTests(srcpath, arch, mode, platform, name):
if status != 0:
return status
if arch == 'dartium':
if component == 'dartium':
version_file = os.path.join(srcpath, DARTIUM_VERSION_FILE)
if os.path.exists(version_file):
latest = open(version_file, 'r').read()
@ -148,7 +148,7 @@ def ProcessDartClientTests(srcpath, arch, mode, platform, name):
print '@@@BUILD_STEP vm r%s (dartium r%s)@@@' % (
match.group(2), match.group(1))
print '@@@BUILD_STEP browser unit tests@@@'
return RunBrowserTests(srcpath, arch, mode, platform)
return RunBrowserTests(srcpath, component, mode, platform)
def ProcessTools(srcpath, mode, name, version):
'''
@ -199,14 +199,14 @@ def main():
scriptdir = os.path.dirname(sys.argv[0])
srcpath = os.path.abspath(os.path.join(scriptdir, '..'))
(name, version, arch, mode, platform) = GetBuildInfo(srcpath)
(name, version, component, mode, platform) = GetBuildInfo(srcpath)
if name == 'dart-editor':
status = ProcessTools(srcpath, mode, name, version)
#TODO(sigmund): remove this indirection once we update out bots
elif name.startswith('frog'):
status = ProcessFrog(srcpath)
else:
status = ProcessDartClientTests(srcpath, arch, mode, platform, name)
status = ProcessDartClientTests(srcpath, component, mode, platform, name)
if status:
print '@@@STEP_FAILURE@@@'

View file

@ -34,7 +34,7 @@ public class SharedTests extends TestSetup {
private static final String[] listTests = {
TEST_PY,
"--arch=dartc",
"--component=dartc",
"--mode=release",
"--list"};

View file

@ -11,25 +11,13 @@ compiler/vm/*: Skip
corelib/SharedTests: Skip
[ $arch == ia32 ]
[ $component == vm ]
*: Skip
[ $arch == x64 ]
[ $component == dartium ]
*: Skip
[ $arch == simarm ]
*: Skip
[ $arch == arm ]
*: Skip
[ $arch == dartium ]
*: Skip
[ $arch == chromium ]
[ $component == chromium ]
*: Skip

View file

@ -66,7 +66,7 @@ class JUnitTestConfiguration(test.TestConfiguration):
def __init__(self, context, root):
super(JUnitTestConfiguration, self).__init__(context, root)
def ListTests(self, current_path, path, mode, arch):
def ListTests(self, current_path, path, mode, arch, component):
test_path = current_path + ['junit_tests']
if not self.Contains(path, test_path):
return []

View file

@ -21,9 +21,7 @@ class VmTestCase(test.TestCase):
return False
def GetLabel(self):
return "%s %s" % (
self.context.GetBuildConf(self.mode, self.arch),
'/'.join(self.path))
return '%s%s vm %s' % (self.mode, self.arch, '/'.join(self.path))
def GetCommand(self):
command = self.context.GetRunTests(self.mode, self.arch)
@ -42,9 +40,8 @@ class VmTestConfiguration(test.TestConfiguration):
def __init__(self, context, root):
super(VmTestConfiguration, self).__init__(context, root)
def ListTests(self, current_path, path, mode, arch):
if not arch in ['ia32', 'x64', 'arm', 'simarm']:
return []
def ListTests(self, current_path, path, mode, arch, component):
if component != 'vm': return []
run_tests = self.context.GetRunTests(mode, arch)
output = test_runner.Execute(run_tests + ['--list'], self.context)
if output.exit_code != 0:

View file

@ -7,7 +7,7 @@ prefix co19
#
# Problems specific to compiler in release build (--optimize)
#
[ $arch == dartc && $mode == release ]
[ $component == dartc && $mode == release ]
# OK to fail - the optimized code doesn't execute correctly after type errors
LibTest/core/List/List/List/A01/t04: Fail
@ -26,12 +26,12 @@ LangGuideTest/02_Language_Constructs/02_11_Exceptions/A09/t02: Fail # Issue 219
#
# Tests that pass in release mode but fail in debug mode
#
[ $arch == dartc && $mode == debug ]
[ $component == dartc && $mode == debug ]
#
# Problems in both debug and release builds
#
[ $arch == dartc ]
[ $component == dartc ]
LangGuideTest/02_Language_Constructs/02_1_Class/02_1_Class_Const_Expressions/A04/t01: Fail # Bug 5371670.
LangGuideTest/02_Language_Constructs/02_1_Class/02_1_Class_Const_Expressions/A02/t01: Fail # Bug 5371670.
@ -189,9 +189,9 @@ LibTest/core/Queue/iterator_hasNext/Queue/iterator/hasNext/A01/t01: Skip # Timeo
# List.fromList has been removed.
LibTest/core/List/List.fromList/*: Fail
[ $arch == dartium ]
[ $component == dartium ]
*: Skip
[ $arch == chromium ]
[ $component == chromium ]
*: Skip

View file

@ -4,7 +4,7 @@
prefix co19
[ $arch == ia32 ]
[ $component == vm ]
LangGuideTest/02_Language_Constructs/02_1_Class/02_1_Class_Const_Expressions/A04/t01: Fail # Bug 5371433
LangGuideTest/02_Language_Constructs/02_1_Class/02_1_Class_Construction/A10/t01: Fail # Bug 5371433

View file

@ -1,5 +1,5 @@
# Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file
# for details. All rights reserved. Use of this source code is governed by a
# for details. All rights reserved. Use of this source code is governed by a
# BSD-style license that can be found in the LICENSE file.
@ -16,17 +16,18 @@ class Error(Exception):
class Co19TestCase(test.TestCase):
def __init__(self, path, context, filename, mode, arch):
def __init__(self, path, context, filename, mode, arch, component):
super(Co19TestCase, self).__init__(context, path)
self.filename = filename
self.mode = mode
self.arch = arch
self.component = component
self._is_negative = None
def IsNegative(self):
if self._is_negative is None :
contents = self.GetSource()
for tag in ('@compile-error','@static-type-error',
for tag in ('@compile-error','@static-type-error',
'@dynamic-type-error', '@runtime-error'):
if tag in contents:
self._is_negative = True
@ -37,7 +38,7 @@ class Co19TestCase(test.TestCase):
return self._is_negative
def GetLabel(self):
return "%s%s %s" % (self.mode, self.arch, "/".join(self.path))
return "%s%s %s %s" % (self.mode, self.arch, self.component, "/".join(self.path))
def GetCommand(self):
# Parse the options by reading the .dart source file.
@ -48,7 +49,7 @@ class Co19TestCase(test.TestCase):
self.context.workspace)
# Combine everything into a command array and return it.
command = self.context.GetDart(self.mode, self.arch)
command = self.context.GetDart(self.mode, self.arch, self.component)
command += self.context.flags
if self.mode == 'release': command += ['--optimize']
if vm_options: command += vm_options
@ -71,7 +72,7 @@ class Co19TestConfiguration(test.TestConfiguration):
def __init__(self, context, root):
super(Co19TestConfiguration, self).__init__(context, root)
def ListTests(self, current_path, path, mode, arch):
def ListTests(self, current_path, path, mode, arch, component):
tests = []
src_dir = join(self.root, "src")
strip = len(src_dir.split(os.path.sep))
@ -92,16 +93,16 @@ class Co19TestConfiguration(test.TestConfiguration):
# remove suffixes
if short_name.endswith(".dart"):
short_name = short_name[:-5] # Remove .dart suffix.
# now .app suffix discarded at self.IsTest()
# now .app suffix discarded at self.IsTest()
#elif short_name.endswith(".app"):
# short_name = short_name[:-4] # Remove .app suffix.
else:
raise Error('Unknown suffix in "%s", fix IsTest() predicate' % f)
while short_name.startswith('_'):
short_name = short_name[1:]
test_path.extend(short_name.split('_'))
# test full name and shorted name matches given path pattern
@ -109,12 +110,13 @@ class Co19TestConfiguration(test.TestConfiguration):
elif self.Contains(path, test_path + [test_name]): pass
else:
continue
tests.append(Co19TestCase(test_path,
self.context,
join(root, f),
mode,
arch))
arch,
component))
return tests
_TESTNAME_PATTERN = re.compile(r'.*_t[0-9]{2}\.dart$')
@ -132,7 +134,7 @@ class Co19TestConfiguration(test.TestConfiguration):
def Contains(self, path, file):
""" reimplemented for support '**' glob pattern """
if len(path) > len(file):
return
return
# ** matches to any number of directories, a/**/d matches a/b/c/d
# paths like a/**/x/**/b not allowed
patterns = [p.pattern for p in path]

View file

@ -4,7 +4,7 @@
prefix corelib
[ $arch == ia32 || $arch == dartium ]
[ $component == vm || $component == dartium ]
UnicodeTest: Fail # Bug 5163868
DoubleCompareTest: Fail # Bug 5427703
*DartcTest: Skip
@ -12,7 +12,7 @@ DoubleCompareTest: Fail # Bug 5427703
[ $arch == ia32 ]
[ $arch == dartc || $arch == chromium ]
[ $component == dartc || $component == chromium ]
ConstListLiteralTest: Fail # Bug 5202940
ConstListSetRangeTest: Fail # Bug 5202940
ConstListRemoveRangeTest: Fail # Bug 5202940
@ -22,7 +22,7 @@ StringTest: Fail # Bug 5196164
IndexedListAccessTest: Fail # Issue 274
*VMTest: Skip
[ $arch == dartium ]
[ $component == dartium ]
# Bug 5476054: print is only available if DOM is imported.
SortTest: Fail
ListSortTest: Fail

View file

@ -4,10 +4,10 @@
prefix isolate
[ $arch == ia32 ]
[ $component == vm ]
Isolate2NegativeTest: Skip # Need to resolve correct behaviour.
[ $arch == dartium || $arch == ia32 || $arch == x64 || $arch == simarm || $arch == arm ]
[ $component == dartium || $component == vm ]
SerializationTest: Skip # DartC test (uses coreimpl).
[ $arch == chromium && $arch == release ]

View file

@ -17,7 +17,7 @@
prefix language
[ $arch == ia32 || $arch == dartium ]
[ $component == vm || $component == dartium ]
ClassTest: Fail # Bug 4504458 (pseudo keyword)
NamingTest: Fail # Bug 4504458 (pseudo keyword)
SuperTest: Fail # Bug 4995181
@ -50,11 +50,11 @@ NonParameterizedFactory2Test: Fail # Bug 5257789
# DartC specific tests that should not be run by the VM.
*DartcTest: Skip
[ $arch == ia32 && $mode == debug ]
[ $component == vm && $mode == debug ]
NonParameterizedFactoryTest: Crash # Issue 226
# Problems specific to dartc optimized mode
[ ($arch == dartc || $arch == chromium) && $mode == release ]
[ ($component == dartc || $component == chromium) && $mode == release ]
MethodInvocationTest: Fail # Bug 5392266
Label2NegativeTest: Crash # Bug 5318228
NullPointerExceptionTest: Fail # Bug 5391976
@ -65,10 +65,10 @@ BadNamedParametersTest: Fail # Bug 4202974 - release mode is not thr
CTConst2Test: Fail # Codesite issue 124
# Problems specific to dartc debug mode
[ ($arch == dartc || $arch == chromium) && $mode == debug ]
[ ($component == dartc || $component == chromium) && $mode == debug ]
[ $arch == dartc || $arch == chromium ]
[ $component == dartc || $component == chromium ]
Library4NegativeTest: Fail # Bug 5406175
Prefix3NegativeTest: Fail # Bug 5406175
Prefix11NegativeTest: Fail # Bug 5406175
@ -164,7 +164,7 @@ FactoryArrowTest: Fail # Issue 223
*VMTest: Skip
[ $arch == dartium ]
[ $component == dartium ]
# TODO: These need to be retriaged.
ExpectTest: Fail
StackTraceTest: Fail

View file

@ -4,27 +4,27 @@
prefix standalone
[ $arch == ia32 && $checked ]
[ $component == vm && $checked ]
# These tests have type errors on purpose.
ProcessInvalidArgumentsTest: Fail, OK
DirectoryInvalidArgumentsTest: Fail, OK
[ $arch == ia32]
[ $component == vm]
ManyEchoServerTest: Skip # Bug 5103754
[ $arch == ia32 && $mode == release]
[ $component == vm && $mode == release]
# Currently process tests are bound to debug mode.
Process*: Skip # Bug 172
[ $arch == ia32 && $system == macos]
[ $component == vm && $system == macos]
Process*: Skip # Bug 172
# This test fails with "Too many open files" on the Mac OS buildbot.
SocketManyConnectionsTest: Skip
[ $arch == ia32 && $system == win32]
[ $component == vm && $system == win32]
Process*: Skip
[ $arch == dartium ]
[ $component == dartium ]
# Server specific tests OK to fail in the browser
EchoServerTest: Skip # Uses Socket
EchoServerStreamTest: Skip # Uses Socket
@ -47,7 +47,7 @@ Directory*: Skip # Uses Directory
StringStreamTest: Skip # Uses InputStream
[ $arch == dartc || $arch == chromium ]
[ $component == dartc || $component == chromium ]
*: Skip

View file

@ -6,7 +6,7 @@
#import("../../isolate/src/TestFramework.dart");
/* class = Purse (file:/usr/local/google/users/scheglov/Clients/Dart/dart/tests/stub-generator/src/MintMakerFullyIsolatedTest.dart/MintMakerFullyIsolatedTest.dart: 9) */
/* class = Purse (tests/stub-generator/src/MintMakerFullyIsolatedTest.dart/MintMakerFullyIsolatedTest.dart: 9) */
interface Purse$Proxy {
Promise<int> queryBalance();
@ -83,7 +83,7 @@ class Purse$Dispatcher$Isolate extends Isolate {
}
}
/* class = PowerfulPurse (file:/usr/local/google/users/scheglov/Clients/Dart/dart/tests/stub-generator/src/MintMakerFullyIsolatedTest.dart/MintMakerFullyIsolatedTest.dart: 18) */
/* class = PowerfulPurse (tests/stub-generator/src/MintMakerFullyIsolatedTest.dart/MintMakerFullyIsolatedTest.dart: 18) */
interface PowerfulPurse$Proxy {
void init(Mint$Proxy mint, int balance);
@ -161,7 +161,7 @@ class PowerfulPurse$Dispatcher$Isolate extends Isolate {
}
}
/* class = Mint (file:/usr/local/google/users/scheglov/Clients/Dart/dart/tests/stub-generator/src/MintMakerFullyIsolatedTest.dart/MintMakerFullyIsolatedTest.dart: 28) */
/* class = Mint (tests/stub-generator/src/MintMakerFullyIsolatedTest.dart/MintMakerFullyIsolatedTest.dart: 28) */
interface Mint$Proxy {
Purse$Proxy createPurse(int balance);

View file

@ -6,7 +6,7 @@
#import("../../isolate/src/TestFramework.dart");
/* class = Mint (file:/usr/local/google/users/scheglov/Clients/Dart/dart/tests/stub-generator/src/MintMakerPromiseWithStubsTest.dart/MintMakerPromiseWithStubsTest.dart: 9) */
/* class = Mint (tests/stub-generator/src/MintMakerPromiseWithStubsTest.dart/MintMakerPromiseWithStubsTest.dart: 9) */
interface Mint$Proxy {
Purse$Proxy createPurse(int balance);
@ -59,7 +59,7 @@ class Mint$Dispatcher$Isolate extends Isolate {
}
}
/* class = Purse (file:/usr/local/google/users/scheglov/Clients/Dart/dart/tests/stub-generator/src/MintMakerPromiseWithStubsTest.dart/MintMakerPromiseWithStubsTest.dart: 17) */
/* class = Purse (tests/stub-generator/src/MintMakerPromiseWithStubsTest.dart/MintMakerPromiseWithStubsTest.dart: 17) */
interface Purse$Proxy {
Promise<int> queryBalance();

View file

@ -4,9 +4,9 @@
prefix stub-generator
[ $arch == ia32 ]
[ $component == vm ]
[ $arch == dartc ]
[ $component == dartc ]
[ $arch == x64 ]
*: Skip
@ -17,8 +17,8 @@ prefix stub-generator
[ $arch == arm ]
*: Skip
[ $arch == dartium ]
[ $component == dartium ]
*: Skip
[ $arch == chromium ]
[ $component == chromium ]
*: Skip

View file

@ -18,11 +18,13 @@ def GeneratedName(src):
return re.sub('\.dart$', '-generatedTest.dart', src)
class DartStubTestCase(test_case.StandardTestCase):
def __init__(self, context, path, filename, mode, arch):
super(DartStubTestCase, self).__init__(context, path, filename, mode, arch)
def __init__(self, context, path, filename, mode, arch, component):
super(DartStubTestCase, self).__init__(context, path, filename, mode, arch,
component)
self.filename = filename
self.mode = mode
self.arch = arch
self.component = component
def IsBatchable(self):
return False
@ -86,7 +88,7 @@ class DartStubTestCase(test_case.StandardTestCase):
(interface, _, implementation) = self.GetStubs()
# Combine everything into a command array and return it.
command = self.context.GetDart(self.mode, self.arch)
command = self.context.GetDart(self.mode, self.arch, self.component)
if interface is None:
f = self.filename
else:
@ -102,7 +104,7 @@ class DartStubTestConfiguration(test_configuration.StandardTestConfiguration):
def __init__(self, context, root):
super(DartStubTestConfiguration, self).__init__(context, root)
def ListTests(self, current_path, path, mode, arch):
def ListTests(self, current_path, path, mode, arch, component):
dartc = self.context.GetDartC(mode, 'dartc')
self.context.generate = os.access(dartc[0], os.X_OK)
tests = []
@ -124,7 +126,8 @@ class DartStubTestConfiguration(test_configuration.StandardTestConfiguration):
test_path,
join(root, f),
mode,
arch))
arch,
component))
return tests

View file

@ -417,10 +417,11 @@ class TestCase(object):
self.context = context
self.duration = None
self.arch = []
self.component = []
def IsBatchable(self):
if self.context.use_batch:
if self.arch and 'dartc' in self.arch:
if self.component and 'dartc' in self.component:
return True
return False
@ -530,11 +531,12 @@ class TestRepository(TestSuite):
filename.close()
return self.config
def ListTests(self, current_path, path, context, mode, arch):
def ListTests(self, current_path, path, context, mode, arch, component):
return self.GetConfiguration(context).ListTests(current_path,
path,
mode,
arch)
arch,
component)
def GetTestStatus(self, context, sections, defs):
self.GetConfiguration(context).GetTestStatus(sections, defs)
@ -547,14 +549,14 @@ class LiteralTestSuite(TestSuite):
super(LiteralTestSuite, self).__init__('root')
self.tests = tests
def ListTests(self, current_path, path, context, mode, arch):
def ListTests(self, current_path, path, context, mode, arch, component):
name = path[0]
result = []
for test in self.tests:
test_name = test.GetName()
if name.match(test_name):
full_path = current_path + [test_name]
result += test.ListTests(full_path, path, context, mode, arch)
result += test.ListTests(full_path, path, context, mode, arch, component)
return result
def GetTestStatus(self, context, sections, defs):
@ -598,9 +600,9 @@ class Context(object):
else:
return path
def GetDart(self, mode, arch):
def GetDart(self, mode, arch, component):
"""Returns the path to the Dart test runner (executes the .dart file)."""
if arch == 'dartc':
if component == 'dartc':
command = [os.path.abspath(
os.path.join(self.GetBuildRoot(mode, arch),
'compiler', 'bin', 'dartc_test'))]
@ -743,7 +745,6 @@ class Operation(Expression):
def Evaluate(self, env, defs):
"""Evaluates expression in the .status file. e.g. ($arch == ia32)."""
if self.op == '||' or self.op == ',':
return self.left.Evaluate(env, defs) or self.right.Evaluate(env, defs)
elif self.op == 'if':
@ -808,7 +809,7 @@ class Tokenizer(object):
"""Lexical analysis of an expression in a .status file.
Example:
[ $mode == debug && ($arch == chromium || $arch == dartc) ]
[ $mode == debug && ($component == chromium || $component == dartc) ]
Args:
None.
@ -983,7 +984,7 @@ class Configuration(object):
Args:
cases: list of TestCase objects to classify.
env: dictionary containing values for 'mode',
'system', 'arch' and 'checked'.
'system', 'component', 'arch' and 'checked'.
Returns:
A triplet of (result, rules, expected_outcomes).
@ -1153,7 +1154,7 @@ def BuildOptions():
result.add_option(
'--arch',
help='The architecture to run tests for',
metavar='[all,ia32,x64,simarm,arm,dartc]',
metavar='[all,ia32,x64,simarm,arm]',
default=ARCH_GUESS)
result.add_option(
'--os',
@ -1186,7 +1187,7 @@ def BuildOptions():
action='store_true')
result.add_option(
'--batch',
help='Run multiple tests for dartc architecture in a single vm',
help='Run multiple tests for dartc component in a single vm',
choices=['true', 'false'],
default='true',
type='choice')
@ -1195,6 +1196,12 @@ def BuildOptions():
help='Invoke dart compiler with --optimize flag',
default=False,
action='store_true')
result.add_option(
'-c', '--component',
help='The component to test against '
'(most, vm, dartc, chromium, dartium)',
metavar='[most,vm,dartc,chromium,dartium]',
default='vm')
return result
@ -1204,29 +1211,43 @@ def ProcessOptions(options):
options.arch = 'ia32,x64,simarm'
if options.mode == 'all':
options.mode = 'debug,release'
if options.component == 'most':
options.component = 'vm,dartc'
if 'dartc' in options.arch:
options.component = 'dartc'
if 'dartium' in options.arch:
options.component = 'dartium'
if 'chromium' in options.arch:
options.component = 'chromium'
# By default we run with a higher timeout setting in when running on
# a simulated architecture and in debug mode.
if not options.timeout:
options.timeout = TIMEOUT_SECS
if 'dartc' in options.arch:
if 'dartc' in options.component:
options.timeout *= 4
elif 'chromium' in options.arch:
elif 'chromium' in options.component:
options.timeout *= 4
elif 'dartium' in options.arch:
elif 'dartium' in options.component:
options.timeout *= 4
elif 'debug' in options.mode:
options.timeout *= 2
options.mode = options.mode.split(',')
options.arch = options.arch.split(',')
options.component = options.component.split(',')
for mode in options.mode:
if not mode in ['debug', 'release']:
print 'Unknown mode %s' % mode
return False
for arch in options.arch:
if not arch in ['ia32', 'x64', 'simarm', 'arm', 'dartc', 'dartium',
'chromium']:
if not arch in ['ia32', 'x64', 'simarm', 'arm']:
print 'Unknown arch %s' % arch
return False
for component in options.component:
if not component in ['vm', 'dartc', 'chromium', 'dartium']:
print 'Unknown component %s' % component
return False
options.flags = []
options.flags.append('--ignore-unrecognized-flags')
if options.checked:
@ -1423,22 +1444,24 @@ def Main():
for path in paths:
for mode in options.mode:
for arch in options.arch:
env = {
'mode': mode,
'system': utils.GuessOS(),
'arch': arch,
'checked': options.checked
}
test_list = root.ListTests([], path, context, mode, arch)
(cases, unused_rules, unused_outcomes) = config.ClassifyTests(
test_list, env)
if globally_unused_rules is None:
globally_unused_rules = set(unused_rules)
else:
globally_unused_rules = (
globally_unused_rules.intersection(unused_rules))
all_cases += cases
all_unused.append(unused_rules)
for component in options.component:
env = {
'mode': mode,
'system': utils.GuessOS(),
'arch': arch,
'component': component,
'checked': options.checked
}
test_list = root.ListTests([], path, context, mode, arch, component)
(cases, unused_rules, unused_outcomes) = config.ClassifyTests(
test_list, env)
if globally_unused_rules is None:
globally_unused_rules = set(unused_rules)
else:
globally_unused_rules = (
globally_unused_rules.intersection(unused_rules))
all_cases += cases
all_unused.append(unused_rules)
if options.report:
PrintReport(all_cases)

View file

@ -3,16 +3,6 @@
# BSD-style license that can be found in the LICENSE file.
#
"""Runs a Dart unit test in different configurations.
Currently supported architectures include dartium, chromium, ia32, x64,
arm, simarm, and dartc.
Example:
run.py --arch=dartium --mode=release --test=Test.dart
"""
import os
import platform
import re
@ -157,12 +147,13 @@ def IsLibraryDefinition(test, source):
class Architecture(object):
"""Definitions for different ways to test based on the --arch flag."""
"""Definitions for different ways to test based on the component flag."""
def __init__(self, root_path, arch, mode, test):
def __init__(self, root_path, arch, mode, component, test):
self.root_path = root_path
self.arch = arch
self.mode = mode
self.component = component
self.test = test
self.build_root = utils.GetBuildRoot(OS_GUESS, self.mode, self.arch)
source = file(test).read()
@ -174,7 +165,7 @@ class Architecture(object):
self.temp_dir = None
def HasFatalTypeErrors(self):
"""Returns True if this type of arch supports --fatal-type-errors."""
"""Returns True if this type of component supports --fatal-type-errors."""
return False
def GetTestFrameworkPath(self):
@ -186,8 +177,9 @@ class Architecture(object):
class BrowserArchitecture(Architecture):
"""Architecture that runs compiled dart->JS through a browser."""
def __init__(self, root_path, arch, mode, test):
super(BrowserArchitecture, self).__init__(root_path, arch, mode, test)
def __init__(self, root_path, arch, mode, component, test):
super(BrowserArchitecture, self).__init__(root_path, arch, mode, component,
test)
self.temp_dir = tempfile.mkdtemp()
if not self.is_web_test: self.GenerateWebTestScript()
@ -232,7 +224,7 @@ class BrowserArchitecture(Architecture):
unittest_path = os.path.join(self.root_path, 'client', 'testing',
'unittest', 'unittest.dart')
if self.arch == 'chromium':
if self.component == 'chromium':
dom_path = os.path.join(self.root_path, 'client', 'testing',
'unittest', 'dom_for_unittest.dart')
else:
@ -337,8 +329,8 @@ class BrowserArchitecture(Architecture):
class ChromiumArchitecture(BrowserArchitecture):
"""Architecture that runs compiled dart->JS through a chromium DRT."""
def __init__(self, root_path, arch, mode, test):
super(ChromiumArchitecture, self).__init__(root_path, arch, mode, test)
def __init__(self, root_path, arch, mode, component, test):
super(ChromiumArchitecture, self).__init__(root_path, arch, mode, component, test)
def GetScriptType(self):
return 'text/javascript'
@ -381,8 +373,8 @@ class ChromiumArchitecture(BrowserArchitecture):
class DartiumArchitecture(BrowserArchitecture):
"""Architecture that runs dart in an VM embedded in DumpRenderTree."""
def __init__(self, root_path, arch, mode, test):
super(DartiumArchitecture, self).__init__(root_path, arch, mode, test)
def __init__(self, root_path, arch, mode, component, test):
super(DartiumArchitecture, self).__init__(root_path, arch, mode, component, test)
def GetScriptType(self):
return 'application/dart'
@ -405,8 +397,9 @@ class DartiumArchitecture(BrowserArchitecture):
class StandaloneArchitecture(Architecture):
"""Base class for architectures that run tests without a browser."""
def __init__(self, root_path, arch, mode, test):
super(StandaloneArchitecture, self).__init__(root_path, arch, mode, test)
def __init__(self, root_path, arch, mode, component, test):
super(StandaloneArchitecture, self).__init__(root_path, arch, mode, component,
test)
def GetCompileCommand(self, fatal_static_type_errors=False):
fatal_static_type_errors = fatal_static_type_errors # shutup lint!
@ -450,8 +443,8 @@ class StandaloneArchitecture(Architecture):
class DartcArchitecture(StandaloneArchitecture):
"""Runs the Dart ->JS compiler then runs the result in a standalone JS VM."""
def __init__(self, root_path, arch, mode, test):
super(DartcArchitecture, self).__init__(root_path, arch, mode, test)
def __init__(self, root_path, arch, mode, component, test):
super(DartcArchitecture, self).__init__(root_path, arch, mode, component, test)
def GetExecutable(self):
"""Returns the name of the executable to run the test."""
@ -476,8 +469,9 @@ class DartcArchitecture(StandaloneArchitecture):
class RuntimeArchitecture(StandaloneArchitecture):
"""Executes tests on the standalone VM (runtime)."""
def __init__(self, root_path, arch, mode, test):
super(RuntimeArchitecture, self).__init__(root_path, arch, mode, test)
def __init__(self, root_path, arch, mode, component, test):
super(RuntimeArchitecture, self).__init__(root_path, arch, mode, component,
test)
def GetExecutable(self):
"""Returns the name of the executable to run the test."""
@ -503,16 +497,16 @@ def ExecuteCommand(cmd, verbose=False):
return subprocess.call(cmd)
def GetArchitecture(arch, mode, test):
def GetArchitecture(arch, mode, component, test):
root_path = os.path.abspath(os.path.join(os.path.dirname(sys.argv[0]), '..'))
if arch == 'chromium':
return ChromiumArchitecture(root_path, arch, mode, test)
if component == 'chromium':
return ChromiumArchitecture(root_path, arch, mode, component, test)
elif arch == 'dartium':
return DartiumArchitecture(root_path, arch, mode, test)
elif component == 'dartium':
return DartiumArchitecture(root_path, arch, mode, component, test)
elif arch in ['ia32', 'x64', 'simarm', 'arm']:
return RuntimeArchitecture(root_path, arch, mode, test)
elif component == 'vm':
return RuntimeArchitecture(root_path, arch, mode, component, test)
elif arch == 'dartc':
return DartcArchitecture(root_path, arch, mode, test)
elif component == 'dartc':
return DartcArchitecture(root_path, arch, mode, component, test)

View file

@ -18,12 +18,15 @@ class Error(Exception):
class StandardTestCase(test.TestCase):
"""A test case defined by a *Test.dart file."""
def __init__(self, context, path, filename, mode, arch, vm_options=None):
def __init__(self, context, path, filename, mode, arch, component,
vm_options=None):
super(StandardTestCase, self).__init__(context, path)
self.filename = filename
self.mode = mode
self.arch = arch
self.component = component
self.run_arch = architecture.GetArchitecture(self.arch, self.mode,
self.component,
self.filename)
for flag in context.flags:
self.run_arch.vm_options.append(flag)
@ -36,7 +39,8 @@ class StandardTestCase(test.TestCase):
return self.GetName().endswith('NegativeTest')
def GetLabel(self):
return '%s%s %s' % (self.mode, self.arch, '/'.join(self.path))
return '%s%s %s %s' % (self.mode, self.arch, self.component,
'/'.join(self.path))
def GetCommand(self):
return self.run_arch.GetRunCommand()
@ -60,8 +64,9 @@ class StandardTestCase(test.TestCase):
class MultiTestCase(StandardTestCase):
"""Multiple test cases defined within a single *Test.dart file."""
def __init__(self, context, path, filename, kind, mode, arch):
super(MultiTestCase, self).__init__(context, path, filename, mode, arch)
def __init__(self, context, path, filename, kind, mode, arch, component):
super(MultiTestCase, self).__init__(context, path, filename, mode, arch,
component)
self.kind = kind
def GetCommand(self):
@ -90,9 +95,9 @@ class BrowserTestCase(StandardTestCase):
"""A test case that executes inside a browser (or DumpRenderTree)."""
def __init__(self, context, path, filename,
fatal_static_type_errors, mode, arch, vm_options=None):
fatal_static_type_errors, mode, arch, component, vm_options=None):
super(BrowserTestCase, self).__init__(
context, path, filename, mode, arch, vm_options)
context, path, filename, mode, arch, component, vm_options)
self.fatal_static_type_errors = fatal_static_type_errors
def Run(self):
@ -125,12 +130,15 @@ class BrowserTestCase(StandardTestCase):
class CompilationTestCase(test.TestCase):
"""Run the dartc compiler on a given top level .dart file."""
def __init__(self, path, context, filename, mode, arch):
def __init__(self, path, context, filename, mode, arch, component):
super(CompilationTestCase, self).__init__(context, path)
self.filename = filename
self.mode = mode
self.arch = arch
self.run_arch = architecture.GetArchitecture(self.arch, self.mode,
self.component = component
self.run_arch = architecture.GetArchitecture(self.arch,
self.mode,
self.component,
self.filename)
self.temp_dir = tempfile.mkdtemp(prefix='dartc-output-')
@ -138,7 +146,8 @@ class CompilationTestCase(test.TestCase):
return False
def GetLabel(self):
return '%s/%s %s' % (self.mode, self.arch, '/'.join(self.path))
return '%s/%s %s %s' % (self.mode, self.arch, self.component,
'/'.join(self.path))
def GetCommand(self):
"""Returns a command line to run the test."""

View file

@ -54,7 +54,7 @@ class StandardTestConfiguration(test.TestConfiguration):
return
os.execlp('rm', *(['rm', '-rf'] + dirs))
def CreateTestCases(self, test_path, path, filename, mode, arch):
def CreateTestCases(self, test_path, path, filename, mode, arch, component):
"""Given a .dart filename, create a StandardTestCase from it."""
# Look for VM specified as comments in the source file. If
# several sets of VM options are specified create a separate
@ -66,7 +66,7 @@ class StandardTestConfiguration(test.TestConfiguration):
tags = {}
if filename.endswith('.dart'):
tags = self.SplitMultiTest(test_path, filename)
if arch in ['dartium', 'chromium']:
if component in ['dartium', 'chromium']:
if tags:
return []
else:
@ -74,11 +74,12 @@ class StandardTestConfiguration(test.TestConfiguration):
tests = []
for options in vm_options_list:
tests.append(test_case.BrowserTestCase(
self.context, test_path, filename, False, mode, arch, options))
self.context, test_path, filename, False, mode, arch, component,
options))
return tests
else:
return [test_case.BrowserTestCase(
self.context, test_path, filename, False, mode, arch)]
self.context, test_path, filename, False, mode, arch, component)]
else:
tests = []
if tags:
@ -90,18 +91,18 @@ class StandardTestConfiguration(test.TestConfiguration):
test_path + [tag],
test_source,
kind,
mode, arch))
mode, arch, component))
else:
if vm_options_list:
for options in vm_options_list:
tests.append(test_case.StandardTestCase(self.context,
test_path, filename, mode, arch, options))
test_path, filename, mode, arch, component, options))
else:
tests.append(test_case.StandardTestCase(self.context,
test_path, filename, mode, arch))
test_path, filename, mode, arch, component))
return tests
def ListTests(self, current_path, path, mode, arch):
def ListTests(self, current_path, path, mode, arch, component):
"""Searches for *Test.dart files and returns list of TestCases."""
tests = []
for root, unused_dirs, files in os.walk(os.path.join(self.root, 'src')):
@ -116,7 +117,7 @@ class StandardTestConfiguration(test.TestConfiguration):
continue
tests.extend(self.CreateTestCases(test_path, path,
os.path.join(root, f),
mode, arch))
mode, arch, component))
atexit.register(lambda: self._Cleanup(tests))
return tests
@ -220,7 +221,7 @@ class BrowserTestConfiguration(StandardTestConfiguration):
super(BrowserTestConfiguration, self).__init__(context, root)
self.fatal_static_type_errors = fatal_static_type_errors
def ListTests(self, current_path, path, mode, arch):
def ListTests(self, current_path, path, mode, arch, component):
"""Searches for *Test .dart files and returns list of TestCases."""
tests = []
for root, unused_dirs, files in os.walk(self.root):
@ -233,7 +234,7 @@ class BrowserTestConfiguration(StandardTestConfiguration):
test_path,
os.path.join(root, f),
self.fatal_static_type_errors,
mode, arch))
mode, arch, component))
atexit.register(lambda: self._Cleanup(tests))
return tests
@ -250,7 +251,7 @@ class CompilationTestConfiguration(test.TestConfiguration):
def __init__(self, context, root):
super(CompilationTestConfiguration, self).__init__(context, root)
def ListTests(self, current_path, path, mode, arch):
def ListTests(self, current_path, path, mode, arch, component):
"""Searches for *Test.dart files and returns list of TestCases."""
tests = []
client_path = os.path.normpath(os.path.join(self.root, '..', '..'))
@ -273,7 +274,8 @@ class CompilationTestConfiguration(test.TestConfiguration):
self.context,
test_dart_file,
mode,
arch))
arch,
component))
atexit.register(lambda: self._Cleanup(tests))
return tests