[vm/testing] Make --strong -c dartk configuration a Dart 2.0 configuration.

Switch it to use pkg/vm/tool/dart2 which is the source of truth for what
Dart 2 VM configuration means. Don't pass any additional flags from
tools/test.py itself.

Align pkg/vm/tool/dart2 with what tools/test.py was passing to VM on _2 suites.

Make default invocation `tools/test.py -c dartk --strong -m release,debug`
green by updating status files and skipping suites that are not Dart 2.0
compliant. I have filed issues #31588 for isolate suite and #31587 for
service suite.

Change-Id: I882b28f6a011eabf69c349ff0792b275434e39ff
Reviewed-on: https://dart-review.googlesource.com/27820
Commit-Queue: Vyacheslav Egorov <vegorov@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
diff --git a/pkg/vm/tool/dart2 b/pkg/vm/tool/dart2
index c5f07b2..d849f5b 100755
--- a/pkg/vm/tool/dart2
+++ b/pkg/vm/tool/dart2
@@ -34,6 +34,7 @@
 exec "$BIN_DIR"/dart                                                           \
      --strong                                                                  \
      --reify-generic-functions                                                 \
+     --limit-ints-to-64-bits                                                   \
      --dfe="${BIN_DIR}/gen/kernel-service.dart.snapshot"                       \
      --kernel-binaries="${BIN_DIR}"                                            \
      "$@"
diff --git a/runtime/observatory/tests/service/service_kernel.status b/runtime/observatory/tests/service/service_kernel.status
index 44dd5d7..584b24f 100644
--- a/runtime/observatory/tests/service/service_kernel.status
+++ b/runtime/observatory/tests/service/service_kernel.status
@@ -35,3 +35,172 @@
 isolate_lifecycle_test: Skip # Flaky.
 pause_idle_isolate_test: Skip # Flaky
 
