mirror of
https://github.com/dart-lang/sdk
synced 2024-09-05 08:24:39 +00:00
[ package:vm_service ] Update tests to be compatible with pub run test
Will allow for tests to be enabled in google3 as pub or portions of pub are used to run VM tests. Previously the test harness was configured to look for a URI with a data: scheme to determine if it was being run via pub run test (pub generates its own harness and spawns the test from that). We were parsing the test URI out of this data URI, which wouldn't work correctly in google3. This change assumes that if Platform.script.scheme == 'data', the test is being run via pub from the root directory of the package. In that case, we can assume there is a 'test' directory and simply use 'test/$scriptName'as the path for the testee process. TEST=N/A Change-Id: I589605ebc7001adc9d8595ca8347c0af329b9c28 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/184541 Reviewed-by: Gary Roumanis <grouma@google.com>
This commit is contained in:
parent
c95714d069
commit
fa8ea6dfaa
|
@ -11,7 +11,7 @@
|
|||
"constraint, update this by running tools/generate_package_config.dart."
|
||||
],
|
||||
"configVersion": 2,
|
||||
"generated": "2021-02-08T17:50:36.420568",
|
||||
"generated": "2021-02-11T15:59:54.232365",
|
||||
"generator": "tools/generate_package_config.dart",
|
||||
"packages": [
|
||||
{
|
||||
|
@ -505,12 +505,24 @@
|
|||
"packageUri": "lib/",
|
||||
"languageVersion": "2.12"
|
||||
},
|
||||
{
|
||||
"name": "platform",
|
||||
"rootUri": "../third_party/pkg/platform",
|
||||
"packageUri": "lib/",
|
||||
"languageVersion": "2.12"
|
||||
},
|
||||
{
|
||||
"name": "pool",
|
||||
"rootUri": "../third_party/pkg/pool",
|
||||
"packageUri": "lib/",
|
||||
"languageVersion": "2.12"
|
||||
},
|
||||
{
|
||||
"name": "process",
|
||||
"rootUri": "../third_party/pkg/process",
|
||||
"packageUri": "lib/",
|
||||
"languageVersion": "2.12"
|
||||
},
|
||||
{
|
||||
"name": "protobuf",
|
||||
"rootUri": "../third_party/pkg/protobuf/protobuf",
|
||||
|
@ -782,4 +794,4 @@
|
|||
"languageVersion": "2.12"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
|
@ -74,7 +74,9 @@ observatory_test_package:runtime/observatory/tests/service/observatory_test_pack
|
|||
package_config:third_party/pkg_tested/package_config/lib
|
||||
path:third_party/pkg/path/lib
|
||||
pedantic:third_party/pkg/pedantic/lib
|
||||
platform:third_party/pkg/platform/lib
|
||||
pool:third_party/pkg/pool/lib
|
||||
process:third_party/pkg/process/lib
|
||||
protobuf:third_party/pkg/protobuf/protobuf/lib
|
||||
pub:third_party/pkg/pub/lib
|
||||
pub_semver:third_party/pkg/pub_semver/lib
|
||||
|
|
6
DEPS
6
DEPS
|
@ -130,8 +130,10 @@ vars = {
|
|||
"package_config_rev": "249af482de9ebabfc781bf10d6152c938e5ce45e",
|
||||
"path_rev": "407ab76187fade41c31e39c745b39661b710106c",
|
||||
"pedantic_rev": "df177f6ae531426aaf7bbf0121c90dc89d9c57bf",
|
||||
"platform_rev": "c20e6fa315e9f8820e51c0ae721f63aff33b8e17",
|
||||
"ply_rev": "604b32590ffad5cbb82e4afef1d305512d06ae93",
|
||||
"pool_rev": "7abe634002a1ba8a0928eded086062f1307ccfae",
|
||||
"process_rev": "56ece43b53b64c63ae51ec184b76bd5360c28d0b",
|
||||
"protobuf_rev": "0d03fd588df69e9863e2a2efc0059dee8f18d5b2",
|
||||
"pub_rev": "0e657414a472e74ca5dd76ae0db50cc060251dec",
|
||||
"pub_semver_rev": "f50d80ef10c4b2fa5f4c8878036a4d9342c0cc82",
|
||||
|
@ -387,10 +389,14 @@ deps = {
|
|||
Var("dart_git") + "path.git" + "@" + Var("path_rev"),
|
||||
Var("dart_root") + "/third_party/pkg/pedantic":
|
||||
Var("dart_git") + "pedantic.git" + "@" + Var("pedantic_rev"),
|
||||
Var("dart_root") + "/third_party/pkg/platform":
|
||||
Var("dart_git") + "platform.dart.git" + "@" + Var("platform_rev"),
|
||||
Var("dart_root") + "/third_party/pkg/pool":
|
||||
Var("dart_git") + "pool.git" + "@" + Var("pool_rev"),
|
||||
Var("dart_root") + "/third_party/pkg/protobuf":
|
||||
Var("dart_git") + "protobuf.git" + "@" + Var("protobuf_rev"),
|
||||
Var("dart_root") + "/third_party/pkg/process":
|
||||
Var("dart_git") + "process.dart.git" + "@" + Var("process_rev"),
|
||||
Var("dart_root") + "/third_party/pkg/pub_semver":
|
||||
Var("dart_git") + "pub_semver.git" + "@" + Var("pub_semver_rev"),
|
||||
Var("dart_root") + "/third_party/pkg/pub":
|
||||
|
|
|
@ -18,5 +18,6 @@ dev_dependencies:
|
|||
mockito: ^5.0.0-nullsafety.1
|
||||
path: ^1.8.0
|
||||
pedantic: ^1.10.0-nullsafety.3
|
||||
process: ^4.0.0
|
||||
pub_semver: ^2.0.0-nullsafety.0
|
||||
test: ^1.16.0-nullsafety.13
|
||||
|
|
|
@ -102,5 +102,9 @@ Future testAsync(VmService service, IsolateRef isolateRef) async {
|
|||
|
||||
final tests = <IsolateTest>[testAsync];
|
||||
|
||||
main([args = const <String>[]]) =>
|
||||
runIsolateTests(args, tests, testeeConcurrent: testeeDo);
|
||||
main([args = const <String>[]]) => runIsolateTests(
|
||||
args,
|
||||
tests,
|
||||
'async_generator_breakpoint_test.dart',
|
||||
testeeConcurrent: testeeDo,
|
||||
);
|
||||
|
|
|
@ -42,5 +42,9 @@ var tests = <IsolateTest>[
|
|||
resumeIsolate,
|
||||
];
|
||||
|
||||
main([args = const <String>[]]) =>
|
||||
runIsolateTests(args, tests, testeeConcurrent: testMain);
|
||||
main([args = const <String>[]]) => runIsolateTests(
|
||||
args,
|
||||
tests,
|
||||
'async_next_test.dart',
|
||||
testeeConcurrent: testMain,
|
||||
);
|
||||
|
|
|
@ -70,5 +70,9 @@ var tests = <IsolateTest>[
|
|||
resumeIsolate,
|
||||
];
|
||||
|
||||
main([args = const <String>[]]) =>
|
||||
runIsolateTests(args, tests, testeeConcurrent: testeeDo);
|
||||
main([args = const <String>[]]) => runIsolateTests(
|
||||
args,
|
||||
tests,
|
||||
'async_scope_test.dart',
|
||||
testeeConcurrent: testeeDo,
|
||||
);
|
||||
|
|
|
@ -78,5 +78,10 @@ var tests = <IsolateTest>[
|
|||
resumeIsolate
|
||||
];
|
||||
|
||||
main([args = const <String>[]]) => runIsolateTests(args, tests,
|
||||
testeeConcurrent: testMain, extraArgs: extraDebuggingArgs);
|
||||
main([args = const <String>[]]) => runIsolateTests(
|
||||
args,
|
||||
tests,
|
||||
'async_single_step_exception_test.dart',
|
||||
testeeConcurrent: testMain,
|
||||
extraArgs: extraDebuggingArgs,
|
||||
);
|
||||
|
|
|
@ -43,5 +43,10 @@ var tests = <IsolateTest>[
|
|||
resumeIsolate
|
||||
];
|
||||
|
||||
main([args = const <String>[]]) => runIsolateTestsSynchronous(args, tests,
|
||||
testeeConcurrent: testMain, extraArgs: extraDebuggingArgs);
|
||||
main([args = const <String>[]]) => runIsolateTestsSynchronous(
|
||||
args,
|
||||
tests,
|
||||
'async_single_step_into_test.dart',
|
||||
testeeConcurrent: testMain,
|
||||
extraArgs: extraDebuggingArgs,
|
||||
);
|
||||
|
|
|
@ -56,5 +56,10 @@ var tests = <IsolateTest>[
|
|||
resumeIsolate
|
||||
];
|
||||
|
||||
main([args = const <String>[]]) => runIsolateTests(args, tests,
|
||||
testeeConcurrent: testMain, extraArgs: extraDebuggingArgs);
|
||||
main([args = const <String>[]]) => runIsolateTests(
|
||||
args,
|
||||
tests,
|
||||
'async_single_step_out_test.dart',
|
||||
testeeConcurrent: testMain,
|
||||
extraArgs: extraDebuggingArgs,
|
||||
);
|
||||
|
|
|
@ -70,5 +70,10 @@ var tests = <IsolateTest>[
|
|||
resumeIsolate,
|
||||
];
|
||||
|
||||
main([args = const <String>[]]) => runIsolateTestsSynchronous(args, tests,
|
||||
testeeConcurrent: testMain, extraArgs: extraDebuggingArgs);
|
||||
main([args = const <String>[]]) => runIsolateTestsSynchronous(
|
||||
args,
|
||||
tests,
|
||||
'async_star_single_step_into_test.dart',
|
||||
testeeConcurrent: testMain,
|
||||
extraArgs: extraDebuggingArgs,
|
||||
);
|
||||
|
|
|
@ -100,5 +100,10 @@ var tests = <IsolateTest>[
|
|||
stoppedAtLine(LINE_I), // return null.
|
||||
];
|
||||
|
||||
main([args = const <String>[]]) => runIsolateTestsSynchronous(args, tests,
|
||||
testeeConcurrent: testMain, extraArgs: extraDebuggingArgs);
|
||||
main([args = const <String>[]]) => runIsolateTestsSynchronous(
|
||||
args,
|
||||
tests,
|
||||
'async_star_step_out_test.dart',
|
||||
testeeConcurrent: testMain,
|
||||
extraArgs: extraDebuggingArgs,
|
||||
);
|
||||
|
|
|
@ -53,5 +53,10 @@ var tests = <IsolateTest>[
|
|||
stoppedAtLine(LINE_F),
|
||||
];
|
||||
|
||||
main([args = const <String>[]]) => runIsolateTests(args, tests,
|
||||
testeeConcurrent: testMain, extraArgs: extraDebuggingArgs);
|
||||
main([args = const <String>[]]) => runIsolateTests(
|
||||
args,
|
||||
tests,
|
||||
'async_step_out_test.dart',
|
||||
testeeConcurrent: testMain,
|
||||
extraArgs: extraDebuggingArgs,
|
||||
);
|
||||
|
|
|
@ -7,6 +7,7 @@ library test_helper;
|
|||
import 'dart:async';
|
||||
import 'dart:convert';
|
||||
import 'dart:io' as io;
|
||||
import 'package:process/process.dart';
|
||||
import 'package:vm_service/vm_service_io.dart';
|
||||
import 'package:vm_service/vm_service.dart';
|
||||
import 'package:test/test.dart';
|
||||
|
@ -27,19 +28,15 @@ bool _isTestee() {
|
|||
return io.Platform.environment.containsKey(_TESTEE_ENV_KEY);
|
||||
}
|
||||
|
||||
Uri _getTestUri() {
|
||||
Uri _getTestUri(String script) {
|
||||
if (io.Platform.script.scheme == 'data') {
|
||||
// If we're using pub to run these tests this value isn't a file URI.
|
||||
// We'll need to parse the actual URI out...
|
||||
final fileRegExp = RegExp(r'file:\/\/\/.*\.dart');
|
||||
final path =
|
||||
fileRegExp.stringMatch(io.Platform.script.data!.contentAsString());
|
||||
if (path == null) {
|
||||
throw 'Unable to determine file path for script!';
|
||||
}
|
||||
return Uri.parse(path);
|
||||
// If running from pub we can assume that we're in the root of the package
|
||||
// directory.
|
||||
return Uri.parse('test/$script');
|
||||
} else {
|
||||
return io.Platform.script;
|
||||
// Resolve the script to ensure that test will fail if the provided script
|
||||
// name doesn't match the actual script.
|
||||
return io.Platform.script.resolve(script);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -97,7 +94,8 @@ class _ServiceTesteeLauncher {
|
|||
List<String> args;
|
||||
bool killedByTester = false;
|
||||
|
||||
_ServiceTesteeLauncher() : args = [_getTestUri().toFilePath()];
|
||||
_ServiceTesteeLauncher(String script)
|
||||
: args = [_getTestUri(script).toFilePath()];
|
||||
|
||||
// Spawn the testee process.
|
||||
Future<io.Process> _spawnProcess(
|
||||
|
@ -164,7 +162,13 @@ class _ServiceTesteeLauncher {
|
|||
arguments.insert(0, '-D$k=$v');
|
||||
});
|
||||
print('** Launching $bashEnvironment$executable ${arguments.join(' ')}');
|
||||
return io.Process.start(executable, arguments, environment: environment);
|
||||
return LocalProcessManager().start(
|
||||
[
|
||||
executable,
|
||||
...arguments,
|
||||
],
|
||||
environment: environment,
|
||||
);
|
||||
}
|
||||
|
||||
Future<Uri> launch(
|
||||
|
@ -214,10 +218,10 @@ class _ServiceTesteeLauncher {
|
|||
io.stdout.write('>testee>err> ${line}\n');
|
||||
});
|
||||
process!.exitCode.then((exitCode) {
|
||||
if ((io.exitCode != 0) && !killedByTester) {
|
||||
if ((exitCode != 0) && !killedByTester) {
|
||||
throw "Testee exited with $exitCode";
|
||||
}
|
||||
print("** Process exited");
|
||||
print("** Process exited: $exitCode");
|
||||
});
|
||||
return completer.future;
|
||||
});
|
||||
|
@ -245,13 +249,14 @@ class _ServiceTesterRunner {
|
|||
List<String>? extraArgs,
|
||||
List<VMTest>? vmTests,
|
||||
List<IsolateTest>? isolateTests,
|
||||
required String scriptName,
|
||||
bool pause_on_start = false,
|
||||
bool pause_on_exit = false,
|
||||
bool verbose_vm = false,
|
||||
bool pause_on_unhandled_exceptions = false,
|
||||
bool testeeControlsServer = false,
|
||||
bool useAuthToken = false}) async {
|
||||
var process = _ServiceTesteeLauncher();
|
||||
var process = _ServiceTesteeLauncher(scriptName);
|
||||
late VmService vm;
|
||||
late IsolateRef isolate;
|
||||
setUp(() async {
|
||||
|
@ -272,7 +277,7 @@ class _ServiceTesterRunner {
|
|||
});
|
||||
});
|
||||
|
||||
final name = _getTestUri().pathSegments.last;
|
||||
final name = _getTestUri(scriptName).pathSegments.last;
|
||||
|
||||
test(
|
||||
name,
|
||||
|
@ -348,7 +353,8 @@ class _ServiceTesterRunner {
|
|||
/// to run tests or testee in this invocation of the script.
|
||||
Future<void> runIsolateTests(
|
||||
List<String> mainArgs,
|
||||
List<IsolateTest> tests, {
|
||||
List<IsolateTest> tests,
|
||||
String scriptName, {
|
||||
testeeBefore()?,
|
||||
testeeConcurrent()?,
|
||||
bool pause_on_start = false,
|
||||
|
@ -369,6 +375,7 @@ Future<void> runIsolateTests(
|
|||
} else {
|
||||
await _ServiceTesterRunner().run(
|
||||
mainArgs: mainArgs,
|
||||
scriptName: scriptName,
|
||||
extraArgs: extraArgs,
|
||||
isolateTests: tests,
|
||||
pause_on_start: pause_on_start,
|
||||
|
@ -391,7 +398,8 @@ Future<void> runIsolateTests(
|
|||
/// functions).
|
||||
void runIsolateTestsSynchronous(
|
||||
List<String> mainArgs,
|
||||
List<IsolateTest> tests, {
|
||||
List<IsolateTest> tests,
|
||||
String scriptName, {
|
||||
void testeeBefore()?,
|
||||
void testeeConcurrent()?,
|
||||
bool pause_on_start = false,
|
||||
|
@ -410,6 +418,7 @@ void runIsolateTestsSynchronous(
|
|||
} else {
|
||||
_ServiceTesterRunner().run(
|
||||
mainArgs: mainArgs,
|
||||
scriptName: scriptName,
|
||||
extraArgs: extraArgs,
|
||||
isolateTests: tests,
|
||||
pause_on_start: pause_on_start,
|
||||
|
@ -425,7 +434,8 @@ void runIsolateTestsSynchronous(
|
|||
/// to run tests or testee in this invocation of the script.
|
||||
Future<void> runVMTests(
|
||||
List<String> mainArgs,
|
||||
List<VMTest> tests, {
|
||||
List<VMTest> tests,
|
||||
String scriptName, {
|
||||
testeeBefore()?,
|
||||
testeeConcurrent()?,
|
||||
bool pause_on_start = false,
|
||||
|
@ -443,6 +453,7 @@ Future<void> runVMTests(
|
|||
} else {
|
||||
await _ServiceTesterRunner().run(
|
||||
mainArgs: mainArgs,
|
||||
scriptName: scriptName,
|
||||
extraArgs: extraArgs,
|
||||
vmTests: tests,
|
||||
pause_on_start: pause_on_start,
|
||||
|
|
|
@ -111,5 +111,9 @@ var tests = <IsolateTest>[
|
|||
},
|
||||
];
|
||||
|
||||
main([args = const <String>[]]) =>
|
||||
runIsolateTests(args, tests, testeeConcurrent: testFunction);
|
||||
main([args = const <String>[]]) => runIsolateTests(
|
||||
args,
|
||||
tests,
|
||||
'coverage_leaf_function_test.dart',
|
||||
testeeConcurrent: testFunction,
|
||||
);
|
||||
|
|
|
@ -236,5 +236,9 @@ var tests = <IsolateTest>[
|
|||
},
|
||||
];
|
||||
|
||||
main([args = const <String>[]]) =>
|
||||
runIsolateTests(args, tests, testeeBefore: startTimer);
|
||||
main([args = const <String>[]]) => runIsolateTests(
|
||||
args,
|
||||
tests,
|
||||
'debugging_test.dart',
|
||||
testeeBefore: startTimer,
|
||||
);
|
||||
|
|
|
@ -109,5 +109,9 @@ expectError(func) async {
|
|||
}
|
||||
}
|
||||
|
||||
main([args = const <String>[]]) =>
|
||||
runIsolateTests(args, tests, testeeConcurrent: testFunction);
|
||||
main([args = const <String>[]]) => runIsolateTests(
|
||||
args,
|
||||
tests,
|
||||
'eval_test.dart',
|
||||
testeeConcurrent: testFunction,
|
||||
);
|
||||
|
|
|
@ -62,5 +62,9 @@ final tests = <IsolateTest>[
|
|||
}
|
||||
];
|
||||
|
||||
main([args = const <String>[]]) =>
|
||||
runIsolateTests(args, tests, testeeBefore: testeeMain);
|
||||
main([args = const <String>[]]) => runIsolateTests(
|
||||
args,
|
||||
tests,
|
||||
'evaluate_with_scope_test.dart',
|
||||
testeeBefore: testeeMain,
|
||||
);
|
||||
|
|
|
@ -111,4 +111,9 @@ var fileTests = <IsolateTest>[
|
|||
},
|
||||
];
|
||||
|
||||
main(args) async => runIsolateTests(args, fileTests, testeeBefore: setupFiles);
|
||||
main([args = const <String>[]]) async => runIsolateTests(
|
||||
args,
|
||||
fileTests,
|
||||
'file_service_test.dart',
|
||||
testeeBefore: setupFiles,
|
||||
);
|
||||
|
|
|
@ -65,4 +65,8 @@ var tests = <IsolateTest>[
|
|||
},
|
||||
];
|
||||
|
||||
main([args = const <String>[]]) async => runIsolateTests(args, tests);
|
||||
main([args = const <String>[]]) async => runIsolateTests(
|
||||
args,
|
||||
tests,
|
||||
'get_allocation_profile_rpc_test.dart',
|
||||
);
|
||||
|
|
|
@ -56,5 +56,10 @@ var vmArgs = [
|
|||
'--profile-vm=false', // So this also works with KBC.
|
||||
];
|
||||
|
||||
main([args = const <String>[]]) async =>
|
||||
runIsolateTests(args, tests, testeeBefore: testeeDo, extraArgs: vmArgs);
|
||||
main([args = const <String>[]]) async => runIsolateTests(
|
||||
args,
|
||||
tests,
|
||||
'get_cpu_samples_rpc_test.dart',
|
||||
testeeBefore: testeeDo,
|
||||
extraArgs: vmArgs,
|
||||
);
|
||||
|
|
|
@ -72,4 +72,8 @@ var tests = <VMTest>[
|
|||
}
|
||||
];
|
||||
|
||||
main([args = const <String>[]]) async => runVMTests(args, tests);
|
||||
main([args = const <String>[]]) async => runVMTests(
|
||||
args,
|
||||
tests,
|
||||
'get_flag_list_rpc_test.dart',
|
||||
);
|
||||
|
|
|
@ -32,4 +32,8 @@ var tests = <VMTest>[
|
|||
},
|
||||
];
|
||||
|
||||
main(args) async => runVMTests(args, tests);
|
||||
main(args) async => runVMTests(
|
||||
args,
|
||||
tests,
|
||||
'get_isolate_group_memory_usage.dart',
|
||||
);
|
||||
|
|
|
@ -55,4 +55,8 @@ var tests = <VMTest>[
|
|||
},
|
||||
];
|
||||
|
||||
main(args) async => runVMTests(args, tests);
|
||||
main([args = const <String>[]]) async => runVMTests(
|
||||
args,
|
||||
tests,
|
||||
'get_isolate_rpc_test.dart',
|
||||
);
|
||||
|
|
|
@ -29,4 +29,8 @@ var tests = <VMTest>[
|
|||
},
|
||||
];
|
||||
|
||||
main(args) async => runVMTests(args, tests);
|
||||
main([args = const <String>[]]) async => runVMTests(
|
||||
args,
|
||||
tests,
|
||||
'get_memory_usage_test.dart',
|
||||
);
|
|
@ -144,5 +144,9 @@ final tests = <IsolateTest>[
|
|||
},
|
||||
];
|
||||
|
||||
main([args = const <String>[]]) =>
|
||||
runIsolateTests(args, tests, testeeConcurrent: testMain);
|
||||
main([args = const <String>[]]) => runIsolateTests(
|
||||
args,
|
||||
tests,
|
||||
'get_stack_test.dart',
|
||||
testeeConcurrent: testMain,
|
||||
);
|
||||
|
|
|
@ -15,4 +15,8 @@ var tests = <VMTest>[
|
|||
},
|
||||
];
|
||||
|
||||
main([args = const <String>[]]) async => await runVMTests(args, tests);
|
||||
main([args = const <String>[]]) async => await runVMTests(
|
||||
args,
|
||||
tests,
|
||||
'get_version_rpc_test.dart',
|
||||
);
|
||||
|
|
|
@ -105,5 +105,9 @@ var tests = <IsolateTest>[
|
|||
},
|
||||
];
|
||||
|
||||
main([args = const <String>[]]) async =>
|
||||
runIsolateTests(args, tests, testeeBefore: script);
|
||||
main([args = const <String>[]]) async => runIsolateTests(
|
||||
args,
|
||||
tests,
|
||||
'heap_snapshot_graph_test.dart',
|
||||
testeeBefore: script,
|
||||
);
|
||||
|
|
|
@ -87,5 +87,9 @@ var tests = <IsolateTest>[
|
|||
},
|
||||
];
|
||||
|
||||
main([args = const <String>[]]) async =>
|
||||
runIsolateTests(args, tests, testeeBefore: setup);
|
||||
main([args = const <String>[]]) async => runIsolateTests(
|
||||
args,
|
||||
tests,
|
||||
'http_enable_timeline_logging_service_test.dart',
|
||||
testeeBefore: setup,
|
||||
);
|
||||
|
|
|
@ -75,5 +75,9 @@ expectError(func) async {
|
|||
expect(result.type == 'Error' || result.type == '@Error', isTrue);
|
||||
}
|
||||
|
||||
main([args = const <String>[]]) =>
|
||||
runIsolateTests(args, tests, testeeConcurrent: testFunction);
|
||||
main([args = const <String>[]]) => runIsolateTests(
|
||||
args,
|
||||
tests,
|
||||
'invoke_test.dart',
|
||||
testeeConcurrent: testFunction,
|
||||
);
|
||||
|
|
|
@ -130,5 +130,9 @@ var tests = <IsolateTest>[
|
|||
// TODO(bkonyi): fully port observatory test for socket profiling.
|
||||
];
|
||||
|
||||
main([args = const <String>[]]) async =>
|
||||
runIsolateTests(args, tests, testeeBefore: setup);
|
||||
main([args = const <String>[]]) async => runIsolateTests(
|
||||
args,
|
||||
tests,
|
||||
'network_profiling_test.dart',
|
||||
testeeBefore: setup,
|
||||
);
|
||||
|
|
|
@ -151,9 +151,10 @@ final tests = <IsolateTest>[
|
|||
},
|
||||
];
|
||||
|
||||
main(args) => runIsolateTests(
|
||||
main([args = const <String>[]]) => runIsolateTests(
|
||||
args,
|
||||
tests,
|
||||
'object_graph_identity_hash_test.dart',
|
||||
testeeBefore: script,
|
||||
pause_on_exit: true,
|
||||
);
|
||||
|
|
|
@ -7,15 +7,12 @@ import 'dart:convert';
|
|||
import 'dart:developer';
|
||||
import 'dart:io' as io;
|
||||
|
||||
import 'package:path/path.dart' as path;
|
||||
import 'package:process/process.dart';
|
||||
import 'package:test/test.dart';
|
||||
import 'package:vm_service/vm_service.dart';
|
||||
|
||||
import 'common/test_helper.dart';
|
||||
|
||||
final dartJITBinary = path.join(path.dirname(io.Platform.resolvedExecutable),
|
||||
'dart' + path.extension(io.Platform.resolvedExecutable));
|
||||
|
||||
Future setupProcesses() async {
|
||||
final dir = await io.Directory.systemTemp.createTemp('file_service');
|
||||
|
||||
|
@ -48,10 +45,15 @@ Future setupProcesses() async {
|
|||
}
|
||||
|
||||
Future<ServiceExtensionResponse> setup(ignored_a, ignored_b) async {
|
||||
final processManager = LocalProcessManager();
|
||||
try {
|
||||
process1 = await io.Process.start(io.Platform.executable, args);
|
||||
process2 =
|
||||
await io.Process.start(io.Platform.executable, args..add('foobar'));
|
||||
process1 = await processManager.start(
|
||||
[io.Platform.resolvedExecutable, ...args],
|
||||
);
|
||||
process2 = await processManager.start([
|
||||
io.Platform.resolvedExecutable,
|
||||
...(args..add('foobar')),
|
||||
]);
|
||||
final codeFilePath = dir.path + io.Platform.pathSeparator + "other_file";
|
||||
final codeFile = io.File(codeFilePath);
|
||||
await codeFile.writeAsString('''
|
||||
|
@ -61,8 +63,13 @@ Future setupProcesses() async {
|
|||
await stdin.drain();
|
||||
}
|
||||
''');
|
||||
process3 = await io.Process.start(
|
||||
dartJITBinary, [...io.Platform.executableArguments, codeFilePath]);
|
||||
process3 = await processManager.start(
|
||||
[
|
||||
io.Platform.resolvedExecutable,
|
||||
...io.Platform.executableArguments,
|
||||
codeFilePath
|
||||
],
|
||||
);
|
||||
} catch (_) {
|
||||
closeDown();
|
||||
rethrow;
|
||||
|
@ -105,7 +112,7 @@ final processTests = <IsolateTest>[
|
|||
all.processes[0].id,
|
||||
);
|
||||
|
||||
expect(first.name, io.Platform.executable);
|
||||
expect(io.Platform.resolvedExecutable, contains(first.name.trim()));
|
||||
expect(first.pid, equals(setup.json!['pids']![0]));
|
||||
expect(first.arguments.contains('foobar'), isFalse);
|
||||
expect(first.startedAt, greaterThan(0));
|
||||
|
@ -115,7 +122,7 @@ final processTests = <IsolateTest>[
|
|||
all.processes[1].id,
|
||||
);
|
||||
|
||||
expect(second.name, io.Platform.executable);
|
||||
expect(io.Platform.resolvedExecutable, contains(second.name.trim()));
|
||||
expect(second.pid, equals(setup.json!['pids']![1]));
|
||||
expect(second.arguments.contains('foobar'), isTrue);
|
||||
expect(second.pid != first.pid, isTrue);
|
||||
|
@ -127,7 +134,7 @@ final processTests = <IsolateTest>[
|
|||
all.processes[2].id,
|
||||
);
|
||||
|
||||
expect(third.name, dartJITBinary);
|
||||
expect(io.Platform.resolvedExecutable, contains(third.name.trim()));
|
||||
expect(third.pid, equals(setup.json!['pids']![2]));
|
||||
expect(third.pid != first.pid, isTrue);
|
||||
expect(third.pid != second.pid, isTrue);
|
||||
|
@ -148,5 +155,9 @@ final processTests = <IsolateTest>[
|
|||
},
|
||||
];
|
||||
|
||||
main(args) async =>
|
||||
runIsolateTests(args, processTests, testeeBefore: setupProcesses);
|
||||
main([args = const <String>[]]) async => runIsolateTests(
|
||||
args,
|
||||
processTests,
|
||||
'process_service_test.dart',
|
||||
testeeBefore: setupProcesses,
|
||||
);
|
||||
|
|
|
@ -24,4 +24,8 @@ var tests = <IsolateTest>[
|
|||
}
|
||||
];
|
||||
|
||||
main([args = const <String>[]]) => runIsolateTests(args, tests);
|
||||
main([args = const <String>[]]) => runIsolateTests(
|
||||
args,
|
||||
tests,
|
||||
'regress_44588_test.dart',
|
||||
);
|
||||
|
|
|
@ -20,4 +20,8 @@ var tests = <VMTest>[
|
|||
},
|
||||
];
|
||||
|
||||
main([args = const <String>[]]) async => await runVMTests(args, tests);
|
||||
main([args = const <String>[]]) async => await runVMTests(
|
||||
args,
|
||||
tests,
|
||||
'throws_sentinel_test.dart',
|
||||
);
|
||||
|
|
Loading…
Reference in a new issue