diff --git a/runtime/observatory/tests/service/add_breakpoint_rpc_test.dart b/runtime/observatory/tests/service/add_breakpoint_rpc_test.dart deleted file mode 100644 index 4c2c3884fcc..00000000000 --- a/runtime/observatory/tests/service/add_breakpoint_rpc_test.dart +++ /dev/null @@ -1,139 +0,0 @@ -// Copyright (c) 2015, 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 'package:observatory/service_io.dart'; -import 'package:unittest/unittest.dart'; -import 'service_test_common.dart'; -import 'test_helper.dart'; -import 'dart:async'; - -const int LINE_A = 22; -const int LINE_B = 24; - -int value = 0; - -int incValue(int amount) { - value += amount; - return amount; -} - -Future testMain() async { - incValue(incValue(1)); // line A. - - incValue(incValue(1)); // line B. -} - -var tests = [ - hasPausedAtStart, - - // Test future breakpoints. - (Isolate isolate) async { - var rootLib = isolate.rootLibrary; - await rootLib.load(); - var script = rootLib.scripts[0]; - - // Future breakpoint. - var futureBpt1 = await isolate.addBreakpoint(script, LINE_A); - expect(futureBpt1.number, equals(1)); - expect(futureBpt1.resolved, isFalse); - expect(await futureBpt1.location.getLine(), equals(LINE_A)); - expect(await futureBpt1.location.getColumn(), equals(null)); - - // Future breakpoint with specific column. - var futureBpt2 = await isolate.addBreakpoint(script, LINE_A, 3); - expect(futureBpt2.number, equals(2)); - expect(futureBpt2.resolved, isFalse); - expect(await futureBpt2.location.getLine(), equals(LINE_A)); - expect(await futureBpt2.location.getColumn(), equals(3)); - - var stream = await isolate.vm.getEventStream(VM.kDebugStream); - Completer completer = new Completer(); - var subscription; - var resolvedCount = 0; - subscription = stream.listen((ServiceEvent event) async { - if (event.kind == ServiceEvent.kBreakpointResolved) { - resolvedCount++; - } - if (event.kind == ServiceEvent.kPauseBreakpoint) { - subscription.cancel(); - completer.complete(); - } - }); - await isolate.resume(); - await completer.future; - - // After resolution the breakpoints have assigned line & column. - expect(resolvedCount, equals(2)); - expect(futureBpt1.resolved, isTrue); - expect(await futureBpt1.location.getLine(), equals(LINE_A)); - expect(await futureBpt1.location.getColumn(), equals(12)); - expect(futureBpt2.resolved, isTrue); - expect(await futureBpt2.location.getLine(), equals(LINE_A)); - expect(await futureBpt2.location.getColumn(), equals(3)); - - // The first breakpoint hits before value is modified. - expect(((await rootLib.evaluate('value')) as Instance).valueAsString, - equals('0')); - - stream = await isolate.vm.getEventStream(VM.kDebugStream); - completer = new Completer(); - subscription = stream.listen((ServiceEvent event) async { - if (event.kind == ServiceEvent.kPauseBreakpoint) { - subscription.cancel(); - completer.complete(); - } - }); - await isolate.resume(); - await completer.future; - - // The second breakpoint hits after value has been modified once. - expect(((await rootLib.evaluate('value')) as Instance).valueAsString, - equals('1')); - - // Remove the breakpoints. - expect( - (await isolate.removeBreakpoint(futureBpt1)).type, equals('Success')); - expect( - (await isolate.removeBreakpoint(futureBpt2)).type, equals('Success')); - }, - - // Test resolution of column breakpoints. - (Isolate isolate) async { - var script = isolate.rootLibrary.scripts[0]; - // Try all columns, including some columns that are too big. - for (int col = 1; col <= 50; col++) { - var bpt = await isolate.addBreakpoint(script, LINE_A, col); - expect(bpt.resolved, isTrue); - int resolvedLine = await bpt.location.getLine(); - int resolvedCol = await bpt.location.getColumn(); - print('20:${col} -> ${resolvedLine}:${resolvedCol}'); - if (col <= 12) { - expect(resolvedLine, equals(LINE_A)); - expect(resolvedCol, equals(3)); - } else if (col <= 36) { - expect(resolvedLine, equals(LINE_A)); - expect(resolvedCol, equals(12)); - } else { - expect(resolvedLine, equals(LINE_B)); - expect(resolvedCol, equals(12)); - } - expect((await isolate.removeBreakpoint(bpt)).type, equals('Success')); - } - - // Make sure that a zero column is an error. - var caughtException = false; - try { - await isolate.addBreakpoint(script, 20, 0); - expect(false, isTrue, reason: 'Unreachable'); - } on ServerRpcException catch (e) { - caughtException = true; - expect(e.code, equals(ServerRpcException.kInvalidParams)); - expect(e.message, "addBreakpoint: invalid 'column' parameter: 0"); - } - expect(caughtException, isTrue); - }, -]; - -main(args) => runIsolateTests(args, tests, - testeeConcurrent: testMain, pause_on_start: true); diff --git a/runtime/observatory/tests/service/coverage_leaf_function_test.dart b/runtime/observatory/tests/service/coverage_leaf_function_test.dart index f1784269bae..a90ec86bb72 100644 --- a/runtime/observatory/tests/service/coverage_leaf_function_test.dart +++ b/runtime/observatory/tests/service/coverage_leaf_function_test.dart @@ -44,12 +44,12 @@ var tests = [ var expectedRange = { 'scriptIndex': 0, - 'startPos': ifKernel(392, 26), - 'endPos': ifKernel(442, 38), + 'startPos': 392, + 'endPos': 442, 'compiled': true, 'coverage': { - 'hits': ifKernel([], []), - 'misses': ifKernel([392], [26]) + 'hits': [], + 'misses': [392] } }; @@ -85,12 +85,12 @@ var tests = [ var expectedRange = { 'scriptIndex': 0, - 'startPos': ifKernel(392, 26), - 'endPos': ifKernel(442, 38), + 'startPos': 392, + 'endPos': 442, 'compiled': true, 'coverage': { - 'hits': ifKernel([392], [26]), - 'misses': ifKernel([], []) + 'hits': [392], + 'misses': [] } }; diff --git a/runtime/observatory/tests/service/coverage_optimized_function_test.dart b/runtime/observatory/tests/service/coverage_optimized_function_test.dart index e7a38e7c05d..8d689078d33 100644 --- a/runtime/observatory/tests/service/coverage_optimized_function_test.dart +++ b/runtime/observatory/tests/service/coverage_optimized_function_test.dart @@ -37,12 +37,12 @@ var tests = [ var expectedRange = { 'scriptIndex': 0, - 'startPos': ifKernel(469, 26), - 'endPos': ifKernel(536, 51), + 'startPos': 469, + 'endPos': 536, 'compiled': true, 'coverage': { - 'hits': ifKernel([469, 509, 520, 524], [26, 37, 41, 45]), - 'misses': ifKernel([], []) + 'hits': [469, 509, 520, 524], + 'misses': [] } }; diff --git a/runtime/observatory/tests/service/get_object_rpc_test.dart b/runtime/observatory/tests/service/get_object_rpc_test.dart index 3f0ff6cc5e6..de51a719728 100644 --- a/runtime/observatory/tests/service/get_object_rpc_test.dart +++ b/runtime/observatory/tests/service/get_object_rpc_test.dart @@ -703,7 +703,7 @@ var tests = [ expect(result['id'], startsWith('libraries/')); expect(result['uri'], startsWith('file:')); expect(result['uri'], endsWith('get_object_rpc_test.dart')); - expect(result['_kind'], equals(ifKernel('kernel', 'script'))); + expect(result['_kind'], equals('kernel')); expect(result['library']['type'], equals('@Library')); expect(result['source'], startsWith('// Copyright (c)')); expect(result['tokenPosTable'].length, isPositive); diff --git a/runtime/observatory/tests/service/get_source_report_test.dart b/runtime/observatory/tests/service/get_source_report_test.dart index 7627ef38bcd..7abd05e2a79 100644 --- a/runtime/observatory/tests/service/get_source_report_test.dart +++ b/runtime/observatory/tests/service/get_source_report_test.dart @@ -73,12 +73,12 @@ var tests = [ var expectedRange = { 'scriptIndex': 0, - 'startPos': ifKernel(432, 40), - 'endPos': ifKernel(576, 89), + 'startPos': 432, + 'endPos': 576, 'compiled': true, 'coverage': { - 'hits': ifKernel([432, 482, 533, 562], [40, 55, 73, 83]), - 'misses': ifKernel([495], [61]) + 'hits': [432, 482, 533, 562], + 'misses': [495], } }; diff --git a/runtime/observatory/tests/service/service.status b/runtime/observatory/tests/service/service.status index 0cdbc3366c9..ea1e417f2b8 100644 --- a/runtime/observatory/tests/service/service.status +++ b/runtime/observatory/tests/service/service.status @@ -20,11 +20,6 @@ process_service_test: Pass, Fail # Issue 24344 developer_extension_test: SkipByDesign get_isolate_after_language_error_test: SkipByDesign -# Kernel version of tests -[ $compiler != dartk ] -add_breakpoint_rpc_kernel_test: SkipByDesign # kernel specific version of add_breakpoint_rpc_test -evaluate_function_type_parameters_test: SkipByDesign # only supported in kernel - # Service protocol is not supported in product mode. [ $mode == product ] *: SkipByDesign diff --git a/runtime/observatory/tests/service/service_kernel.status b/runtime/observatory/tests/service/service_kernel.status index 4a4cf8f97b8..316e3f215e7 100644 --- a/runtime/observatory/tests/service/service_kernel.status +++ b/runtime/observatory/tests/service/service_kernel.status @@ -3,7 +3,6 @@ # BSD-style license that can be found in the LICENSE file. [ $compiler == app_jitk ] -add_breakpoint_rpc_test: SkipByDesign # non-kernel specific version of add_breakpoint_rpc_kernel_test. async_generator_breakpoint_test: SkipByDesign # No incremental compiler available. bad_reload_test: RuntimeError break_on_activation_test: SkipByDesign # No incremental compiler available. @@ -158,10 +157,7 @@ set_name_rpc_test: RuntimeError # Please triage. simple_reload_test: RuntimeError, Timeout valid_source_locations_test: Pass, Slow, Timeout # Issue 34736 -# Kernel works slightly different. There are kernel specific versions. -# These are the non-kernel specific versions so skip tests and allow errors. [ $compiler == dartk || $compiler == dartkb ] -add_breakpoint_rpc_test: SkipByDesign # non-kernel specific version of add_breakpoint_rpc_kernel_test. bad_reload_test: RuntimeError # Issue 34025 coverage_optimized_function_test: Pass, Slow evaluate_activation_in_method_class_test: RuntimeError # Issue 35505 diff --git a/runtime/observatory/tests/service/service_test_common.dart b/runtime/observatory/tests/service/service_test_common.dart index 87893bcddd2..e7f831f6c85 100644 --- a/runtime/observatory/tests/service/service_test_common.dart +++ b/runtime/observatory/tests/service/service_test_common.dart @@ -579,36 +579,3 @@ List removeAdjacentDuplicates(List fromList) { } return result; } - -bool isKernel() { - for (String argument in Platform.executableArguments) { - if (argument.startsWith("--no-preview_dart_2")) return false; - if (argument.startsWith("--no-preview-dart-2")) return false; - } - return true; -} - -E ifKernel(E then, E otherwise) { - if (isKernel()) return then; - return otherwise; -} - -void ifKernelExecute(Function kernelFunction, Function nonKernelFunction) { - if (isKernel()) { - kernelFunction(); - } else { - nonKernelFunction(); - } -} - -void nonKernelExecute(Function nonKernelFunction) { - if (!isKernel()) { - nonKernelFunction(); - } -} - -void kernelExecute(Function kernelFunction) { - if (isKernel()) { - kernelFunction(); - } -}