+[ $compiler == dartk && $mode == debug && $strong ]
+external_service_disappear_test: Crash # Issue 31587
+
+# Issue 31587
+[ $compiler == dartk && $strong ]
+add_breakpoint_rpc_kernel_test: CompileTimeError
+allocations_test: CompileTimeError
+async_next_test: CompileTimeError
+async_scope_test: CompileTimeError
+async_single_step_exception_test: CompileTimeError
+async_single_step_into_test: CompileTimeError
+async_single_step_out_test: CompileTimeError
+async_star_single_step_into_test: CompileTimeError
+async_star_step_out_test: CompileTimeError
+async_step_out_test: CompileTimeError
+auth_token1_test: CompileTimeError
+auth_token_test: CompileTimeError
+awaiter_async_stack_contents_test: CompileTimeError
+bad_web_socket_address_test: CompileTimeError
+break_on_activation_test: CompileTimeError
+break_on_function_test: CompileTimeError
+breakpoint_in_parts_class_test: CompileTimeError
+breakpoint_two_args_checked_test: CompileTimeError
+caching_test: CompileTimeError
+causal_async_stack_contents_test: CompileTimeError
+causal_async_stack_presence_test: CompileTimeError
+causal_async_star_stack_contents_test: CompileTimeError
+causal_async_star_stack_presence_test: CompileTimeError
+code_test: CompileTimeError
+collect_all_garbage_test: CompileTimeError
+command_test: CompileTimeError
+contexts_test: CompileTimeError
+coverage_leaf_function_test: CompileTimeError
+coverage_optimized_function_test: CompileTimeError
+crash_dump_test: CompileTimeError
+debugger_inspect_test: CompileTimeError
+debugger_location_second_test: CompileTimeError
+debugger_location_test: CompileTimeError
+debugging_inlined_finally_test: CompileTimeError
+debugging_test: CompileTimeError
+dev_fs_http_put_test: CompileTimeError
+dev_fs_http_put_weird_char_test: CompileTimeError
+dev_fs_spawn_test: CompileTimeError
+dev_fs_test: CompileTimeError
+dev_fs_uri_test: CompileTimeError
+dev_fs_weird_char_test: CompileTimeError
+developer_server_control_test: CompileTimeError
+developer_service_get_isolate_id_test: CompileTimeError
+dominator_tree_user_test: CompileTimeError
+dominator_tree_vm_test: CompileTimeError
+echo_test: CompileTimeError
+eval_test: CompileTimeError
+external_service_asynchronous_invocation_test: CompileTimeError
+external_service_disappear_test: CompileTimeError
+external_service_notification_invocation_test: CompileTimeError
+external_service_registration_test: CompileTimeError
+external_service_registration_via_notification_test: CompileTimeError
+external_service_synchronous_invocation_test: CompileTimeError
+field_script_test: CompileTimeError
+file_service_test: CompileTimeError
+gc_test: CompileTimeError
+get_allocation_profile_rpc_test: CompileTimeError
+get_allocation_samples_test: CompileTimeError
+get_cpu_profile_timeline_rpc_test: CompileTimeError
+get_flag_list_rpc_test: CompileTimeError
+get_heap_map_rpc_test: CompileTimeError
+get_instances_rpc_test: CompileTimeError
+get_isolate_after_async_error_test: CompileTimeError
+get_isolate_after_stack_overflow_error_test: CompileTimeError
+get_isolate_after_sync_error_test: CompileTimeError
+get_isolate_rpc_test: CompileTimeError
+get_object_rpc_test: CompileTimeError
+get_object_store_rpc_test: CompileTimeError
+get_ports_rpc_test: CompileTimeError
+get_retained_size_rpc_test: CompileTimeError
+get_retaining_path_rpc_test: CompileTimeError
+get_source_report_test: CompileTimeError
+get_stack_rpc_test: CompileTimeError
+get_user_level_retaining_path_rpc_test: CompileTimeError
+get_version_rpc_test: CompileTimeError
+get_vm_rpc_test: CompileTimeError
+get_vm_timeline_rpc_test: CompileTimeError
+get_zone_memory_info_rpc_test: CompileTimeError
+implicit_getter_setter_test: CompileTimeError
+inbound_references_test: CompileTimeError
+instance_field_order_rpc_test: CompileTimeError
+isolate_lifecycle_test: CompileTimeError
+issue_25465_test: CompileTimeError
+issue_27238_test: CompileTimeError
+issue_27287_test: CompileTimeError
+issue_30555_test: CompileTimeError
+local_variable_declaration_test: CompileTimeError
+logging_test: CompileTimeError
+malformed_test: CompileTimeError
+metrics_test: CompileTimeError
+mirror_references_test: CompileTimeError
+mixin_break_test: CompileTimeError
+native_metrics_test: CompileTimeError
+next_through_assign_call_test: CompileTimeError
+next_through_assign_int_test: CompileTimeError
+next_through_call_on_field_in_class_test: CompileTimeError
+next_through_call_on_field_test: CompileTimeError
+next_through_call_on_static_field_in_class_test: CompileTimeError
+next_through_catch_test: CompileTimeError
+next_through_closure_test: CompileTimeError
+next_through_create_list_and_map_test: CompileTimeError
+next_through_for_each_loop_test: CompileTimeError
+next_through_for_loop_with_break_and_continue_test: CompileTimeError
+next_through_function_expression_test: CompileTimeError
+next_through_is_and_as_test: CompileTimeError
+next_through_multi_catch_test: CompileTimeError
+next_through_new_test: CompileTimeError
+next_through_operator_bracket_on_super_test: CompileTimeError
+next_through_operator_bracket_on_this_test: CompileTimeError
+next_through_operator_bracket_test: CompileTimeError
+next_through_simple_async_with_returns_test: CompileTimeError
+next_through_simple_linear_2_test: CompileTimeError
+next_through_simple_linear_test: CompileTimeError
+object_graph_stack_reference_test: CompileTimeError
+object_graph_user_test: CompileTimeError
+object_graph_vm_test: CompileTimeError
+observatory_assets_test: CompileTimeError
+parameters_in_scope_at_entry_test: CompileTimeError
+pause_idle_isolate_test: CompileTimeError
+pause_on_exceptions_test: CompileTimeError
+pause_on_start_and_exit_test: CompileTimeError
+pause_on_start_then_step_test: CompileTimeError
+pause_on_unhandled_async_exceptions2_test: CompileTimeError
+pause_on_unhandled_async_exceptions_test: CompileTimeError
+pause_on_unhandled_exceptions_test: CompileTimeError
+positive_token_pos_test: CompileTimeError
+process_service_test: CompileTimeError
+reachable_size_test: CompileTimeError
+read_stream_test: CompileTimeError
+regexp_function_test: CompileTimeError
+regress_28443_test: CompileTimeError
+regress_28980_test: CompileTimeError
+reload_sources_test: CompileTimeError
+rewind_optimized_out_test: CompileTimeError
+rewind_test: CompileTimeError
+set_library_debuggable_rpc_test: CompileTimeError
+set_library_debuggable_test: CompileTimeError
+set_name_rpc_test: CompileTimeError
+set_vm_name_rpc_test: CompileTimeError
+steal_breakpoint_test: CompileTimeError
+step_into_async_no_await_test: CompileTimeError
+step_over_await_test: CompileTimeError
+step_test: CompileTimeError
+step_through_arithmetic_test: CompileTimeError
+step_through_constructor_calls_test: CompileTimeError
+step_through_function_2_test: CompileTimeError
+step_through_function_test: CompileTimeError
+step_through_getter_test: CompileTimeError
+step_through_property_get_test: CompileTimeError
+step_through_property_set_test: CompileTimeError
+step_through_setter_test: CompileTimeError
+step_through_switch_test: CompileTimeError
+step_through_switch_with_continue_test: CompileTimeError
+string_escaping_test: CompileTimeError
+tcp_socket_closing_service_test: CompileTimeError
+tcp_socket_service_test: CompileTimeError
+type_arguments_test: CompileTimeError
+typed_data_test: CompileTimeError
+udp_socket_service_test: CompileTimeError
+vm_test: CompileTimeError
+vm_timeline_events_test: CompileTimeError
+vm_timeline_flags_test: CompileTimeError
+weak_properties_test: CompileTimeError
+
diff --git a/runtime/tests/vm/vm.status b/runtime/tests/vm/vm.status
index fb4595e..aca128cd 100644
--- a/runtime/tests/vm/vm.status
+++ b/runtime/tests/vm/vm.status
@@ -315,6 +315,12 @@
 cc/Parser_AllocateVariables_NestedCapturedVar: Crash
 cc/Parser_AllocateVariables_TwoChains: Crash
 
