9445b52b45
Test cases in this test could be slow, especially if other tests are running simultaneously. They could run out of 30 second default timeout enforced by package:test for each individual test case. If test hangs, test.py would kill it anyway. Fixes https://github.com/dart-lang/sdk/issues/41489 Change-Id: I16fef1f2a157392f3ff6a695a6ba72fa9ec4da14 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/144004 Reviewed-by: Ben Konyi <bkonyi@google.com> Reviewed-by: Régis Crelier <regis@google.com> Commit-Queue: Alexander Markov <alexmarkov@google.com>
127 lines
3.2 KiB
Dart
127 lines
3.2 KiB
Dart
// Copyright (c) 2018, 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:io';
|
|
|
|
import 'package:front_end/src/api_unstable/vm.dart'
|
|
show computePlatformBinariesLocation;
|
|
import 'package:test/test.dart';
|
|
import 'package:vm/kernel_front_end.dart';
|
|
|
|
final String sdkDir = Platform.script.resolve('../../..').toFilePath();
|
|
|
|
String platformPath() => computePlatformBinariesLocation()
|
|
.resolve('vm_platform_strong.dill')
|
|
.toFilePath();
|
|
|
|
const String mainScript = 'pkg/vm/bin/gen_kernel.dart';
|
|
const String mainScriptPackageUri = 'package:vm/kernel_front_end.dart';
|
|
const String packagesFile = '.packages';
|
|
|
|
void testCompile(List<String> args) async {
|
|
final compilerExitCode =
|
|
await runCompiler(createCompilerArgParser().parse(args), '');
|
|
expect(compilerExitCode, successExitCode);
|
|
}
|
|
|
|
main() {
|
|
Directory tempDir;
|
|
setUp(() {
|
|
var systemTempDir = Directory.systemTemp;
|
|
tempDir = systemTempDir.createTempSync('kernel_front_end_test');
|
|
});
|
|
|
|
tearDown(() {
|
|
tempDir.delete(recursive: true);
|
|
});
|
|
|
|
String outputDill() => new File('${tempDir.path}/foo.dill').path;
|
|
|
|
test('compile-simple', () async {
|
|
await testCompile([
|
|
'--platform',
|
|
platformPath(),
|
|
'--packages',
|
|
'$sdkDir/$packagesFile',
|
|
'--output',
|
|
outputDill(),
|
|
'$sdkDir/$mainScript',
|
|
]);
|
|
}, timeout: Timeout.none);
|
|
|
|
test('compile-multi-root', () async {
|
|
await testCompile([
|
|
'--platform',
|
|
platformPath(),
|
|
'--filesystem-scheme',
|
|
'test-filesystem-scheme',
|
|
'--filesystem-root',
|
|
sdkDir,
|
|
'--packages',
|
|
'test-filesystem-scheme:///$packagesFile',
|
|
'--output',
|
|
outputDill(),
|
|
'test-filesystem-scheme:///$mainScript',
|
|
]);
|
|
}, timeout: Timeout.none);
|
|
|
|
test('compile-multi-root-with-package-uri-main', () async {
|
|
await testCompile([
|
|
'--platform',
|
|
platformPath(),
|
|
'--filesystem-scheme',
|
|
'test-filesystem-scheme',
|
|
'--filesystem-root',
|
|
sdkDir,
|
|
'--packages',
|
|
'test-filesystem-scheme:///$packagesFile',
|
|
'--output',
|
|
outputDill(),
|
|
'$mainScriptPackageUri',
|
|
]);
|
|
}, timeout: Timeout.none);
|
|
|
|
test('compile-package-split', () async {
|
|
await testCompile([
|
|
'--platform',
|
|
platformPath(),
|
|
'--packages',
|
|
'$sdkDir/$packagesFile',
|
|
'--output',
|
|
outputDill(),
|
|
'--split-output-by-packages',
|
|
'$sdkDir/$mainScript',
|
|
]);
|
|
}, timeout: Timeout.none);
|
|
|
|
test('compile-bytecode', () async {
|
|
await testCompile([
|
|
'--platform',
|
|
platformPath(),
|
|
'--packages',
|
|
'$sdkDir/$packagesFile',
|
|
'--output',
|
|
outputDill(),
|
|
'--gen-bytecode',
|
|
'--drop-ast',
|
|
'$sdkDir/$mainScript',
|
|
]);
|
|
}, timeout: Timeout.none);
|
|
|
|
test('compile-bytecode-package-split', () async {
|
|
await testCompile([
|
|
'--platform',
|
|
platformPath(),
|
|
'--packages',
|
|
'$sdkDir/$packagesFile',
|
|
'--output',
|
|
outputDill(),
|
|
'--gen-bytecode',
|
|
'--drop-ast',
|
|
'--split-output-by-packages',
|
|
'$sdkDir/$mainScript',
|
|
]);
|
|
}, timeout: Timeout.none);
|
|
}
|