Files
sdk/tools/test-runtime.dart
T
kustermann@google.com 3396dc77a9 Change the location of the output directory of generated tests to be inside build directory, but not relative to the dart root.
This is causing issues on dartium builders where we actually only run because there is a build/Release (and out/Release or xcodebuild/Release for mac/linux) on the bot that has been created inside src/dart.

Also, fix the http server in the testing script to serve files from the output directory - otherwise the tests will not be accessible if an alternative build directory is used.

Review URL: https://codereview.chromium.org//12183022

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@18176 260f80e4-7a28-3924-810f-c04153c831b5
2013-02-06 16:38:09 +00:00

121 lines
4.1 KiB
Dart
Executable File

#!/usr/bin/env dart
// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
// 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.
// TODO(ager): Get rid of this version of test.dart when we don't have
// to worry about the special runtime checkout anymore.
// This file is identical to test.dart with test suites in the
// directories samples, client, compiler, and utils removed.
#library("test");
#import("dart:io");
#import("testing/dart/test_runner.dart");
#import("testing/dart/test_options.dart");
#import("testing/dart/test_suite.dart");
#import("testing/dart/http_server.dart");
#import("../tests/co19/test_config.dart");
#import("../runtime/tests/vm/test_config.dart");
/**
* The directories that contain test suites which follow the conventions
* required by [StandardTestSuite]'s forDirectory constructor.
* New test suites should follow this convention because it makes it much
* simpler to add them to test.dart. Existing test suites should be
* moved to here, if possible.
*/
final TEST_SUITE_DIRECTORIES = [
new Path('runtime/tests/vm'),
new Path('tests/corelib'),
new Path('tests/isolate'),
new Path('tests/language'),
new Path('tests/lib'),
new Path('tests/standalone'),
new Path('tests/utils'),
];
main() {
var startTime = new Date.now();
var optionsParser = new TestOptionsParser();
List<Map> configurations = optionsParser.parse(new Options().arguments);
if (configurations == null) return;
// Extract global options from first configuration.
var firstConf = configurations[0];
Map<String, RegExp> selectors = firstConf['selectors'];
var maxProcesses = firstConf['tasks'];
var progressIndicator = firstConf['progress'];
var verbose = firstConf['verbose'];
var printTiming = firstConf['time'];
var listTests = firstConf['list'];
if (!firstConf['append_logs']) {
var file = new File(TestUtils.flakyFileName());
if (file.existsSync()) {
file.deleteSync();
}
}
// Print the configurations being run by this execution of
// test.dart. However, don't do it if the silent progress indicator
// is used. This is only needed because of the junit tests.
if (progressIndicator != 'silent') {
List output_words = configurations.length > 1 ?
['Test configurations:'] : ['Test configuration:'];
for (Map conf in configurations) {
List settings = ['compiler', 'runtime', 'mode', 'arch']
.mappedBy((name) => conf[name]).toList();
if (conf['checked']) settings.add('checked');
output_words.add(Strings.join(settings, '_'));
}
print(Strings.join(output_words, ' '));
}
var testSuites = new List<TestSuite>();
TestingServerRunner.setBuildDir(firstConf);
TestingServerRunner.setPackageRootDir(firstConf);
for (var conf in configurations) {
if (selectors.containsKey('co19')) {
testSuites.add(new Co19TestSuite(conf));
}
if (conf['runtime'] == 'vm' && selectors.containsKey('vm')) {
// vm tests contain both cc tests (added here) and dart tests (added in
// [TEST_SUITE_DIRECTORIES]).
testSuites.add(new VMTestSuite(conf));
}
for (final testSuiteDir in TEST_SUITE_DIRECTORIES) {
final name = testSuiteDir.filename;
if (selectors.containsKey(name)) {
testSuites.add(new StandardTestSuite.forDirectory(conf, testSuiteDir));
}
}
}
// Start global http server that serves the entire dart repo.
// The http server is available on localhost:9876 for any
// test that needs to load resources from the repo over http.
if (!listTests) {
// Only start the server if we are running browser tests.
var runningBrowserTests = configurations.any((config) {
return TestUtils.isBrowserRuntime(config['runtime']);
});
if (runningBrowserTests) startHttpServer('127.0.0.1', 9876);
}
var maxBrowserProcesses = maxProcesses;
// Start process queue.
new ProcessQueue(
maxProcesses,
maxBrowserProcesses,
progressIndicator,
startTime,
printTiming,
testSuites,
() => TestingServerRunner.terminateHttpServers(),
verbose,
listTests);
}