mirror of
https://github.com/dart-lang/sdk
synced 2024-07-20 18:05:01 +00:00
[ddc] Add configuration to compile with asserts
- Assertions are enabled in the compiler itself. DDC already enables assertions in the test code by default. - Runs tests in d8. Change-Id: Ibdf285d9ab182c3859f4724b4c0740579d6d2377 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/349361 Reviewed-by: Sigmund Cherem <sigmund@google.com> Commit-Queue: William Hesse <whesse@google.com>
This commit is contained in:
parent
671f271f58
commit
5532568778
|
@ -19,6 +19,9 @@ void main() {
|
||||||
"enable-asserts": true
|
"enable-asserts": true
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
"ddc-hostasserts-linux-d8": {
|
||||||
|
"options": {"host-asserts": true, "use-sdk": false}
|
||||||
|
},
|
||||||
},
|
},
|
||||||
"builder_configurations": [],
|
"builder_configurations": [],
|
||||||
});
|
});
|
||||||
|
@ -33,6 +36,11 @@ void main() {
|
||||||
equals(Configuration("x64-ddc-vm-linux", Architecture.x64,
|
equals(Configuration("x64-ddc-vm-linux", Architecture.x64,
|
||||||
Compiler.ddc, Mode.release, Runtime.vm, System.linux,
|
Compiler.ddc, Mode.release, Runtime.vm, System.linux,
|
||||||
enableAsserts: true)));
|
enableAsserts: true)));
|
||||||
|
expect(
|
||||||
|
testMatrix.configurations[2],
|
||||||
|
equals(Configuration("ddc-hostasserts-linux-d8", Architecture.x64,
|
||||||
|
Compiler.ddc, Mode.release, Runtime.d8, System.linux,
|
||||||
|
enableHostAsserts: true)));
|
||||||
});
|
});
|
||||||
|
|
||||||
test("error if expanded configuration names collide", () {
|
test("error if expanded configuration names collide", () {
|
||||||
|
|
|
@ -328,6 +328,8 @@ class Dart2jsCompilationCommand extends CompilationCommand {
|
||||||
class DevCompilerCompilationCommand extends CompilationCommand {
|
class DevCompilerCompilationCommand extends CompilationCommand {
|
||||||
final String compilerPath;
|
final String compilerPath;
|
||||||
|
|
||||||
|
final bool enableHostAsserts;
|
||||||
|
|
||||||
DevCompilerCompilationCommand(
|
DevCompilerCompilationCommand(
|
||||||
String outputFile,
|
String outputFile,
|
||||||
List<Uri> bootstrapDependencies,
|
List<Uri> bootstrapDependencies,
|
||||||
|
@ -336,6 +338,7 @@ class DevCompilerCompilationCommand extends CompilationCommand {
|
||||||
Map<String, String> environmentOverrides,
|
Map<String, String> environmentOverrides,
|
||||||
{required this.compilerPath,
|
{required this.compilerPath,
|
||||||
required bool alwaysCompile,
|
required bool alwaysCompile,
|
||||||
|
required this.enableHostAsserts,
|
||||||
String? workingDirectory,
|
String? workingDirectory,
|
||||||
int index = 0})
|
int index = 0})
|
||||||
: super("ddc", outputFile, bootstrapDependencies, executable, arguments,
|
: super("ddc", outputFile, bootstrapDependencies, executable, arguments,
|
||||||
|
@ -350,6 +353,7 @@ class DevCompilerCompilationCommand extends CompilationCommand {
|
||||||
executable, arguments, environmentOverrides,
|
executable, arguments, environmentOverrides,
|
||||||
compilerPath: compilerPath,
|
compilerPath: compilerPath,
|
||||||
alwaysCompile: _alwaysCompile,
|
alwaysCompile: _alwaysCompile,
|
||||||
|
enableHostAsserts: enableHostAsserts,
|
||||||
workingDirectory: workingDirectory,
|
workingDirectory: workingDirectory,
|
||||||
index: index);
|
index: index);
|
||||||
|
|
||||||
|
@ -364,6 +368,7 @@ class DevCompilerCompilationCommand extends CompilationCommand {
|
||||||
@override
|
@override
|
||||||
List<String> get batchArguments {
|
List<String> get batchArguments {
|
||||||
return <String>[
|
return <String>[
|
||||||
|
if (enableHostAsserts) '--enable-asserts',
|
||||||
compilerPath,
|
compilerPath,
|
||||||
...super.batchArguments,
|
...super.batchArguments,
|
||||||
];
|
];
|
||||||
|
@ -372,6 +377,7 @@ class DevCompilerCompilationCommand extends CompilationCommand {
|
||||||
@override
|
@override
|
||||||
List<String> get nonBatchArguments {
|
List<String> get nonBatchArguments {
|
||||||
return <String>[
|
return <String>[
|
||||||
|
if (enableHostAsserts) '--enable-asserts',
|
||||||
compilerPath,
|
compilerPath,
|
||||||
...super.nonBatchArguments,
|
...super.nonBatchArguments,
|
||||||
];
|
];
|
||||||
|
|
|
@ -649,6 +649,13 @@ class DevCompilerConfiguration extends CompilerConfiguration {
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String computeCompilerPath() {
|
String computeCompilerPath() {
|
||||||
|
if (_enableHostAsserts && _useSdk) {
|
||||||
|
// When [_useSdk] is true, ddc is compiled into a snapshot that was
|
||||||
|
// built without assertions enabled. The VM cannot make such snapshot run
|
||||||
|
// with assertions later. These two flags could be used together if we
|
||||||
|
// also build sdk snapshots with assertions enabled.
|
||||||
|
throw "--host-asserts and --use-sdk cannot be used together";
|
||||||
|
}
|
||||||
// DDC is a Dart program and not an executable itself, so the command to
|
// DDC is a Dart program and not an executable itself, so the command to
|
||||||
// spawn as a subprocess is a Dart VM.
|
// spawn as a subprocess is a Dart VM.
|
||||||
// Internally the [DevCompilerCompilationCommand] will prepend the snapshot
|
// Internally the [DevCompilerCompilationCommand] will prepend the snapshot
|
||||||
|
@ -734,12 +741,14 @@ class DevCompilerConfiguration extends CompilerConfiguration {
|
||||||
args.add("$summary=$package");
|
args.add("$summary=$package");
|
||||||
}
|
}
|
||||||
|
|
||||||
var compilerPath = _useSdk
|
var compilerPath = _useSdk && !_enableHostAsserts
|
||||||
? '${_configuration.buildDirectory}/dart-sdk/bin/snapshots/dartdevc.dart.snapshot'
|
? '${_configuration.buildDirectory}/dart-sdk/bin/snapshots/dartdevc.dart.snapshot'
|
||||||
: Repository.uri.resolve('pkg/dev_compiler/bin/dartdevc.dart').path;
|
: Repository.uri.resolve('pkg/dev_compiler/bin/dartdevc.dart').path;
|
||||||
var command = DevCompilerCompilationCommand(outputFile,
|
var command = DevCompilerCompilationCommand(outputFile,
|
||||||
bootstrapDependencies(), computeCompilerPath(), args, environment,
|
bootstrapDependencies(), computeCompilerPath(), args, environment,
|
||||||
compilerPath: compilerPath, alwaysCompile: false);
|
compilerPath: compilerPath,
|
||||||
|
alwaysCompile: false,
|
||||||
|
enableHostAsserts: _enableHostAsserts);
|
||||||
if (_configuration.rr) {
|
if (_configuration.rr) {
|
||||||
return RRCommand(command);
|
return RRCommand(command);
|
||||||
}
|
}
|
||||||
|
@ -784,11 +793,16 @@ class DevCompilerConfiguration extends CompilerConfiguration {
|
||||||
var pkgJsDir = Uri.directory(_configuration.buildDirectory)
|
var pkgJsDir = Uri.directory(_configuration.buildDirectory)
|
||||||
.resolve('$buildOptionsDir/pkg/ddc');
|
.resolve('$buildOptionsDir/pkg/ddc');
|
||||||
var sdkJsPath = 'dart_sdk.js';
|
var sdkJsPath = 'dart_sdk.js';
|
||||||
|
// Approximate the renaming done to identifiers in `pathToJSIdentifier()`
|
||||||
|
// from pkg/dev_compiler/lib/src/compiler/js_names.dart to handle the
|
||||||
|
// invalid library names from test files encountered so far.
|
||||||
var libraryName = inputUri.path
|
var libraryName = inputUri.path
|
||||||
.substring(repositoryUri.path.length)
|
.substring(repositoryUri.path.length)
|
||||||
.replaceAll("/", "__")
|
.replaceAll('/', '__')
|
||||||
.replaceAll("-", "_")
|
.replaceAll('-', '_')
|
||||||
.replaceAll(".dart", "");
|
.replaceAll('.dart', '')
|
||||||
|
.replaceAllMapped(RegExp(r'[^A-Za-z_$0-9]'),
|
||||||
|
(Match m) => '\$${m[0]!.codeUnits.join('')}');
|
||||||
var testPackageLoadStatements = [
|
var testPackageLoadStatements = [
|
||||||
for (var package in testPackages) 'load("$pkgJsDir/$package.js");'
|
for (var package in testPackages) 'load("$pkgJsDir/$package.js");'
|
||||||
].join('\n');
|
].join('\n');
|
||||||
|
|
|
@ -99,3 +99,6 @@ LibTest/typed_data/Uint64List/*: SkipByDesign # Uint64List not supported on the
|
||||||
|
|
||||||
[ $compiler == ddc && $runtime == chrome ]
|
[ $compiler == ddc && $runtime == chrome ]
|
||||||
LibTest/html/Window/animationFrame_A01_t01: SkipByDesign # Issue #53985: requestAnimationFrame is not executed on Chrome inactive tabs
|
LibTest/html/Window/animationFrame_A01_t01: SkipByDesign # Issue #53985: requestAnimationFrame is not executed on Chrome inactive tabs
|
||||||
|
|
||||||
|
[ $compiler == ddc && $runtime == d8 ]
|
||||||
|
LibTest/html/*: SkipByDesign # Browser tests
|
||||||
|
|
|
@ -34,6 +34,9 @@ html/js_dispatch_property_test: Skip # Timeout Issue 31030
|
||||||
html/request_animation_frame_test: SkipByDesign # Issue #53985: requestAnimationFrame is not executed on Chrome inactive tabs
|
html/request_animation_frame_test: SkipByDesign # Issue #53985: requestAnimationFrame is not executed on Chrome inactive tabs
|
||||||
html/transition_event_test: SkipByDesign # Issue #53985: css transitions are not executed on Chrome inactive tabs
|
html/transition_event_test: SkipByDesign # Issue #53985: css transitions are not executed on Chrome inactive tabs
|
||||||
|
|
||||||
|
[ $compiler == ddc && $runtime == d8 ]
|
||||||
|
html/*: SkipByDesign # Browser tests
|
||||||
|
|
||||||
[ $compiler == ddc && $runtime == ff ]
|
[ $compiler == ddc && $runtime == ff ]
|
||||||
html/mediadevices_test: SkipByDesign # Not supported on FF, likely requires user-interaction that causes timeout
|
html/mediadevices_test: SkipByDesign # Not supported on FF, likely requires user-interaction that causes timeout
|
||||||
|
|
||||||
|
|
|
@ -15,6 +15,7 @@ wasm/*: SkipByDesign
|
||||||
|
|
||||||
[ $compiler == ddc ]
|
[ $compiler == ddc ]
|
||||||
async_stacktrace_test: Skip # Issue 53555
|
async_stacktrace_test: Skip # Issue 53555
|
||||||
|
native/*: Skip # dart2js tests for native keyword
|
||||||
|
|
||||||
[ $runtime == jsshell ]
|
[ $runtime == jsshell ]
|
||||||
deferred/load_in_correct_order_test: SkipByDesign # jsshell preamble does not support this test.
|
deferred/load_in_correct_order_test: SkipByDesign # jsshell preamble does not support this test.
|
||||||
|
|
|
@ -47,6 +47,8 @@
|
||||||
"out/ReleaseX64/dart",
|
"out/ReleaseX64/dart",
|
||||||
"out/ReleaseX64/dart2js_platform.dill",
|
"out/ReleaseX64/dart2js_platform.dill",
|
||||||
"out/ReleaseX64/dart2js_platform_unsound.dill",
|
"out/ReleaseX64/dart2js_platform_unsound.dill",
|
||||||
|
"out/ReleaseX64/ddc_outline.dill",
|
||||||
|
"out/ReleaseX64/gen/utils/ddc/",
|
||||||
"pkg/",
|
"pkg/",
|
||||||
"runtime/tests/",
|
"runtime/tests/",
|
||||||
"sdk/",
|
"sdk/",
|
||||||
|
@ -608,6 +610,13 @@
|
||||||
"use-sdk": true
|
"use-sdk": true
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"ddc-hostasserts-linux-d8": {
|
||||||
|
"options": {
|
||||||
|
"checked": true,
|
||||||
|
"host-asserts": true,
|
||||||
|
"use-sdk": false
|
||||||
|
}
|
||||||
|
},
|
||||||
"cfe-weak-(linux|mac|win)": {
|
"cfe-weak-(linux|mac|win)": {
|
||||||
"options": {
|
"options": {
|
||||||
"compiler": "fasta"
|
"compiler": "fasta"
|
||||||
|
@ -2091,6 +2100,38 @@
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"builders": [
|
||||||
|
"ddc-hostasserts-linux-d8"
|
||||||
|
],
|
||||||
|
"meta": {
|
||||||
|
"description": "DDC with assertions during compilation running in d8"
|
||||||
|
},
|
||||||
|
"steps": [
|
||||||
|
{
|
||||||
|
"name": "build dart",
|
||||||
|
"script": "tools/build.py",
|
||||||
|
"arguments": [
|
||||||
|
"dart2js_bot",
|
||||||
|
"ddc_stable_test"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "ddc sdk tests",
|
||||||
|
"arguments": [
|
||||||
|
"-nddc-hostasserts-linux-d8",
|
||||||
|
"co19",
|
||||||
|
"corelib",
|
||||||
|
"dartdevc",
|
||||||
|
"language",
|
||||||
|
"lib",
|
||||||
|
"web"
|
||||||
|
],
|
||||||
|
"shards": 12,
|
||||||
|
"fileset": "js_platform_hostasserts"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"builders": [
|
"builders": [
|
||||||
"vm-eager-optimization-linux-release-ia32",
|
"vm-eager-optimization-linux-release-ia32",
|
||||||
|
|
Loading…
Reference in a new issue