+[ $compiler == dartk && $strong ]
+dart/data_uri_spawn_test: CompileTimeError # Issue 31586
+dart/hello_fuchsia_test: RuntimeError
+dart/optimized_stacktrace_line_and_column_test: CompileTimeError # Issue 31586
+dart/optimized_stacktrace_line_test: CompileTimeError # Issue 31586
+
 [ $compiler == dartkp && ($runtime == dart_precompiled || $runtime == vm) ]
 dart/data_uri_import_test/base64: CompileTimeError
 dart/data_uri_import_test/nocharset: CompileTimeError
diff --git a/samples/samples.status b/samples/samples.status
index cf6350d..51914af 100644
--- a/samples/samples.status
+++ b/samples/samples.status
@@ -29,6 +29,11 @@
 [ $compiler == none && $runtime == vm && $system == windows && $mode == debug ]
 sample_extension/test/sample_extension_app_snapshot_test: Pass, RuntimeError # Issue 28842
 
+[ $compiler == dartk && $strong ]
+sample_extension/test/sample_extension_app_snapshot_test: RuntimeError
+sample_extension/test/sample_extension_script_snapshot_test: RuntimeError
+sample_extension/test/sample_extension_test: RuntimeError
+
 [ $compiler == dartkp ]
 sample_extension/test/sample_extension_app_snapshot_test: RuntimeError
 sample_extension/test/sample_extension_script_snapshot_test: RuntimeError
diff --git a/tests/co19/co19-kernel.status b/tests/co19/co19-kernel.status
index d610d6b..c643a7b 100644
--- a/tests/co19/co19-kernel.status
+++ b/tests/co19/co19-kernel.status
@@ -26,11 +26,17 @@
 [ $compiler == dartk && $mode == debug ]
 LibTest/isolate/Isolate/spawnUri_A01_t04: Pass, Slow, Timeout
 
+[ $compiler == dartk && $strong ]
+*: SkipByDesign
+
 # dartk: precompilation failures (debug)
 [ $compiler == dartkp && $mode == debug ]
 Language/Functions/External_Functions/not_connected_to_a_body_t01: Crash
 Language/Statements/For/Asynchronous_For_in/execution_t04: Crash
 
+[ $compiler == dartkp && $strong ]
+*: SkipByDesign
+
 [ $mode == debug && ($compiler == dartk || $compiler == dartkp) ]
 Language/Classes/Constructors/Generative_Constructors/execution_t04: Crash
 Language/Classes/Instance_Variables/constant_t01: Crash
