Skip to content

Commit 1b4a566

Browse files
rmacnak-googleCommit Queue
authored andcommitted
[test_runner] Use relative paths in commands.
This makes it easier to copy commands between checkouts or between the bot and local development. Change-Id: I74bc9dcb83855e295fe40fa4ef81871ccc537d29 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/400180 Reviewed-by: Alexander Aprelev <[email protected]> Commit-Queue: Ryan Macnak <[email protected]>
1 parent 8f1a2b3 commit 1b4a566

File tree

4 files changed

+10
-8
lines changed

4 files changed

+10
-8
lines changed

pkg/test_runner/lib/src/compiler_configuration.dart

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1428,8 +1428,7 @@ abstract mixin class VMKernelCompilerMixin {
14281428

14291429
Command computeCompileToKernelCommand(String tempDir, List<String> arguments,
14301430
Map<String, String> environmentOverrides) {
1431-
var pkgVmDir = Platform.script.resolve('../../../pkg/vm').toFilePath();
1432-
var genKernel = '$pkgVmDir/tool/gen_kernel$shellScriptExtension';
1431+
var genKernel = 'pkg/vm/tool/gen_kernel$shellScriptExtension';
14331432

14341433
var kernelBinariesFolder = _configuration.buildDirectory;
14351434
if (_useSdk) {

pkg/test_runner/lib/src/test_suite.dart

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,6 @@ abstract class TestSuite {
226226

227227
TestUtils.mkdirRecursive(Path('.'), generatedTestPath);
228228
return File(generatedTestPath.toNativePath())
229-
.absolute
230229
.path
231230
.replaceAll('\\', '/');
232231
}
@@ -344,7 +343,7 @@ class VMTestSuite extends TestSuite {
344343
configuration.architecture == Architecture.x64c
345344
? '$buildDir/gen/kernel-service.dart.snapshot'
346345
: '$buildDir/gen/kernel_service.dill';
347-
var dfePath = Path(filename).absolute.toNativePath();
346+
var dfePath = Path(filename).toNativePath();
348347
final experiments = [...configuration.experiments];
349348
var args = [
350349
...initialTargetArguments,
@@ -955,8 +954,7 @@ class StandardTestSuite extends TestSuite {
955954
var nameFromModuleRoot = testFile.path.relativeTo(Repository.dir);
956955
var nameFromModuleRootNoExt =
957956
"${nameFromModuleRoot.directoryPath}/$nameNoExt";
958-
var jsDir =
959-
Path(compilationTempDir).relativeTo(Repository.dir).toString();
957+
var jsDir = Path(compilationTempDir).toString();
960958
var nativeNonNullAsserts =
961959
testFile.ddcOptions.contains('--native-null-assertions');
962960
var jsInteropNonNullAsserts =
@@ -1032,15 +1030,16 @@ class StandardTestSuite extends TestSuite {
10321030
args.add('--format=json');
10331031
}
10341032

1035-
args.add(testFile.path.toNativePath());
1033+
args.add(testFile.path.relativeTo(Repository.dir).toNativePath());
10361034

10371035
return args;
10381036
}
10391037

10401038
String? packagesArgument(String? packages) {
10411039
// If this test is inside a package, we will check if there is a
10421040
// pubspec.yaml file and if so, create a custom package root for it.
1043-
packages ??= Path(configuration.packages).toNativePath();
1041+
packages ??=
1042+
Path(configuration.packages).relativeTo(Repository.dir).toNativePath();
10441043

10451044
if (packages == 'none') {
10461045
return null;

tests/standalone/io/process_non_ascii_test.dart

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,14 @@ main() {
2626
var nonAsciiTxtFile = new File('${nonAsciiDir.path}/æøå.txt');
2727
nonAsciiTxtFile.writeAsStringSync('æøå');
2828
var script = nonAsciiFile.path;
29+
var absolutePackages = Uri.parse(Platform.packageConfig!).toFilePath();
2930
// Note: we prevent this child process from using Crashpad handler because
3031
// this introduces an issue with deleting the temporary directory.
3132
Process.run(
3233
executable,
3334
[]
3435
..addAll(Platform.executableArguments)
36+
..add("--packages=$absolutePackages")
3537
..add(script),
3638
workingDirectory: nonAsciiDir.path,
3739
environment: {'DART_CRASHPAD_HANDLER': ''},

tests/standalone/io/regress_7679_test.dart

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,12 +35,14 @@ main() {
3535
}
3636
""");
3737
String executable = new File(Platform.executable).resolveSymbolicLinksSync();
38+
String absolutePackages = Uri.parse(Platform.packageConfig!).toFilePath();
3839
// Note: we prevent this child process from using Crashpad handler because
3940
// this introduces an issue with deleting the temporary directory.
4041
Process.run(
4142
executable,
4243
[]
4344
..addAll(Platform.executableArguments)
45+
..add("--packages=$absolutePackages")
4446
..add('script.dart'),
4547
workingDirectory: temp.path,
4648
environment: {'DART_CRASHPAD_HANDLER': ''},

0 commit comments

Comments
 (0)