[Tests] Fix inifinite replication of Dart processes in tests

When tests are executed on certain configurations like dartkb or simarm,
the test script is first compiled into a dill file, so the VM command
line for running a test looks like

dart .../generated_compilations/dartkb/foo_test/out.dill

Certain tests have the logic to replace '_test.dart' in Platform.script
with '_test_body.dart' and execute the resulting script.
However, as out.dill does not contain '_test.dart', the script remains
the same after replacement. As a result, test was infinitely re-executing
itself, overloading bots and not making any progress.

Change-Id: I7257d3553a7f0a0de2f6d8218a9eb5c8981af17d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/98685
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Auto-Submit: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
This commit is contained in:
Alexander Markov 2019-04-04 19:14:44 +00:00 committed by commit-bot@chromium.org
parent 69ff056b51
commit 652a8be7a7
5 changed files with 22 additions and 14 deletions

View file

@ -2,11 +2,15 @@
// 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.
// OtherResources=appjit_bytecode_simple_test_body.dart
// Verify that app-jit snapshot contains dependencies between classes and CHA
// optimized code.
import 'dart:async';
import 'dart:io' show Platform;
import 'snapshot_test_helper.dart';
Future<void> main() => runAppJitBytecodeTest();
Future<void> main() => runAppJitBytecodeTest(
Platform.script.resolve('appjit_bytecode_simple_test_body.dart'));

View file

@ -2,13 +2,16 @@
// 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.
// OtherResources=appjit_cha_deopt_test_body.dart
// VMOptions=--optimization-counter-threshold=100
// Verify that app-jit snapshot contains dependencies between classes and CHA
// optimized code.
import 'dart:async';
import 'dart:io' show Platform;
import 'snapshot_test_helper.dart';
Future<void> main() => runAppJitTest();
Future<void> main() =>
runAppJitTest(Platform.script.resolve('appjit_cha_deopt_test_body.dart'));

View file

@ -2,11 +2,15 @@
// 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.
// OtherResources=appjit_load_static_licm_test_body.dart
// Verify that app-jit snapshot contains dependencies between classes and CHA
// optimized code.
import 'dart:async';
import 'dart:io' show Platform;
import 'snapshot_test_helper.dart';
Future<void> main() => runAppJitTest();
Future<void> main() => runAppJitTest(
Platform.script.resolve('appjit_load_static_licm_test_body.dart'));

View file

@ -151,12 +151,10 @@ checkDeterministicSnapshot(String snapshotKind, String expectedStdout) async {
});
}
runAppJitTest() async {
runAppJitTest(Uri testScriptUri) async {
await withTempDir((String temp) async {
final snapshotPath = p.join(temp, 'app.jit');
final testPath = Platform.script
.toFilePath()
.replaceAll(new RegExp(r'_test.dart$'), '_test_body.dart');
final testPath = testScriptUri.toFilePath();
final trainingResult = await runDart('TRAINING RUN', [
'--snapshot=$snapshotPath',
@ -170,12 +168,10 @@ runAppJitTest() async {
});
}
Future<void> runAppJitBytecodeTest() async {
Future<void> runAppJitBytecodeTest(Uri testScriptUri) async {
await withTempDir((String temp) async {
final snapshotPath = p.join(temp, 'app.jit');
final testPath = Platform.script
.toFilePath()
.replaceAll(new RegExp(r'_test.dart$'), '_test_body.dart');
final testPath = testScriptUri.toFilePath();
final trainingResult = await runDart('TRAINING RUN', [
'--enable_interpreter',

View file

@ -4,6 +4,7 @@
//
// OtherResources=certificates/server_chain.pem
// OtherResources=certificates/server_key.pem
// OtherResources=secure_socket_renegotiate_client.dart
// This test verifies that client certificates work, if the client and server
// are in separate processes, and that connection renegotiation works, and
@ -66,10 +67,10 @@ Future<SecureServerSocket> runServer() {
void main() {
runServer().then((SecureServerSocket server) {
var clientScript =
Platform.script.toFilePath().replaceFirst("_test.dart", "_client.dart");
Expect.isTrue(clientScript.endsWith("_client.dart"));
Platform.script.resolve('secure_socket_renegotiate_client.dart').toFilePath();
Process
.run(Platform.executable, [clientScript, server.port.toString()]).then(
.run(Platform.executable,
[]..addAll(Platform.executableArguments)..addAll([clientScript, server.port.toString()])).then(
(ProcessResult result) {
if (result.exitCode != 0) {
print("Client failed, stdout:");