diff --git a/tests/isolate/isolate.status b/tests/isolate/isolate.status
index 1c82d4e..9b965dd 100644
--- a/tests/isolate/isolate.status
+++ b/tests/isolate/isolate.status
@@ -104,6 +104,55 @@
 [ $compiler == dart2js && ($runtime == chrome || $runtime == chromeOnAndroid || $runtime == drt || $runtime == ff || $runtime == safari) ]
 isolate_stress_test: Pass, Slow # Issue 10697
 
+[ $compiler == dartk && $strong ]
+checked_test: RuntimeError
+count_test: CompileTimeError
+cross_isolate_message_test: CompileTimeError
+error_at_spawnuri_test: RuntimeError
+error_exit_at_spawnuri_test: RuntimeError
+exit_at_spawnuri_test: RuntimeError
+function_send1_test: CompileTimeError
+function_send_test: CompileTimeError
+handle_error2_test: CompileTimeError
+handle_error3_test: CompileTimeError
+illegal_msg_function_test: CompileTimeError
+illegal_msg_mirror_test: CompileTimeError
+isolate_complex_messages_test: CompileTimeError
+isolate_current_test: CompileTimeError
+issue_21398_parent_isolate1_test: RuntimeError
+issue_21398_parent_isolate_test: RuntimeError
+issue_22778_test: Crash
+issue_24243_parent_isolate_test: RuntimeError
+kill_self_synchronously_test: RuntimeError
+kill_test: CompileTimeError
+mandel_isolate_test: CompileTimeError
+message2_test: CompileTimeError
+message3_test/byteBuffer: CompileTimeError
+message3_test/constInstance: CompileTimeError
+message3_test/constList: CompileTimeError
+message3_test/constList_identical: CompileTimeError
+message3_test/constMap: CompileTimeError
+message3_test/fun: CompileTimeError
+message3_test/int32x4: CompileTimeError
+message3_test/none: CompileTimeError
+message_test: CompileTimeError
+mint_maker_test: CompileTimeError
+nested_spawn2_test: CompileTimeError
+nested_spawn_test: CompileTimeError
+raw_port_test: CompileTimeError
+request_reply_test: CompileTimeError
+spawn_function_custom_class_test: CompileTimeError
+spawn_function_test: CompileTimeError
+spawn_uri_exported_main_test: RuntimeError
+spawn_uri_multi_test/none: CompileTimeError
+spawn_uri_nested_vm_test: CompileTimeError
+spawn_uri_test: CompileTimeError
+spawn_uri_vm_test: CompileTimeError
+static_function_test: CompileTimeError
+timer_isolate_test: CompileTimeError
+typed_message_test: CompileTimeError
+unresolved_ports_test: CompileTimeError
+
 [ $compiler == none && $runtime == vm && $system == fuchsia ]
 *: Skip # Not yet triaged.
 
diff --git a/tests/kernel/kernel.status b/tests/kernel/kernel.status
index 025a3ce..3f36f5d 100644
--- a/tests/kernel/kernel.status
+++ b/tests/kernel/kernel.status
@@ -17,6 +17,10 @@
 unsorted/invocation_errors_test: StaticWarning
 unsorted/super_mixin_test: CompileTimeError
 
+[ $compiler == dartk && $strong ]
+unsorted/loop_test: RuntimeError
+unsorted/nsm_dispatcher_test: CompileTimeError
+unsorted/types_test: RuntimeError
+
 [ $runtime == dart_precompiled && $minified ]
 unsorted/symbol_literal_test: Skip # Expects unobfuscated Symbol.toString.
-
diff --git a/tests/standalone/standalone.status b/tests/standalone/standalone.status
index b4f78c5..b863bd1 100644
--- a/tests/standalone/standalone.status
+++ b/tests/standalone/standalone.status
@@ -38,6 +38,9 @@
 [ $compiler == dart2analyzer && ($builder_tag == strong || $strong) ]
 *: Skip # Issue 28649
 
+[ $compiler == dartk && $strong ]
+*: SkipByDesign
+
 [ $compiler == none && $runtime == vm && $system == fuchsia ]
 *: Skip # Not yet triaged.
 
diff --git a/tools/bots/dart_tests.isolate b/tools/bots/dart_tests.isolate
index b7c925f..bd529b6 100644
--- a/tools/bots/dart_tests.isolate
+++ b/tools/bots/dart_tests.isolate
@@ -20,6 +20,7 @@
               'pkg/meta/',
               'pkg/pkg.status',
               'pkg/status_file/',
