From 652a8be7a7ff1d98101490eea7c1944de4d7d5f5 Mon Sep 17 00:00:00 2001 From: Alexander Markov Date: Thu, 4 Apr 2019 19:14:44 +0000 Subject: [PATCH] [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 Auto-Submit: Alexander Markov Reviewed-by: Ryan Macnak --- .../tests/vm/dart/appjit_bytecode_simple_test.dart | 6 +++++- runtime/tests/vm/dart/appjit_cha_deopt_test.dart | 5 ++++- .../tests/vm/dart/appjit_load_static_licm_test.dart | 6 +++++- runtime/tests/vm/dart/snapshot_test_helper.dart | 12 ++++-------- .../io/secure_socket_renegotiate_test.dart | 7 ++++--- 5 files changed, 22 insertions(+), 14 deletions(-) diff --git a/runtime/tests/vm/dart/appjit_bytecode_simple_test.dart b/runtime/tests/vm/dart/appjit_bytecode_simple_test.dart index 66004825600..d9363398ccd 100644 --- a/runtime/tests/vm/dart/appjit_bytecode_simple_test.dart +++ b/runtime/tests/vm/dart/appjit_bytecode_simple_test.dart @@ -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 main() => runAppJitBytecodeTest(); +Future main() => runAppJitBytecodeTest( + Platform.script.resolve('appjit_bytecode_simple_test_body.dart')); diff --git a/runtime/tests/vm/dart/appjit_cha_deopt_test.dart b/runtime/tests/vm/dart/appjit_cha_deopt_test.dart index fabc41bf514..104d431f7e7 100644 --- a/runtime/tests/vm/dart/appjit_cha_deopt_test.dart +++ b/runtime/tests/vm/dart/appjit_cha_deopt_test.dart @@ -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 main() => runAppJitTest(); +Future main() => + runAppJitTest(Platform.script.resolve('appjit_cha_deopt_test_body.dart')); diff --git a/runtime/tests/vm/dart/appjit_load_static_licm_test.dart b/runtime/tests/vm/dart/appjit_load_static_licm_test.dart index 9f51b700125..804e30c4f4c 100644 --- a/runtime/tests/vm/dart/appjit_load_static_licm_test.dart +++ b/runtime/tests/vm/dart/appjit_load_static_licm_test.dart @@ -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 main() => runAppJitTest(); +Future main() => runAppJitTest( + Platform.script.resolve('appjit_load_static_licm_test_body.dart')); diff --git a/runtime/tests/vm/dart/snapshot_test_helper.dart b/runtime/tests/vm/dart/snapshot_test_helper.dart index 0a043aff50b..5c63da1f1a6 100644 --- a/runtime/tests/vm/dart/snapshot_test_helper.dart +++ b/runtime/tests/vm/dart/snapshot_test_helper.dart @@ -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 runAppJitBytecodeTest() async { +Future 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', diff --git a/tests/standalone_2/io/secure_socket_renegotiate_test.dart b/tests/standalone_2/io/secure_socket_renegotiate_test.dart index e527da9caf7..d10e7430f23 100644 --- a/tests/standalone_2/io/secure_socket_renegotiate_test.dart +++ b/tests/standalone_2/io/secure_socket_renegotiate_test.dart @@ -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 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:");