From d14ab0779ac4da69a1b39303942172fc0a12983e Mon Sep 17 00:00:00 2001 From: Joshua Litt Date: Wed, 17 Jun 2020 18:14:00 +0000 Subject: [PATCH] [dartdevc] Migrate tests/compiler/dartdevc_native to tests/dartdevc_2. Change-Id: I9c486f29f3bcf8a6ecf481eb25ea61d0468049b2 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/150667 Commit-Queue: Joshua Litt Reviewed-by: Nicholas Shahan --- WATCHLISTS | 2 +- pkg/dev_compiler/lib/src/kernel/target.dart | 2 +- .../lib/src/test_configurations.dart | 3 +- .../hot_restart_late_test.dart | 0 .../nnbd_basic_assignment_test.dart | 0 .../nnbd_js_interop_test.dart | 0 .../nnbd_strong_subtype_test.dart | 0 .../nnbd_type_normalization_test.dart | 0 .../nnbd_weak_subtype_test.dart | 0 .../runtime_utils.dart | 0 .../runtime_utils_nnbd.dart | 0 .../assertion_failure_message_test.dart | 0 .../const_test.dart | 0 .../dartdevc_native_dartdevc.status | 0 .../debugger/debugger_test.dart | 4 +- .../debugger/debugger_test_golden.txt | 0 .../hot_restart_lazy_test.dart | 0 .../hot_restart_test.dart | 0 .../hot_restart_timer_test.dart | 0 .../js_interop_test.dart | 0 .../libraries_part.dart | 0 .../libraries_test.dart | 0 .../no_such_method_errors_test.dart | 0 tests/dartdevc_2/runtime_utils.dart | 51 +++++++++++++++++++ .../subtype_test.dart | 0 .../dartdevc_native => dartdevc_2}/utils.dart | 0 .../variance_subtype_test.dart | 0 .../variance_test.dart | 0 tools/bots/test_matrix.json | 24 +++++---- 29 files changed, 70 insertions(+), 16 deletions(-) rename tests/{compiler/dartdevc_native => dartdevc}/hot_restart_late_test.dart (100%) rename tests/{compiler/dartdevc_native => dartdevc}/nnbd_basic_assignment_test.dart (100%) rename tests/{compiler/dartdevc_native => dartdevc}/nnbd_js_interop_test.dart (100%) rename tests/{compiler/dartdevc_native => dartdevc}/nnbd_strong_subtype_test.dart (100%) rename tests/{compiler/dartdevc_native => dartdevc}/nnbd_type_normalization_test.dart (100%) rename tests/{compiler/dartdevc_native => dartdevc}/nnbd_weak_subtype_test.dart (100%) rename tests/{compiler/dartdevc_native => dartdevc}/runtime_utils.dart (100%) rename tests/{compiler/dartdevc_native => dartdevc}/runtime_utils_nnbd.dart (100%) rename tests/{compiler/dartdevc_native => dartdevc_2}/assertion_failure_message_test.dart (100%) rename tests/{compiler/dartdevc_native => dartdevc_2}/const_test.dart (100%) rename tests/{compiler/dartdevc_native => dartdevc_2}/dartdevc_native_dartdevc.status (100%) rename tests/{compiler/dartdevc_native => dartdevc_2}/debugger/debugger_test.dart (98%) rename tests/{compiler/dartdevc_native => dartdevc_2}/debugger/debugger_test_golden.txt (100%) rename tests/{compiler/dartdevc_native => dartdevc_2}/hot_restart_lazy_test.dart (100%) rename tests/{compiler/dartdevc_native => dartdevc_2}/hot_restart_test.dart (100%) rename tests/{compiler/dartdevc_native => dartdevc_2}/hot_restart_timer_test.dart (100%) rename tests/{compiler/dartdevc_native => dartdevc_2}/js_interop_test.dart (100%) rename tests/{compiler/dartdevc_native => dartdevc_2}/libraries_part.dart (100%) rename tests/{compiler/dartdevc_native => dartdevc_2}/libraries_test.dart (100%) rename tests/{compiler/dartdevc_native => dartdevc_2}/no_such_method_errors_test.dart (100%) create mode 100644 tests/dartdevc_2/runtime_utils.dart rename tests/{compiler/dartdevc_native => dartdevc_2}/subtype_test.dart (100%) rename tests/{compiler/dartdevc_native => dartdevc_2}/utils.dart (100%) rename tests/{compiler/dartdevc_native => dartdevc_2}/variance_subtype_test.dart (100%) rename tests/{compiler/dartdevc_native => dartdevc_2}/variance_test.dart (100%) diff --git a/WATCHLISTS b/WATCHLISTS index c4e7dea4c8f..a07b66516f7 100644 --- a/WATCHLISTS +++ b/WATCHLISTS @@ -35,7 +35,7 @@ 'filepath': ( '^pkg/dev_compiler|' '^sdk/lib/_internal/js_dev_runtime|' - '^tests/compiler/dartdevc_native' + '^tests/dartdevc' ) }, 'package_vm': { diff --git a/pkg/dev_compiler/lib/src/kernel/target.dart b/pkg/dev_compiler/lib/src/kernel/target.dart index 8d3c11b8527..6d31716c666 100644 --- a/pkg/dev_compiler/lib/src/kernel/target.dart +++ b/pkg/dev_compiler/lib/src/kernel/target.dart @@ -107,7 +107,7 @@ class DevCompilerTarget extends Target { if (uri.scheme == 'dev-dart-app') return true; var scriptName = uri.path; - return scriptName.contains('tests/compiler/dartdevc_native'); + return scriptName.contains('tests/dartdevc'); } bool _allowedDartLibrary(Uri uri) => uri.scheme == 'dart'; diff --git a/pkg/test_runner/lib/src/test_configurations.dart b/pkg/test_runner/lib/src/test_configurations.dart index 8bfdced6d21..9e0d5a12ba4 100644 --- a/pkg/test_runner/lib/src/test_configurations.dart +++ b/pkg/test_runner/lib/src/test_configurations.dart @@ -32,11 +32,12 @@ final testSuiteDirectories = [ Path('runtime/observatory/tests/observatory_ui'), Path('samples'), Path('samples-dev'), - Path('tests/compiler/dartdevc_native'), Path('tests/corelib'), Path('tests/corelib_2'), Path('tests/dart2js'), Path('tests/dart2js_2'), + Path('tests/dartdevc'), + Path('tests/dartdevc_2'), Path('tests/kernel'), Path('tests/language'), Path('tests/language_2'), diff --git a/tests/compiler/dartdevc_native/hot_restart_late_test.dart b/tests/dartdevc/hot_restart_late_test.dart similarity index 100% rename from tests/compiler/dartdevc_native/hot_restart_late_test.dart rename to tests/dartdevc/hot_restart_late_test.dart diff --git a/tests/compiler/dartdevc_native/nnbd_basic_assignment_test.dart b/tests/dartdevc/nnbd_basic_assignment_test.dart similarity index 100% rename from tests/compiler/dartdevc_native/nnbd_basic_assignment_test.dart rename to tests/dartdevc/nnbd_basic_assignment_test.dart diff --git a/tests/compiler/dartdevc_native/nnbd_js_interop_test.dart b/tests/dartdevc/nnbd_js_interop_test.dart similarity index 100% rename from tests/compiler/dartdevc_native/nnbd_js_interop_test.dart rename to tests/dartdevc/nnbd_js_interop_test.dart diff --git a/tests/compiler/dartdevc_native/nnbd_strong_subtype_test.dart b/tests/dartdevc/nnbd_strong_subtype_test.dart similarity index 100% rename from tests/compiler/dartdevc_native/nnbd_strong_subtype_test.dart rename to tests/dartdevc/nnbd_strong_subtype_test.dart diff --git a/tests/compiler/dartdevc_native/nnbd_type_normalization_test.dart b/tests/dartdevc/nnbd_type_normalization_test.dart similarity index 100% rename from tests/compiler/dartdevc_native/nnbd_type_normalization_test.dart rename to tests/dartdevc/nnbd_type_normalization_test.dart diff --git a/tests/compiler/dartdevc_native/nnbd_weak_subtype_test.dart b/tests/dartdevc/nnbd_weak_subtype_test.dart similarity index 100% rename from tests/compiler/dartdevc_native/nnbd_weak_subtype_test.dart rename to tests/dartdevc/nnbd_weak_subtype_test.dart diff --git a/tests/compiler/dartdevc_native/runtime_utils.dart b/tests/dartdevc/runtime_utils.dart similarity index 100% rename from tests/compiler/dartdevc_native/runtime_utils.dart rename to tests/dartdevc/runtime_utils.dart diff --git a/tests/compiler/dartdevc_native/runtime_utils_nnbd.dart b/tests/dartdevc/runtime_utils_nnbd.dart similarity index 100% rename from tests/compiler/dartdevc_native/runtime_utils_nnbd.dart rename to tests/dartdevc/runtime_utils_nnbd.dart diff --git a/tests/compiler/dartdevc_native/assertion_failure_message_test.dart b/tests/dartdevc_2/assertion_failure_message_test.dart similarity index 100% rename from tests/compiler/dartdevc_native/assertion_failure_message_test.dart rename to tests/dartdevc_2/assertion_failure_message_test.dart diff --git a/tests/compiler/dartdevc_native/const_test.dart b/tests/dartdevc_2/const_test.dart similarity index 100% rename from tests/compiler/dartdevc_native/const_test.dart rename to tests/dartdevc_2/const_test.dart diff --git a/tests/compiler/dartdevc_native/dartdevc_native_dartdevc.status b/tests/dartdevc_2/dartdevc_native_dartdevc.status similarity index 100% rename from tests/compiler/dartdevc_native/dartdevc_native_dartdevc.status rename to tests/dartdevc_2/dartdevc_native_dartdevc.status diff --git a/tests/compiler/dartdevc_native/debugger/debugger_test.dart b/tests/dartdevc_2/debugger/debugger_test.dart similarity index 98% rename from tests/compiler/dartdevc_native/debugger/debugger_test.dart rename to tests/dartdevc_2/debugger/debugger_test.dart index e02bd5349f7..94d4a63a8cd 100644 --- a/tests/compiler/dartdevc_native/debugger/debugger_test.dart +++ b/tests/dartdevc_2/debugger/debugger_test.dart @@ -129,7 +129,7 @@ main() async { // Cache blocker is a workaround for: // https://code.google.com/p/dart/issues/detail?id=11834 var cacheBlocker = new DateTime.now().millisecondsSinceEpoch; - var goldenUrl = '/root_dart/tests/compiler/dartdevc_native/debugger/' + var goldenUrl = '/root_dart/tests/dartdevc_2/debugger/' 'debugger_test_golden.txt?cacheBlock=$cacheBlocker'; String golden; @@ -326,7 +326,7 @@ window.ExampleJSClass = function ExampleJSClass(x) { if (actualStr != golden) { var helpMessage = 'Debugger output does not match the golden data found in:\n' - 'tests/compiler/dartdevc_native/debugger/debugger_test_golden.txt\n' + 'tests/dartdevc_2/debugger/debugger_test_golden.txt\n' 'The new golden data is copied to the clipboard when you click on ' 'this window.\n' 'Please update the golden file with the following output and review ' diff --git a/tests/compiler/dartdevc_native/debugger/debugger_test_golden.txt b/tests/dartdevc_2/debugger/debugger_test_golden.txt similarity index 100% rename from tests/compiler/dartdevc_native/debugger/debugger_test_golden.txt rename to tests/dartdevc_2/debugger/debugger_test_golden.txt diff --git a/tests/compiler/dartdevc_native/hot_restart_lazy_test.dart b/tests/dartdevc_2/hot_restart_lazy_test.dart similarity index 100% rename from tests/compiler/dartdevc_native/hot_restart_lazy_test.dart rename to tests/dartdevc_2/hot_restart_lazy_test.dart diff --git a/tests/compiler/dartdevc_native/hot_restart_test.dart b/tests/dartdevc_2/hot_restart_test.dart similarity index 100% rename from tests/compiler/dartdevc_native/hot_restart_test.dart rename to tests/dartdevc_2/hot_restart_test.dart diff --git a/tests/compiler/dartdevc_native/hot_restart_timer_test.dart b/tests/dartdevc_2/hot_restart_timer_test.dart similarity index 100% rename from tests/compiler/dartdevc_native/hot_restart_timer_test.dart rename to tests/dartdevc_2/hot_restart_timer_test.dart diff --git a/tests/compiler/dartdevc_native/js_interop_test.dart b/tests/dartdevc_2/js_interop_test.dart similarity index 100% rename from tests/compiler/dartdevc_native/js_interop_test.dart rename to tests/dartdevc_2/js_interop_test.dart diff --git a/tests/compiler/dartdevc_native/libraries_part.dart b/tests/dartdevc_2/libraries_part.dart similarity index 100% rename from tests/compiler/dartdevc_native/libraries_part.dart rename to tests/dartdevc_2/libraries_part.dart diff --git a/tests/compiler/dartdevc_native/libraries_test.dart b/tests/dartdevc_2/libraries_test.dart similarity index 100% rename from tests/compiler/dartdevc_native/libraries_test.dart rename to tests/dartdevc_2/libraries_test.dart diff --git a/tests/compiler/dartdevc_native/no_such_method_errors_test.dart b/tests/dartdevc_2/no_such_method_errors_test.dart similarity index 100% rename from tests/compiler/dartdevc_native/no_such_method_errors_test.dart rename to tests/dartdevc_2/no_such_method_errors_test.dart diff --git a/tests/dartdevc_2/runtime_utils.dart b/tests/dartdevc_2/runtime_utils.dart new file mode 100644 index 00000000000..5b14053b69d --- /dev/null +++ b/tests/dartdevc_2/runtime_utils.dart @@ -0,0 +1,51 @@ +// Copyright (c) 2019, 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:_runtime' show gFnType, typeRep, isSubtypeOf; + +import 'package:expect/expect.dart'; + +/// Returns an unwrapped generic function type with a bounded type argument in +/// the form: void -> void. +/// +// TODO(nshahan): The generic function type is created as a legacy type. +genericFunction(bound) => gFnType((T) => [typeRep(), []], (T) => [bound]); + +/// Returns an unwrapped generic function type with a bounded type argument in +/// the form: [argumentType] -> T. +/// +// TODO(nshahan): The generic function type is created as a legacy type. +functionGenericReturn(bound, argumentType) => gFnType( + (T) => [ + T, + [argumentType] + ], + (T) => [bound]); + +/// Returns an unwrapped generic function type with a bounded type argument in +/// the form: T -> [returnType]. +/// +// TODO(nshahan): The generic function type is created as a legacy type. +functionGenericArg(bound, returnType) => gFnType( + (T) => [ + returnType, + [T] + ], + (T) => [bound]); + +void checkSubtype(s, t) => + Expect.isTrue(isSubtypeOf(s, t), '$s should be subtype of $t.'); + +void checkProperSubtype(s, t) { + Expect.isTrue(isSubtypeOf(s, t), '$s should be subtype of $t.'); + checkSubtypeFailure(t, s); +} + +void checkMutualSubtype(Object s, Object t) { + Expect.isTrue(isSubtypeOf(s, t), '$s should be subtype of $t.'); + Expect.isTrue(isSubtypeOf(t, s), '$t should be subtype of $s.'); +} + +void checkSubtypeFailure(s, t) => + Expect.isFalse(isSubtypeOf(s, t), '$s should not be subtype of $t.'); diff --git a/tests/compiler/dartdevc_native/subtype_test.dart b/tests/dartdevc_2/subtype_test.dart similarity index 100% rename from tests/compiler/dartdevc_native/subtype_test.dart rename to tests/dartdevc_2/subtype_test.dart diff --git a/tests/compiler/dartdevc_native/utils.dart b/tests/dartdevc_2/utils.dart similarity index 100% rename from tests/compiler/dartdevc_native/utils.dart rename to tests/dartdevc_2/utils.dart diff --git a/tests/compiler/dartdevc_native/variance_subtype_test.dart b/tests/dartdevc_2/variance_subtype_test.dart similarity index 100% rename from tests/compiler/dartdevc_native/variance_subtype_test.dart rename to tests/dartdevc_2/variance_subtype_test.dart diff --git a/tests/compiler/dartdevc_native/variance_test.dart b/tests/dartdevc_2/variance_test.dart similarity index 100% rename from tests/compiler/dartdevc_native/variance_test.dart rename to tests/dartdevc_2/variance_test.dart diff --git a/tools/bots/test_matrix.json b/tools/bots/test_matrix.json index e27eca17d81..828c326cf48 100644 --- a/tools/bots/test_matrix.json +++ b/tools/bots/test_matrix.json @@ -42,9 +42,9 @@ "tests/co19/co19-dartdevc.status", "tests/co19/co19-kernel.status", "tests/co19/co19-runtime.status", - "tests/compiler/", "tests/corelib_2/", "tests/dart2js_2/", + "tests/dartdevc_2/", "tests/kernel/", "tests/language/", "tests/language_2/", @@ -83,9 +83,9 @@ "tests/co19/co19-dartdevc.status", "tests/co19/co19-kernel.status", "tests/co19/co19-runtime.status", - "tests/compiler/", "tests/corelib/", "tests/dart2js/", + "tests/dartdevc/", "tests/kernel/", "tests/language/", "tests/language_2/", @@ -131,9 +131,9 @@ "tests/co19_2/co19_2-dartdevc.status", "tests/co19_2/co19_2-kernel.status", "tests/co19_2/co19_2-runtime.status", - "tests/compiler/", "tests/corelib_2/", "tests/dart2js_2/", + "tests/dartdevc_2/", "tests/kernel/", "tests/language/", "tests/language_2/", @@ -175,9 +175,9 @@ "tests/co19/co19-dartdevc.status", "tests/co19/co19-kernel.status", "tests/co19/co19-runtime.status", - "tests/compiler/", "tests/corelib/", "tests/dart2js/", + "tests/dartdevc/", "tests/kernel/", "tests/language/", "tests/language_2/", @@ -219,11 +219,12 @@ "tests/co19_2/co19_2-dartdevc.status", "tests/co19_2/co19_2-kernel.status", "tests/co19_2/co19_2-runtime.status", - "tests/compiler/", "tests/corelib/", "tests/corelib_2/", "tests/dart2js/", "tests/dart2js_2/", + "tests/dartdevc/", + "tests/dartdevc_2/", "tests/kernel/", "tests/language/", "tests/language_2/", @@ -328,11 +329,12 @@ "tests/co19_2/co19_2-dartdevc.status", "tests/co19_2/co19_2-kernel.status", "tests/co19_2/co19_2-runtime.status", - "tests/compiler/", "tests/corelib/", "tests/corelib_2/", "tests/dart2js/", "tests/dart2js_2/", + "tests/dartdevc", + "tests/dartdevc_2", "tests/kernel/", "tests/language/", "tests/language_2/", @@ -1924,7 +1926,7 @@ "language_2", "corelib_2", "lib_2", - "dartdevc_native" + "dartdevc_2" ] }, { @@ -2008,7 +2010,7 @@ "language_2", "corelib_2", "lib_2", - "dartdevc_native" + "dartdevc_2" ] } ] @@ -2054,7 +2056,7 @@ "language", "corelib", "lib", - "dartdevc_native" + "dartdevc" ], "shards": 5, "fileset": "web_platform_nnbd" @@ -2075,7 +2077,7 @@ "language", "corelib", "lib", - "dartdevc_native" + "dartdevc" ] }, { @@ -2110,7 +2112,7 @@ "language_2", "corelib_2", "lib_2", - "dartdevc_native" + "dartdevc_2" ] }, {