+              'pkg/vm/',
               'runtime/tests/',
               '.packages']
   }
diff --git a/tools/bots/test_matrix.json b/tools/bots/test_matrix.json
index a580d08..c8b4c40 100644
--- a/tools/bots/test_matrix.json
+++ b/tools/bots/test_matrix.json
@@ -20,6 +20,7 @@
       "pkg/meta/",
       "pkg/pkg.status",
       "pkg/status_file/",
+      "pkg/vm/",
       "runtime/",
       "sdk/",
       ".packages"
diff --git a/tools/testing/dart/compiler_configuration.dart b/tools/testing/dart/compiler_configuration.dart
index 5f263ad..9fee622 100644
--- a/tools/testing/dart/compiler_configuration.dart
+++ b/tools/testing/dart/compiler_configuration.dart
@@ -149,19 +149,26 @@
     var buildDir = _configuration.buildDirectory;
     var args = <String>[];
     if (useDfe) {
-      args.add('--dfe=${buildDir}/gen/kernel-service.dart.snapshot');
-      args.add('--kernel-binaries=' +
-          (_useSdk
-              ? '${_configuration.buildDirectory}/dart-sdk/lib/_internal'
-              : '${buildDir}'));
+      // DFE+strong configuration is a Dart 2.0 configuration which uses
+      // pkg/vm/tool/dart2 wrapper script, which takes care of passing
+      // correct arguments to VM binary. No need to pass any additional
+      // arguments.
+      if (!_isStrong) {
+        args.add('--dfe=${buildDir}/gen/kernel-service.dart.snapshot');
+        args.add('--kernel-binaries=' +
+            (_useSdk
+                ? '${_configuration.buildDirectory}/dart-sdk/lib/_internal'
+                : '${buildDir}'));
+      }
       if (_isDebug) {
         // Temporarily disable background compilation to avoid flaky crashes
         // (see http://dartbug.com/30016 for details).
         args.add('--no-background-compilation');
       }
-    }
-    if (_isStrong) {
-      args.add('--strong');
+    } else {
+      if (_isStrong) {
+        args.add('--strong');
+      }
     }
     if (_isChecked) {
       args.add('--enable_asserts');
diff --git a/tools/testing/dart/configuration.dart b/tools/testing/dart/configuration.dart
index 088f139..cd1be47 100644
--- a/tools/testing/dart/configuration.dart
+++ b/tools/testing/dart/configuration.dart
@@ -175,6 +175,13 @@
     return _servers;
   }
 
+  /// Returns true if this configuration is considered Dart 2.0 configuration
+  /// by VM (which is identified by using common front-end and strong mode).
+  /// In this case instead of invoking VM binary directly we use
+  /// pkg/vm/tool/dart2 wrapper script, which takes care of passing
+  /// correct arguments to VM binary.
+  bool get usingDart2VMWrapper => isStrong && compiler == Compiler.dartk;
+
   /// The base directory named for this configuration, like:
   ///
   ///     none_vm_release_x64
diff --git a/tools/testing/dart/test_suite.dart b/tools/testing/dart/test_suite.dart
index bcdd9d0..0b9cb56 100644
--- a/tools/testing/dart/test_suite.dart
+++ b/tools/testing/dart/test_suite.dart
@@ -164,6 +164,14 @@
     // Controlled by user with the option "--dart".
     var dartExecutable = configuration.dartPath;
 
+    if (configuration.usingDart2VMWrapper) {
+      if (dartExecutable != null) {
+        throw 'Can not use --dart when testing Dart 2.0 configuration';
+      }
+
+      dartExecutable = 'pkg/vm/tool/dart2';
+    }
+
     if (dartExecutable == null) {
       var suffix = executableBinarySuffix;
       dartExecutable = useSdk
@@ -815,7 +823,8 @@
       // turn on reified generics in the VM.
       // Note that VMOptions=--no-reify-generic-functions in test is ignored.
       // Also, enable Dart 2.0 fixed-size integers with --limit-ints-to-64-bits.
-      if (suiteName.endsWith("_2")) {
+      // Dart 2 VM wrapper (pkg/vm/tool/dart2) already passes correct arguments.
+      if (suiteName.endsWith("_2") && !configuration.usingDart2VMWrapper) {
         allVmOptions = allVmOptions.toList()
           ..add("--reify-generic-functions")
           ..add("--limit-ints-to-64-bits");