[infra] Prevent VM AOT tests from poluting SDK source.
Extend test_runner VMOptions support with an ability to specify
paths relative to temporary compilation directory.
// VMOptions=--foo=$TEST_COMPILATION_DIR/foo.file
The same directory will also be passed as an environment variable
to execution command.
Migrate most of the tests which used to write stuff into the SDK
root to use this feature. I am leaving vm/dart/causal/* tests
unmigrated because migrating requires time consuming manual
update of expectations (which encode raw line numbers). I have
a follow up CL which changes how these tests are written which
will make migration trivial.
Change-Id: Id53008be66de8ff18623efac27ff15750f407749
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/300600
Reviewed-by: William Hesse <whesse@google.com>
Commit-Queue: Slava Egorov <vegorov@google.com>
This commit is contained in:
committed by
Commit Queue
parent
e3275641a3
commit
19e56613cf
@@ -104,8 +104,3 @@ tools/xcodebuild
|
||||
/pkg/front_end/testcases/old_dills/
|
||||
logs/logs.json
|
||||
logs/results.json
|
||||
/async_lazy_debug.so
|
||||
/dwarf.so
|
||||
/dwarf_obfuscate.so
|
||||
/il_tmp.txt
|
||||
|
||||
|
||||
@@ -812,12 +812,11 @@ class StandardTestSuite extends TestSuite {
|
||||
var commands = <Command>[];
|
||||
var compilerConfiguration = configuration.compilerConfiguration;
|
||||
|
||||
var environment = {...environmentOverrides, ...testFile.environment};
|
||||
var compileTimeArguments = <String>[];
|
||||
String tempDir;
|
||||
CommandArtifact? compilationArtifact;
|
||||
if (compilerConfiguration.hasCompiler) {
|
||||
compileTimeArguments = compilerConfiguration.computeCompilerArguments(
|
||||
testFile, vmOptions, args);
|
||||
// Avoid doing this for analyzer.
|
||||
var path = testFile.path;
|
||||
if (vmOptionsVariant != 0) {
|
||||
@@ -826,6 +825,15 @@ class StandardTestSuite extends TestSuite {
|
||||
}
|
||||
tempDir = createCompilationOutputDirectory(path);
|
||||
|
||||
vmOptions = [
|
||||
for (var opt in vmOptions)
|
||||
opt.replaceAll(r'$TEST_COMPILATION_DIR', tempDir)
|
||||
];
|
||||
environment['TEST_COMPILATION_DIR'] = tempDir;
|
||||
|
||||
compileTimeArguments = compilerConfiguration.computeCompilerArguments(
|
||||
testFile, vmOptions, args);
|
||||
|
||||
for (var name in testFile.otherResources) {
|
||||
var namePath = Path(name);
|
||||
var fromPath = testFile.path.directoryPath.join(namePath);
|
||||
@@ -845,10 +853,10 @@ class StandardTestSuite extends TestSuite {
|
||||
return commands;
|
||||
}
|
||||
|
||||
vmOptions = vmOptions
|
||||
.map((s) =>
|
||||
s.replaceAll("__RANDOM__", "${Random().nextInt(0x7fffffff)}"))
|
||||
.toList();
|
||||
vmOptions = [
|
||||
for (var opt in vmOptions)
|
||||
opt.replaceAll("__RANDOM__", "${Random().nextInt(0x7fffffff)}")
|
||||
];
|
||||
|
||||
var runtimeArguments = compilerConfiguration.computeRuntimeArguments(
|
||||
configuration.runtimeConfiguration,
|
||||
@@ -857,8 +865,6 @@ class StandardTestSuite extends TestSuite {
|
||||
args,
|
||||
compilationArtifact);
|
||||
|
||||
var environment = {...environmentOverrides, ...testFile.environment};
|
||||
|
||||
return commands
|
||||
..addAll(configuration.runtimeConfiguration.computeRuntimeCommands(
|
||||
compilationArtifact,
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
// 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.
|
||||
|
||||
/// VMOptions=--dwarf-stack-traces --save-debugging-info=dwarf_invisible_functions.so
|
||||
/// VMOptions=--dwarf-stack-traces --save-debugging-info=$TEST_COMPILATION_DIR/dwarf_invisible_functions.so
|
||||
|
||||
import 'dart:io';
|
||||
|
||||
@@ -67,7 +67,9 @@ Future<void> main() async {
|
||||
return; // Generated dwarf.so not available on the test device.
|
||||
}
|
||||
|
||||
final dwarf = Dwarf.fromFile("dwarf_invisible_functions.so")!;
|
||||
final dwarf = Dwarf.fromFile(path.join(
|
||||
Platform.environment["TEST_COMPILATION_DIR"]!,
|
||||
"dwarf_invisible_functions.so"))!;
|
||||
|
||||
await dwarf_stack_trace_test.checkStackTrace(
|
||||
rawStack, dwarf, expectedCallsInfo);
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
// 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.
|
||||
|
||||
/// VMOptions=--dwarf-stack-traces --save-debugging-info=dwarf_obfuscate.so --obfuscate
|
||||
/// VMOptions=--dwarf-stack-traces --save-debugging-info=$TEST_COMPILATION_DIR/dwarf_obfuscate.so --obfuscate
|
||||
|
||||
import 'dart:io';
|
||||
|
||||
@@ -40,7 +40,8 @@ Future<void> main() async {
|
||||
return; // Generated dwarf.so not available on the test device.
|
||||
}
|
||||
|
||||
final dwarf = Dwarf.fromFile("dwarf_obfuscate.so")!;
|
||||
final dwarf = Dwarf.fromFile(path.join(
|
||||
Platform.environment['TEST_COMPILATION_DIR']!, "dwarf_obfuscate.so"))!;
|
||||
|
||||
await base.checkStackTrace(rawStack, dwarf, expectedCallsInfo);
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
// 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.
|
||||
|
||||
/// VMOptions=--dwarf-stack-traces --save-debugging-info=dwarf.so
|
||||
/// VMOptions=--dwarf-stack-traces --save-debugging-info=$TEST_COMPILATION_DIR/dwarf.so
|
||||
|
||||
import 'dart:convert';
|
||||
import 'dart:io';
|
||||
@@ -40,7 +40,8 @@ Future<void> main() async {
|
||||
return; // Generated dwarf.so not available on the test device.
|
||||
}
|
||||
|
||||
final dwarf = Dwarf.fromFile("dwarf.so")!;
|
||||
final dwarf = Dwarf.fromFile(
|
||||
path.join(Platform.environment["TEST_COMPILATION_DIR"]!, "dwarf.so"))!;
|
||||
|
||||
await checkStackTrace(rawStack, dwarf, expectedCallsInfo);
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
// 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.
|
||||
//
|
||||
// VMOptions=--dwarf-stack-traces --save-debugging-info=socket_connect_debug.so
|
||||
// VMOptions=--dwarf-stack-traces --save-debugging-info=$TEST_COMPILATION_DIR/socket_connect_debug.so
|
||||
//
|
||||
// Tests stack trace on socket exceptions.
|
||||
//
|
||||
@@ -14,6 +14,7 @@ import "dart:io";
|
||||
import "package:async_helper/async_helper.dart";
|
||||
import "package:expect/expect.dart";
|
||||
import "package:native_stack_traces/native_stack_traces.dart";
|
||||
import "package:path/path.dart" as path;
|
||||
|
||||
Future<List<String>> findFrames(
|
||||
Dwarf dwarf, RegExp re, StackTrace stackTrace) async {
|
||||
@@ -28,7 +29,9 @@ Future<List<String>> findFrames(
|
||||
|
||||
Future<void> main() async {
|
||||
asyncStart();
|
||||
final dwarf = Dwarf.fromFile('socket_connect_debug.so')!;
|
||||
final dwarf = Dwarf.fromFile(path.join(
|
||||
Platform.environment['TEST_COMPILATION_DIR']!,
|
||||
'socket_connect_debug.so'))!;
|
||||
// Test stacktrace when lookup fails
|
||||
try {
|
||||
await WebSocket.connect('ws://localhost.tld:0/ws');
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
// @dart = 2.9
|
||||
|
||||
// VMOptions=--dwarf-stack-traces --save-debugging-info=dwarf_invisible_functions.so
|
||||
// VMOptions=--dwarf-stack-traces --save-debugging-info=$TEST_COMPILATION_DIR/dwarf_invisible_functions.so
|
||||
|
||||
import 'dart:io';
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
// @dart = 2.9
|
||||
|
||||
/// VMOptions=--dwarf-stack-traces --save-debugging-info=dwarf_obfuscate.so --obfuscate
|
||||
/// VMOptions=--dwarf-stack-traces --save-debugging-info=$TEST_COMPILATION_DIR/dwarf_obfuscate.so --obfuscate
|
||||
|
||||
import 'dart:io';
|
||||
|
||||
@@ -42,7 +42,8 @@ Future<void> main() async {
|
||||
return; // Generated dwarf.so not available on the test device.
|
||||
}
|
||||
|
||||
final dwarf = Dwarf.fromFile("dwarf_obfuscate.so");
|
||||
final dwarf = Dwarf.fromFile(path.join(
|
||||
Platform.environment['TEST_COMPILATION_DIR'], "dwarf_obfuscate.so"));
|
||||
|
||||
await base.checkStackTrace(rawStack, dwarf, expectedCallsInfo);
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
// @dart = 2.9
|
||||
|
||||
/// VMOptions=--dwarf-stack-traces --save-debugging-info=dwarf.so
|
||||
/// VMOptions=--dwarf-stack-traces --save-debugging-info=$TEST_COMPILATION_DIR/dwarf.so
|
||||
|
||||
import 'dart:convert';
|
||||
import 'dart:io';
|
||||
@@ -42,7 +42,8 @@ Future<void> main() async {
|
||||
return; // Generated dwarf.so not available on the test device.
|
||||
}
|
||||
|
||||
final dwarf = Dwarf.fromFile("dwarf.so");
|
||||
final dwarf = Dwarf.fromFile(
|
||||
path.join(Platform.environment['TEST_COMPILATION_DIR'], "dwarf.so"));
|
||||
|
||||
await checkStackTrace(rawStack, dwarf, expectedCallsInfo);
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
// 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.
|
||||
//
|
||||
// VMOptions=--dwarf-stack-traces --save-debugging-info=socket_connect_debug.so
|
||||
// VMOptions=--dwarf-stack-traces --save-debugging-info=$TEST_COMPILATION_DIR/socket_connect_debug.so
|
||||
//
|
||||
// Tests stack trace on socket exceptions.
|
||||
//
|
||||
@@ -14,6 +14,7 @@ import "dart:io";
|
||||
import "package:async_helper/async_helper.dart";
|
||||
import "package:expect/expect.dart";
|
||||
import "package:native_stack_traces/native_stack_traces.dart";
|
||||
import "package:path/path.dart";
|
||||
|
||||
Future<List<String>> findFrames(
|
||||
Dwarf dwarf, RegExp re, StackTrace stackTrace) async {
|
||||
@@ -28,7 +29,8 @@ Future<List<String>> findFrames(
|
||||
|
||||
Future<void> main() async {
|
||||
asyncStart();
|
||||
final dwarfFromFile = Dwarf.fromFile('socket_connect_debug.so');
|
||||
final dwarfFromFile = Dwarf.fromFile(path.join(
|
||||
Platform.environment['TEST_COMPILATION_DIR'], 'socket_connect_debug.so'));
|
||||
if (dwarfFromFile == null) {
|
||||
Expect.fail('Debug binary is missing');
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user