initial support for running tests against dart analyzer in strong mode (#27033)

This commit is contained in:
Aleksei Semenov 2016-08-09 15:58:15 +07:00 committed by William Hesse
parent 99e94db85b
commit c9081ea4df
5 changed files with 22 additions and 5 deletions

View file

@ -34,6 +34,7 @@ Uri nativeDirectoryToUri(String nativePath) {
abstract class CompilerConfiguration {
final bool isDebug;
final bool isChecked;
final bool isStrong;
final bool isHostChecked;
final bool useSdk;
@ -48,6 +49,7 @@ abstract class CompilerConfiguration {
// object.
bool isDebug = configuration['mode'] == 'debug';
bool isChecked = configuration['checked'];
bool isStrong = configuration['strong'];
bool isHostChecked = configuration['host_checked'];
bool useSdk = configuration['use_sdk'];
bool isCsp = configuration['csp'];
@ -61,6 +63,7 @@ abstract class CompilerConfiguration {
return new AnalyzerCompilerConfiguration(
isDebug: isDebug,
isChecked: isChecked,
isStrong: isStrong,
isHostChecked: isHostChecked,
useSdk: useSdk);
case 'dart2js':
@ -102,6 +105,7 @@ abstract class CompilerConfiguration {
CompilerConfiguration._subclass(
{this.isDebug: false,
this.isChecked: false,
this.isStrong: false,
this.isHostChecked: false,
this.useSdk: false});
@ -604,10 +608,12 @@ class Dart2AppJitSnapshotCompilerConfiguration extends Dart2AppSnapshotCompilerC
class AnalyzerCompilerConfiguration extends CompilerConfiguration {
AnalyzerCompilerConfiguration(
{bool isDebug, bool isChecked, bool isHostChecked, bool useSdk})
{bool isDebug, bool isChecked, bool isStrong, bool isHostChecked, bool
useSdk})
: super._subclass(
isDebug: isDebug,
isChecked: isChecked,
isStrong: isStrong,
isHostChecked: isHostChecked,
useSdk: useSdk);
@ -640,9 +646,12 @@ class AnalyzerCompilerConfiguration extends CompilerConfiguration {
List arguments,
Map<String, String> environmentOverrides) {
arguments = new List.from(arguments);
if (isChecked) {
if (isChecked || isStrong) {
arguments.add('--enable_type_checks');
}
if (isStrong){
arguments.add('--strong');
}
return new CommandArtifact(<Command>[
commandBuilder.getAnalysisCommand('dart2analyzer',
computeCompilerPath(buildDir), arguments, environmentOverrides,

View file

@ -103,6 +103,7 @@ Future testConfigurations(List<Map> configurations) async {
.map((name) => conf[name])
.toList();
if (conf['checked']) settings.add('checked');
if (conf['strong']) settings.add('strong');
if (conf['noopt']) settings.add('noopt');
output_words.add(settings.join('_'));
}

View file

@ -163,6 +163,9 @@ class TestOptionsParser {
new _TestOptionSpecification(
'checked', 'Run tests in checked mode', ['--checked'], [], false,
type: 'bool'),
new _TestOptionSpecification(
'strong', 'Run tests in strong mode', ['--strong'], [], false,
type: 'bool'),
new _TestOptionSpecification('host_checked',
'Run compiler in checked mode', ['--host-checked'], [], false,
type: 'bool'),

View file

@ -255,6 +255,7 @@ class TestOutcomeLogWriter extends EventListener {
'compiler',
'runtime',
'checked',
'strong',
'host_checked',
'minified',
'csp',

View file

@ -377,25 +377,27 @@ abstract class TestSuite {
String createOutputDirectory(Path testPath, String optionsName) {
var checked = configuration['checked'] ? '-checked' : '';
var strong = configuration['strong'] ? '-strong' : '';
var minified = configuration['minified'] ? '-minified' : '';
var sdk = configuration['use_sdk'] ? '-sdk' : '';
var packages =
configuration['use_public_packages'] ? '-public_packages' : '';
var dirName = "${configuration['compiler']}-${configuration['runtime']}"
"$checked$minified$packages$sdk";
"$checked$strong$minified$packages$sdk";
return createGeneratedTestDirectoryHelper(
"tests", dirName, testPath, optionsName);
}
String createCompilationOutputDirectory(Path testPath) {
var checked = configuration['checked'] ? '-checked' : '';
var strong = configuration['strong'] ? '-strong' : '';
var minified = configuration['minified'] ? '-minified' : '';
var csp = configuration['csp'] ? '-csp' : '';
var sdk = configuration['use_sdk'] ? '-sdk' : '';
var packages =
configuration['use_public_packages'] ? '-public_packages' : '';
var dirName = "${configuration['compiler']}"
"$checked$minified$csp$packages$sdk";
"$checked$strong$minified$csp$packages$sdk";
return createGeneratedTestDirectoryHelper(
"compilations", dirName, testPath, "");
}
@ -2211,13 +2213,14 @@ class TestUtils {
configuration['compiler'] == 'dart2appjit' ||
configuration['compiler'] == 'precompiler') {
var checked = configuration['checked'] ? '-checked' : '';
var strong = configuration['strong'] ? '-strong' : '';
var minified = configuration['minified'] ? '-minified' : '';
var csp = configuration['csp'] ? '-csp' : '';
var sdk = configuration['use_sdk'] ? '-sdk' : '';
var packages =
configuration['use_public_packages'] ? '-public_packages' : '';
var dirName = "${configuration['compiler']}"
"$checked$minified$csp$packages$sdk";
"$checked$strong$minified$csp$packages$sdk";
String generatedPath = "${TestUtils.buildDir(configuration)}"
"/generated_compilations/$dirName";
TestUtils.deleteDirectory(generatedPath);