[gardening] Fix env_test/has_mirror_support.
Fix the test so it reports that mirrors are not supported in aot configuration. Fixes https://github.com/dart-lang/sdk/issues/48125 Change-Id: I07fceebf8cbee8048988c8bd5287c8aec1bb8f0e Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/227582 Reviewed-by: Lasse Nielsen <lrn@google.com> Reviewed-by: Sigmund Cherem <sigmund@google.com> Commit-Queue: Alexander Aprelev <aam@google.com>
This commit is contained in:
committed by
Commit Bot
parent
38f013d4d7
commit
b453c6bcba
@@ -0,0 +1,33 @@
|
||||
// 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.
|
||||
|
||||
/// Access to the runner configuration this test is running in.
|
||||
///
|
||||
/// Provides queries against and properties of the current configuration
|
||||
/// that a test is being compiled and executed in.
|
||||
///
|
||||
/// This library is separate from `expect.dart` because it uses
|
||||
/// `fromEnvironment` constants that cannot be precompiled,
|
||||
/// and we precompile `expect.dart`.
|
||||
|
||||
library expect_config;
|
||||
|
||||
import 'package:smith/smith.dart';
|
||||
|
||||
final Configuration _configuration = Configuration.parse(
|
||||
const String.fromEnvironment("test_runner.configuration"),
|
||||
<String, dynamic>{});
|
||||
|
||||
bool get isDart2jsConfiguration {
|
||||
return _configuration.compiler == Compiler.dart2js;
|
||||
}
|
||||
|
||||
bool get isDdcConfiguration {
|
||||
return _configuration.compiler == Compiler.dartdevk ||
|
||||
_configuration.compiler == Compiler.dartdevc;
|
||||
}
|
||||
|
||||
bool get isVmAotConfiguration {
|
||||
return _configuration.compiler == Compiler.dartkp;
|
||||
}
|
||||
@@ -13,7 +13,10 @@ environment:
|
||||
|
||||
dependencies:
|
||||
meta: any
|
||||
smith: any
|
||||
|
||||
dependency_overrides:
|
||||
meta:
|
||||
path: ../meta
|
||||
smith:
|
||||
path: ../smith
|
||||
|
||||
@@ -252,6 +252,7 @@ _detectCyclesAndRemoveUnreachable(Map<String, Module> modules, Module main) {
|
||||
/// Default entries for a .packages file with paths relative to the SDK root.
|
||||
List<int> _defaultPackagesInput = utf8.encode('''
|
||||
expect:pkg/expect/lib
|
||||
smith:pkg/smith/lib
|
||||
async_helper:pkg/async_helper/lib
|
||||
meta:pkg/meta/lib
|
||||
collection:third_party/pkg/collection/lib
|
||||
@@ -264,7 +265,8 @@ collection:third_party/pkg/collection/lib
|
||||
// import graph, or adding tests that validate this is always up to date.
|
||||
String _defaultPackagesSpec = '''
|
||||
dependencies:
|
||||
expect: meta
|
||||
expect: [meta, smith]
|
||||
smith: []
|
||||
meta: []
|
||||
async_helper: []
|
||||
collection: []
|
||||
|
||||
@@ -4,7 +4,8 @@ expect
|
||||
is package? yes
|
||||
is shared? yes
|
||||
is sdk? no
|
||||
dependencies: meta, sdk
|
||||
dependencies: meta, smith, sdk
|
||||
lib/config.dart
|
||||
lib/expect.dart
|
||||
lib/minitest.dart
|
||||
|
||||
@@ -31,3 +32,13 @@ sdk
|
||||
is sdk? yes
|
||||
(no dependencies)
|
||||
(sdk sources omitted)
|
||||
|
||||
smith
|
||||
is package? yes
|
||||
is shared? yes
|
||||
is sdk? no
|
||||
dependencies: sdk
|
||||
lib/builder.dart
|
||||
lib/configuration.dart
|
||||
lib/smith.dart
|
||||
lib/test_matrix.dart
|
||||
|
||||
@@ -4,7 +4,8 @@ expect
|
||||
is package? yes
|
||||
is shared? yes
|
||||
is sdk? no
|
||||
dependencies: meta, sdk
|
||||
dependencies: meta, smith, sdk
|
||||
lib/config.dart
|
||||
lib/expect.dart
|
||||
lib/minitest.dart
|
||||
|
||||
@@ -40,3 +41,13 @@ sdk
|
||||
is sdk? yes
|
||||
(no dependencies)
|
||||
(sdk sources omitted)
|
||||
|
||||
smith
|
||||
is package? yes
|
||||
is shared? yes
|
||||
is sdk? no
|
||||
dependencies: sdk
|
||||
lib/builder.dart
|
||||
lib/configuration.dart
|
||||
lib/smith.dart
|
||||
lib/test_matrix.dart
|
||||
|
||||
@@ -778,7 +778,10 @@ has been specified on the command line.''',
|
||||
data['test_server_cross_origin_port'] as int,
|
||||
testDriverErrorPort: data["test_driver_error_port"] as int,
|
||||
localIP: data["local_ip"] as String,
|
||||
sharedOptions: sharedOptions,
|
||||
sharedOptions: <String>[
|
||||
...sharedOptions,
|
||||
"-Dtest_runner.configuration=${innerConfiguration.name}"
|
||||
],
|
||||
packages: data["packages"] as String,
|
||||
serviceResponseSizesDirectory:
|
||||
data['service_response_sizes_directory'] as String,
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
// BSD-style license that can be found in the LICENSE file.
|
||||
|
||||
import 'package:expect/expect.dart';
|
||||
import 'package:expect/config.dart';
|
||||
|
||||
main() {
|
||||
const NOT_PRESENT = false;
|
||||
@@ -61,18 +62,12 @@ main() {
|
||||
const bool.fromEnvironment("dart.library.io", defaultValue: false));
|
||||
}
|
||||
|
||||
bool? hasMirrorSupport;
|
||||
hasMirrorSupport = true; //# has_mirror_support: ok
|
||||
hasMirrorSupport = false; //# has_no_mirror_support: ok
|
||||
|
||||
if (hasMirrorSupport != null) {
|
||||
bool expectedResult = hasMirrorSupport ? true : NOT_PRESENT;
|
||||
|
||||
Expect.equals(
|
||||
expectedResult,
|
||||
const bool.fromEnvironment("dart.library.mirrors",
|
||||
defaultValue: NOT_PRESENT));
|
||||
}
|
||||
bool hasMirrorSupport = !isDart2jsConfiguration &&
|
||||
!isDdcConfiguration && !isVmAotConfiguration;
|
||||
Expect.equals(
|
||||
hasMirrorSupport,
|
||||
const bool.fromEnvironment("dart.library.mirrors",
|
||||
defaultValue: NOT_PRESENT));
|
||||
|
||||
Expect.equals(
|
||||
NOT_PRESENT,
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
// @dart = 2.9
|
||||
|
||||
import 'package:expect/expect.dart';
|
||||
import 'package:expect/config.dart';
|
||||
|
||||
main() {
|
||||
const NOT_PRESENT = false;
|
||||
@@ -63,18 +64,12 @@ main() {
|
||||
const bool.fromEnvironment("dart.library.io", defaultValue: false));
|
||||
}
|
||||
|
||||
bool hasMirrorSupport;
|
||||
hasMirrorSupport = true; //# has_mirror_support: ok
|
||||
hasMirrorSupport = false; //# has_no_mirror_support: ok
|
||||
|
||||
if (hasMirrorSupport != null) {
|
||||
bool expectedResult = hasMirrorSupport ? true : NOT_PRESENT;
|
||||
|
||||
Expect.equals(
|
||||
expectedResult,
|
||||
const bool.fromEnvironment("dart.library.mirrors",
|
||||
defaultValue: NOT_PRESENT));
|
||||
}
|
||||
bool hasMirrorSupport = !isDart2jsConfiguration &&
|
||||
!isDdcConfiguration && !isVmAotConfiguration;
|
||||
Expect.equals(
|
||||
hasMirrorSupport,
|
||||
const bool.fromEnvironment("dart.library.mirrors",
|
||||
defaultValue: NOT_PRESENT));
|
||||
|
||||
Expect.equals(
|
||||
NOT_PRESENT,
|
||||
|
||||
Reference in New Issue
Block a user