Remove Dartium support from test.dart.

R=whesse@google.com

Review-Url: https://codereview.chromium.org/2981223002 .
This commit is contained in:
Bob Nystrom 2017-07-20 12:46:49 -07:00
parent 306453d91d
commit 012774c78e
19 changed files with 109 additions and 365 deletions

View file

@ -75,7 +75,7 @@ dev_compiler/test/*: Skip
[ $compiler == dart2analyzer ]
dev_compiler/test/options/*: SkipByDesign
[ $compiler == none && ($runtime == drt || $runtime == dartium) ]
[ $compiler == none && $runtime == drt ]
mutation_observer: Skip # Issue 21149
unittest/*: Skip # Issue 21949
lookup_map/*: SkipByDesign

View file

@ -5,11 +5,6 @@
[ ! $browser || $runtime == drt || $fast_startup]
*: SkipByDesign
[ $runtime == dartium ]
isolate/*: Skip
allocation_profile: Skip
heap_snapshot/element_test: RuntimeError # Issue 27925
[ $runtime == ff || $runtime == safari ]
allocation_profile: Skip
cpu_profile_table: Skip

View file

@ -119,7 +119,7 @@ cc/Profiler_SourcePositionOptimized: Skip
cc/Profiler_BinaryOperatorSourcePosition: Skip
cc/Profiler_BinaryOperatorSourcePositionOptimized: Skip
[ $compiler == none && ($runtime == dartium || $runtime == drt)]
[ $compiler == none && $runtime == drt ]
dart/truncating_ints_test: Skip # Issue 14651
[ $compiler == dart2js ]

View file

@ -5,7 +5,7 @@
[ $strong ]
*: SkipByDesign # tests/corelib_strong has the strong mode versions of these tests.
[ $compiler == none && ($runtime == drt || $runtime == dartium) ]
[ $compiler == none && $runtime == drt ]
from_environment_const_type_test: Skip
from_environment_const_type_undefined_test: Skip
int_from_environment2_test: Skip
@ -55,7 +55,7 @@ int_modulo_arith_test/modPow: RuntimeError # No bigints.
list_unmodifiable_test: Pass, RuntimeError # Issue 28712
symbol_reserved_word_test/05: Crash # bug 20191
[ ($compiler == none || $compiler == precompiler || $compiler == app_jit) && $runtime != dartium && $runtime != drt ]
[ ($compiler == none || $compiler == precompiler || $compiler == app_jit) && $runtime != drt ]
symbol_test/02: MissingCompileTimeError # bug 11669
symbol_test/03: MissingCompileTimeError # bug 11669

View file

@ -295,7 +295,7 @@ generic_field_mixin4_test: Crash # Issue 18651
generic_field_mixin5_test: Crash # Issue 18651
method_override5_test: RuntimeError # Issue 12809
[ $compiler == dart2js && $runtime != drt && $runtime != dartium ]
[ $compiler == dart2js && $runtime != drt ]
issue23244_test: RuntimeError # 23244
[ $compiler == dart2js && $host_checked ]

View file

@ -3,5 +3,5 @@
# BSD-style license that can be found in the LICENSE file.
# docs.dart is a tool that only runs on the VM
[ $compiler == dart2js || $runtime == drt || $runtime == dartium ]
[ $compiler == dart2js || $runtime == drt ]
*: Skip

View file

@ -81,9 +81,6 @@ abstract class Browser {
case Runtime.chrome:
browser = new Chrome();
break;
case Runtime.dartium:
browser = new Dartium(checkedMode);
break;
case Runtime.safari:
browser = new Safari();
break;
@ -110,8 +107,7 @@ abstract class Browser {
'chrome',
'ie9',
'ie10',
'ie11',
'dartium'
'ie11'
];
static bool requiresFocus(String browserName) {
@ -584,26 +580,6 @@ class SafariMobileSimulator extends Safari {
String toString() => "SafariMobileSimulator";
}
class Dartium extends Chrome {
final bool checkedMode;
Dartium(this.checkedMode);
Map<String, String> _getEnvironment() {
var environment = new Map<String, String>.from(Platform.environment);
// By setting this environment variable, dartium will forward "print()"
// calls in dart to the top-level javascript function "dartPrint()" if
// available.
environment['DART_FORWARDING_PRINT'] = '1';
if (checkedMode) {
environment['DART_FLAGS'] = '--checked';
}
return environment;
}
String toString() => "Dartium";
}
class IE extends Browser {
Future<String> getVersion() {
var args = [
@ -670,9 +646,6 @@ final contentShellOnAndroidConfig = new AndroidBrowserConfig(
'.ContentShellActivity',
'android.intent.action.VIEW');
final dartiumOnAndroidConfig = new AndroidBrowserConfig('DartiumOnAndroid',
'com.google.android.apps.chrome', '.Main', 'android.intent.action.VIEW');
class AndroidBrowser extends Browser {
final bool checkedMode;
AdbDevice _adbDevice;

View file

@ -4,7 +4,7 @@
import 'utils.dart';
String getHtmlContents(String title, String scriptType, String scriptPath) {
String dart2jsHtml(String title, String scriptPath) {
return """
<!DOCTYPE html>
<html>
@ -24,7 +24,7 @@ String getHtmlContents(String title, String scriptType, String scriptPath) {
<script type="text/javascript"
src="/root_dart/tools/testing/dart/test_controller.js">
</script>
<script type="$scriptType" src="$scriptPath"
<script type="text/javascript" src="$scriptPath"
onerror="scriptTagOnErrorCallback(null)"
defer>
</script>
@ -101,15 +101,3 @@ requirejs(["$testName", "dart_sdk", "async_helper"],
</html>
""";
}
String dartTestWrapper(String libraryPathComponent) {
return """
import '$libraryPathComponent' as test;
main() {
print("dart-calling-main");
test.main();
print("dart-main-done");
}
""";
}

View file

@ -46,14 +46,6 @@ const List<List<String>> COMMAND_LINES = const <List<String>>[
'--use-sdk',
'--checked'
],
const <String>[
'-mrelease',
'-rdartium',
'-cnone',
'--use-sdk',
'--fast-startup'
],
const <String>['-mrelease', '-rdartium', '-cnone', '--use-sdk'],
];
void main(List<String> args) {

View file

@ -16,7 +16,6 @@ class Co19TestSuite extends StandardTestSuite {
"tests/co19/co19-analyzer2.status",
"tests/co19/co19-runtime.status",
"tests/co19/co19-dart2js.status",
"tests/co19/co19-dartium.status",
"tests/co19/co19-kernel.status"
]);

View file

@ -105,7 +105,7 @@ class CommandOutput extends UniqueObject {
class ContentShellCommandOutput extends CommandOutput {
// Although tests are reported as passing, content shell sometimes exits with
// a nonzero exitcode which makes our dartium builders extremely falky.
// a nonzero exitcode which makes our builders extremely flaky.
// See: http://dartbug.com/15139.
// TODO(rnystrom): Is this still needed? The underlying bug is closed.
static const _whitelistedContentShellExitCode = -1073740022;

View file

@ -52,7 +52,6 @@ class Configuration {
this.writeDebugLog,
this.writeTestOutcomeLog,
this.drtPath,
this.dartiumPath,
this.chromePath,
this.safariPath,
this.firefoxPath,
@ -118,7 +117,6 @@ class Configuration {
// Various file paths.
final String drtPath;
final String dartiumPath;
final String chromePath;
final String safariPath;
final String firefoxPath;
@ -253,9 +251,6 @@ class Configuration {
case Runtime.chrome:
location = chromePath;
break;
case Runtime.dartium:
location = dartiumPath;
break;
case Runtime.drt:
location = drtPath;
break;
@ -285,12 +280,6 @@ class Configuration {
'/Applications/Google Chrome.app/Contents/MacOS/Google Chrome',
System.linux: 'google-chrome'
},
Runtime.dartium: const {
System.windows: 'client\\tests\\dartium\\chrome.exe',
System.macos:
'client/tests/dartium/Chromium.app/Contents/MacOS/Chromium',
System.linux: 'client/tests/dartium/chrome'
},
Runtime.safari: const {
System.macos: '/Applications/Safari.app/Contents/MacOS/Safari'
},
@ -404,11 +393,10 @@ class Configuration {
/// Returns the correct configuration directory (the last component of the
/// output directory path) for regular dart checkouts.
///
/// Dartium checkouts use the `--build-directory` option to pass in the
/// correct build directory explicitly. We allow our code to have been cross
/// compiled, i.e., that there is an X in front of the arch. We don't allow
/// both a cross compiled and a normal version to be present (except if you
/// specifically pass in the build_directory).
/// We allow our code to have been cross compiled, i.e., that there is an X
/// in front of the arch. We don't allow both a cross compiled and a normal
/// version to be present (except if you specifically pass in the
/// build_directory).
String _calculateDirectory() {
// Capitalize the mode name.
var modeName =
@ -527,7 +515,6 @@ class Compiler {
Runtime.jsshell,
Runtime.drt,
Runtime.none,
Runtime.dartium,
Runtime.firefox,
Runtime.chrome,
Runtime.safari,
@ -562,9 +549,7 @@ class Compiler {
Runtime.vm,
Runtime.flutter,
Runtime.drt,
Runtime.dartium,
Runtime.contentShellOnAndroid,
Runtime.dartiumOnAndroid
Runtime.contentShellOnAndroid
];
}
@ -638,7 +623,6 @@ class Runtime {
static const d8 = const Runtime._('d8');
static const jsshell = const Runtime._('jsshell');
static const drt = const Runtime._('drt');
static const dartium = const Runtime._('dartium');
static const firefox = const Runtime._('firefox');
static const chrome = const Runtime._('chrome');
static const safari = const Runtime._('safari');
@ -649,7 +633,6 @@ class Runtime {
static const chromeOnAndroid = const Runtime._('chromeOnAndroid');
static const safariMobileSim = const Runtime._('safarimobilesim');
static const contentShellOnAndroid = const Runtime._('ContentShellOnAndroid');
static const dartiumOnAndroid = const Runtime._('DartiumOnAndroid');
static const selfCheck = const Runtime._('self_check');
static const none = const Runtime._('none');
@ -662,7 +645,6 @@ class Runtime {
d8,
jsshell,
drt,
dartium,
firefox,
chrome,
safari,
@ -673,7 +655,6 @@ class Runtime {
chromeOnAndroid,
safariMobileSim,
contentShellOnAndroid,
dartiumOnAndroid,
selfCheck,
none
], key: (Runtime runtime) => runtime.name);
@ -694,7 +675,6 @@ class Runtime {
bool get isBrowser => const [
drt,
dartium,
ie9,
ie10,
ie11,
@ -704,8 +684,7 @@ class Runtime {
firefox,
chromeOnAndroid,
safariMobileSim,
contentShellOnAndroid,
dartiumOnAndroid,
contentShellOnAndroid
].contains(this);
bool get isIE => name.startsWith("ie");

View file

@ -1,91 +0,0 @@
// 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(antonm): rename to something like test_runner_updater.
import 'dart:async';
import 'dart:io';
import 'configuration.dart';
import 'utils.dart';
typedef void Action();
class _DartiumUpdater {
String name;
String script;
String option;
bool isActive = false;
bool updated = false;
List<Action> onUpdated;
Future<ProcessResult> _updatingProcess;
_DartiumUpdater(this.name, this.script, [this.option = null]);
void update() {
if (!isActive) {
isActive = true;
print('Updating $name.');
onUpdated = [
() {
updated = true;
}
];
_updatingProcess = Process.run('python', _getUpdateCommand);
_updatingProcess.then(_onUpdatedHandler).catchError((e) {
print("Error starting $script process: $e");
// TODO(floitsch): should we print the stacktrace?
return false;
});
}
}
List<String> get _getUpdateCommand {
Uri updateScript = TestUtils.dartDirUri.resolve(script);
List<String> command = [updateScript.toFilePath()];
if (null != option) {
command.add(option);
}
return command;
}
void _onUpdatedHandler(ProcessResult result) {
if (result.exitCode == 0) {
print('$name updated');
} else {
print('Failure updating $name');
print(' Exit code: ${result.exitCode}');
print(result.stdout);
print(result.stderr);
exit(1);
}
for (var callback in onUpdated) callback();
}
}
_DartiumUpdater _contentShellUpdater;
_DartiumUpdater _dartiumUpdater;
_DartiumUpdater runtimeUpdater(
Runtime runtime, String drtPath, String dartiumPath) {
if (runtime == Runtime.drt && drtPath == null) {
// Download the default content shell from Google Storage.
if (_contentShellUpdater == null) {
_contentShellUpdater =
new _DartiumUpdater('Content Shell', 'tools/get_archive.py', 'drt');
}
return _contentShellUpdater;
} else if (runtime == Runtime.dartium && dartiumPath == null) {
// Download the default Dartium from Google Storage.
if (_dartiumUpdater == null) {
_dartiumUpdater = new _DartiumUpdater(
'Dartium Chrome', 'tools/get_archive.py', 'dartium');
}
return _dartiumUpdater;
} else {
return null;
}
}

View file

@ -5,8 +5,8 @@
import 'dart:io';
import 'configuration.dart';
import 'drt_updater.dart';
import 'path.dart';
import 'runtime_updater.dart';
import 'utils.dart';
const _defaultTestSelectors = const [
@ -130,12 +130,8 @@ jsshell: Run JavaScript from the command line using
drt: Run Dart or JavaScript in the headless version
of Chrome, Content shell.
dartium: Run Dart or JavaScript in Dartium.
ContentShellOnAndroid: Run Dart or JavaScript in Dartium content
shell on Android.
DartiumOnAndroid: Run Dart or Javascript in Dartium on Android.
ContentShellOnAndroid: Run Dart or JavaScript in content shell
on Android.
ff:
chrome:
@ -222,13 +218,10 @@ compact, color, line, verbose, silent, status, buildbot, diff
new _Option('dart', 'Path to dart executable.'),
new _Option('flutter', 'Path to flutter executable.'),
new _Option('drt', 'Path to content shell executable.'),
new _Option('dartium', 'Path to Dartium Chrome executable.'),
new _Option('firefox', 'Path to firefox browser executable.'),
new _Option('chrome', 'Path to chrome browser executable.'),
new _Option('safari', 'Path to safari browser executable.'),
new _Option.bool(
'use_sdk',
'''Use compiler or runtime from the SDK.
new _Option.bool('use_sdk', '''Use compiler or runtime from the SDK.
Normally, the compiler or runtimes in PRODUCT_DIR is tested, with
this option, the compiler or runtime in PRODUCT_DIR/dart-sdk/bin
@ -246,14 +239,12 @@ is tested.
'Don\'t write debug messages to stdout but rather to a logfile.'),
new _Option.bool('write_test_outcome_log',
'Write test outcomes to a "${TestUtils.testOutcomeFileName}" file.'),
new _Option.bool(
'reset_browser_configuration',
new _Option.bool('reset_browser_configuration',
'''Browser specific reset of configuration.
Warning: Using this option may remove your bookmarks and other
settings.'''),
new _Option.bool(
'copy_coredumps',
new _Option.bool('copy_coredumps',
'''If we see a crash that we did not expect, copy the core dumps to
"/tmp".'''),
new _Option(
@ -271,8 +262,7 @@ used for browsers to connect to.''',
new _Option.int(
'test_driver_error_port', 'Port for http test driver server errors.',
defaultsTo: 0),
new _Option(
'builder_tag',
new _Option('builder_tag',
'''Machine specific options that is not captured by the regular test
options. Used to be able to make sane updates to the status files.'''),
new _Option('vm_options', 'Extra options to send to the vm when running.'),
@ -282,13 +272,10 @@ options. Used to be able to make sane updates to the status files.'''),
'suite_dir', 'Additional directory to add to the testing matrix.'),
new _Option('package_root', 'The package root to use for testing.'),
new _Option('packages', 'The package spec file to use for testing.'),
new _Option(
'exclude_suite',
new _Option('exclude_suite',
'''Exclude suites from default selector, only works when no selector
has been specified on the command line.'''),
new _Option.bool(
'skip_compilation',
'''
new _Option.bool('skip_compilation', '''
Skip the compilation step, using the compilation artifacts left in
the output folder from a previous run. This flag will often cause
false positves and negatives, but can be useful for quick and
@ -305,7 +292,6 @@ compiler.''')
'copy_coredumps',
'dart',
'flutter',
'dartium',
'drt',
'exclude_suite',
'firefox',
@ -552,11 +538,9 @@ compiler.''')
for (var runtimeName in (data["runtime"] as String).split(",")) {
var runtime = Runtime.find(runtimeName);
// Install the runtime if needed.
var updater = runtimeUpdater(
runtime, data["drt"] as String, data["dartium"] as String);
if (updater != null) {
updater.update();
// Start installing the runtime if needed.
if (runtime == Runtime.drt && !(data["list"] as bool)) {
updateContentShell(data["drt"] as String);
}
// Expand architectures.
@ -613,7 +597,6 @@ compiler.''')
writeDebugLog: data["write_debug_log"] as bool,
writeTestOutcomeLog: data["write_test_outcome_log"] as bool,
drtPath: data["drt"] as String,
dartiumPath: data["dartium"] as String,
chromePath: data["chrome"] as String,
safariPath: data["safari"] as String,
firefoxPath: data["firefox"] as String,

View file

@ -21,10 +21,8 @@ abstract class RuntimeConfiguration {
factory RuntimeConfiguration(Configuration configuration) {
switch (configuration.runtime) {
case Runtime.contentShellOnAndroid:
case Runtime.dartiumOnAndroid:
case Runtime.chrome:
case Runtime.chromeOnAndroid:
case Runtime.dartium:
case Runtime.firefox:
case Runtime.ie11:
case Runtime.ie10:

View file

@ -0,0 +1,52 @@
// Copyright (c) 2017, 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.
import 'dart:async';
import 'dart:io';
import 'utils.dart';
Future _contentShellFuture;
/// Runs "tools/get_archive.py" to download and install Content Shell.
Future updateContentShell(String drtPath) {
if (_contentShellFuture == null) {
_contentShellFuture =
new _RuntimeUpdater('Content Shell', 'tools/get_archive.py', 'drt')
.update();
}
return _contentShellFuture;
}
class _RuntimeUpdater {
String _name;
String _script;
String _option;
_RuntimeUpdater(this._name, this._script, [this._option]);
Future update() async {
try {
print('Updating $_name...');
var arguments = [TestUtils.dartDirUri.resolve(_script).toFilePath()];
if (_option != null) arguments.add(_option);
var result = await Process.run('python', arguments);
if (result.exitCode == 0) {
print('Updated $_name.');
} else {
print('Failed to update $_name (exit code ${result.exitCode}):');
print(result.stdout);
print(result.stderr);
exit(1);
}
} catch (error) {
print("Error starting $_script process: $error");
exit(1);
}
}
}

View file

@ -25,12 +25,6 @@ final _combinations = {
'archs': ['ia32'],
'compiler': 'dart2js'
},
{
'runtimes': ['dartium'],
'modes': ['release', 'debug'],
'archs': ['ia32'],
'compiler': 'none'
},
{
'runtimes': ['flutter_engine'],
'modes': ['debug', 'release'],
@ -51,12 +45,6 @@ final _combinations = {
'archs': ['ia32'],
'compiler': 'dart2js'
},
{
'runtimes': ['dartium'],
'modes': ['release', 'debug'],
'archs': ['ia32'],
'compiler': 'none'
},
],
'macos': [
{
@ -71,12 +59,6 @@ final _combinations = {
'archs': ['ia32'],
'compiler': 'dart2js'
},
{
'runtimes': ['dartium'],
'modes': ['release', 'debug'],
'archs': ['ia32'],
'compiler': 'none'
},
]
};

View file

@ -1344,13 +1344,6 @@ bool shouldRetryCommand(CommandOutput output) {
}
}
// We currently rerun dartium tests, see issue 14074.
if (command is BrowserTestCommand &&
command.retry &&
command.browser == Runtime.dartium) {
return true;
}
// As long as we use a legacy version of our custom content_shell (which
// became quite flaky after chrome-50 roll) we'll re-run tests on it.
// The plan is to use chrome's content_shell instead of our own.

View file

@ -19,13 +19,13 @@ import 'browser_test.dart';
import 'command.dart';
import 'compiler_configuration.dart';
import 'configuration.dart';
import 'drt_updater.dart';
import 'expectation.dart';
import 'expectation_set.dart';
import 'html_test.dart' as html_test;
import 'http_server.dart';
import 'multitest.dart';
import 'path.dart';
import 'runtime_updater.dart';
import 'summary_report.dart';
import 'test_configurations.dart';
import 'test_runner.dart';
@ -646,7 +646,10 @@ class StandardTestSuite extends TestSuite {
Future forEachTest(
Function onTest, Map<String, List<TestInformation>> testCache,
[VoidFunction onDone]) async {
await updateDartium();
if (configuration.runtime == Runtime.drt && !configuration.listTests) {
await updateContentShell(configuration.drtPath);
}
doTest = onTest;
testExpectations = readExpectations();
@ -665,24 +668,6 @@ class StandardTestSuite extends TestSuite {
if (onDone != null) onDone();
}
/**
* If Content shell/Dartium is required, and not yet updated, waits for
* the update then completes. Otherwise completes immediately.
*/
Future updateDartium() {
var completer = new Completer();
var updater = runtimeUpdater(configuration.runtime, configuration.drtPath,
configuration.dartiumPath);
if (updater == null || updater.updated) {
return new Future.value(null);
}
assert(updater.isActive);
updater.onUpdated.add(() => completer.complete(null));
return completer.future;
}
/**
* Reads the status files and completes with the parsed expectations.
*/
@ -980,17 +965,6 @@ class StandardTestSuite extends TestSuite {
queryParameters: parameters);
}
void _createWrapperFile(
String dartWrapperFilename, Path localDartLibraryFilename) {
File file = new File(dartWrapperFilename);
RandomAccessFile dartWrapper = file.openSync(mode: FileMode.WRITE);
var libraryPathComponent = _createUrlPathFromFile(localDartLibraryFilename);
var generatedSource = dartTestWrapper(libraryPathComponent);
dartWrapper.writeStringSync(generatedSource);
dartWrapper.closeSync();
}
/**
* The [StandardTestSuite] has support for tests that
* compile a test from Dart to JavaScript, and then run the resulting
@ -1030,79 +1004,45 @@ class StandardTestSuite extends TestSuite {
Map<String, Set<Expectation>> expectations,
List<String> vmOptions,
String tempDir) {
// TODO(Issue 14651): If we're on dartium, we need to pass [packageRoot]
// on to the browser (it may be test specific).
var filePath = info.filePath;
var fileName = filePath.toNativePath();
var fileName = info.filePath.toNativePath();
var optionsFromFile = info.optionsFromFile;
var compilationTempDir = createCompilationOutputDirectory(info.filePath);
var dartWrapperFilename = '$tempDir/test.dart';
var compiledDartWrapperFilename = '$compilationTempDir/test.js';
var dir = filePath.directoryPath;
var nameNoExt = filePath.filenameWithoutExtension;
var customHtmlPath = dir.append('$nameNoExt.html').toNativePath();
var customHtml = new File(customHtmlPath);
var jsWrapperFileName = '$compilationTempDir/test.js';
var nameNoExt = info.filePath.filenameWithoutExtension;
// Use existing HTML document if available.
String htmlPath;
String content;
var customHtml = new File(
info.filePath.directoryPath.append('$nameNoExt.html').toNativePath());
if (customHtml.existsSync()) {
htmlPath = '$tempDir/test.html';
dartWrapperFilename = filePath.toNativePath();
var htmlContents = customHtml.readAsStringSync();
if (configuration.compiler == Compiler.none) {
var dartUrl = _createUrlPathFromFile(filePath);
var dartScript =
'<script type="application/dart" src="$dartUrl"></script>';
var jsUrl = '/packages/browser/dart.js';
var jsScript = '<script type="text/javascript" src="$jsUrl"></script>';
htmlContents =
htmlContents.replaceAll('%TEST_SCRIPTS%', '$dartScript\n$jsScript');
} else {
compiledDartWrapperFilename = '$tempDir/$nameNoExt.js';
htmlContents = htmlContents.replaceAll(
'%TEST_SCRIPTS%', '<script src="$nameNoExt.js"></script>');
}
new File(htmlPath).writeAsStringSync(htmlContents);
jsWrapperFileName = '$tempDir/$nameNoExt.js';
content = customHtml.readAsStringSync().replaceAll(
'%TEST_SCRIPTS%', '<script src="$nameNoExt.js"></script>');
} else {
htmlPath = '$tempDir/test.html';
if (configuration.compiler != Compiler.dart2js &&
configuration.compiler != Compiler.dartdevc) {
// test.dart will import the dart test.
_createWrapperFile(dartWrapperFilename, filePath);
} else {
dartWrapperFilename = fileName;
}
// Create the HTML file for the test.
var scriptPath = dartWrapperFilename;
if (configuration.compiler != Compiler.none) {
scriptPath = compiledDartWrapperFilename;
}
scriptPath = _createUrlPathFromFile(new Path(scriptPath));
// Synthesize an HTML file for the test.
var scriptPath = _createUrlPathFromFile(new Path(jsWrapperFileName));
if (configuration.compiler != Compiler.dartdevc) {
content = getHtmlContents(fileName, scriptType, scriptPath);
content = dart2jsHtml(fileName, scriptPath);
} else {
var jsDir = new Path(compilationTempDir)
.relativeTo(TestUtils.dartDir)
.toString();
content = dartdevcHtml(nameNoExt, jsDir, buildDir);
}
new File(htmlPath).writeAsStringSync(content);
}
var htmlPath = '$tempDir/test.html';
new File(htmlPath).writeAsStringSync(content);
// Construct the command(s) that compile all the inputs needed by the
// browser test. For running Dart in DRT, this will be noop commands.
var commands = <Command>[];
switch (configuration.compiler) {
case Compiler.dart2js:
commands.add(_dart2jsCompileCommand(dartWrapperFilename,
compiledDartWrapperFilename, tempDir, optionsFromFile));
commands.add(_dart2jsCompileCommand(
fileName, jsWrapperFileName, tempDir, optionsFromFile));
break;
case Compiler.dartdevc:
@ -1113,9 +1053,6 @@ class StandardTestSuite extends TestSuite {
optionsFromFile["sharedOptions"] as List<String>));
break;
case Compiler.none:
break;
default:
assert(false);
}
@ -1123,13 +1060,13 @@ class StandardTestSuite extends TestSuite {
// Some tests require compiling multiple input scripts.
for (var name in optionsFromFile['otherScripts'] as List<String>) {
var namePath = new Path(name);
var fromPath = filePath.directoryPath.join(namePath);
var fromPath = info.filePath.directoryPath.join(namePath);
var toPath = new Path('$tempDir/${namePath.filename}.js').toNativePath();
switch (configuration.compiler) {
case Compiler.dart2js:
commands.add(_dart2jsCompileCommand(fromPath.toNativePath(),
toPath, tempDir, optionsFromFile));
commands.add(_dart2jsCompileCommand(
fromPath.toNativePath(), toPath, tempDir, optionsFromFile));
break;
case Compiler.dartdevc:
@ -1137,17 +1074,6 @@ class StandardTestSuite extends TestSuite {
fromPath.toNativePath(), toPath,
optionsFromFile["sharedOptions"] as List<String>));
break;
default:
assert(configuration.compiler == Compiler.none);
}
if (configuration.compiler == Compiler.none) {
// For the tests that require multiple input scripts but are not
// compiled, move the input scripts over with the script so they can
// be accessed.
new File(fromPath.toNativePath())
.copySync('$tempDir/${namePath.filename}');
}
}
@ -1195,15 +1121,6 @@ class StandardTestSuite extends TestSuite {
contentShellOptions.add('--disable-gpu-early-init');
}
if (configuration.compiler == Compiler.none) {
dartFlags.add('--ignore-unrecognized-flags');
if (configuration.isChecked) {
dartFlags.add('--enable_asserts');
dartFlags.add("--enable_type_checks");
}
dartFlags.addAll(vmOptions);
}
commands.add(Command.contentShell(contentShellFilename, fullHtmlPath,
contentShellOptions, dartFlags, environmentOverrides));
} else {
@ -1327,22 +1244,6 @@ class StandardTestSuite extends TestSuite {
alwaysCompile: !useSdk);
}
String get scriptType {
switch (configuration.compiler) {
case Compiler.none:
return 'application/dart';
case Compiler.dart2js:
case Compiler.dart2analyzer:
case Compiler.dartdevc:
return 'text/javascript';
default:
print('Non-web runtime, so no scriptType for: '
'${configuration.compiler.name}');
exit(1);
return null;
}
}
bool get hasRuntime => configuration.runtime != Runtime.none;
String get contentShellFilename {
@ -1406,8 +1307,8 @@ class StandardTestSuite extends TestSuite {
* creating additional files in the test directories.
*
* Here is a list of options that are used by 'test.dart' today:
* - Flags can be passed to the vm or dartium process that runs the test by
* adding a comment to the test file:
* - Flags can be passed to the vm process that runs the test by adding a
* comment to the test file:
*
* // VMOptions=--flag1 --flag2
*
@ -1651,9 +1552,7 @@ class StandardTestSuite extends TestSuite {
Runtime.dartPrecompiled,
Runtime.vm,
Runtime.drt,
Runtime.dartium,
Runtime.contentShellOnAndroid,
Runtime.dartiumOnAndroid
Runtime.contentShellOnAndroid
];
var needsVmOptions = compilers.contains(configuration.compiler) &&
@ -1776,6 +1675,8 @@ class DartcCompilationTestSuite extends StandardTestSuite {
}
}
// TODO(rnystrom): Merge with DartcCompilationTestSuite since that class isn't
// used for anything but this now.
class AnalyzeLibraryTestSuite extends DartcCompilationTestSuite {
static String libraryPath(Configuration configuration) =>
configuration.useSdk ? '${configuration.buildDirectory}/dart-sdk' : 'sdk';