[modular_test] second attempt to fix shards.

Turns out the old code was also checking for the presence of the DEPS file.
This is not necessary, it was only done as a safeguard in case we had multiple
folders with the same name lying around. We could add DEPS to the set of files
sent to the shard, but that seems unnecesary here.

Fixes #53059

Change-Id: I83fc2569f42117c5fc4ea90c651cd7627a21a9ba
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/316700
Reviewed-by: Srujan Gaddam <srujzs@google.com>
Commit-Queue: Sigmund Cherem <sigmund@google.com>
This commit is contained in:
Sigmund Cherem 2023-07-27 22:29:07 +00:00 committed by Commit Queue
parent 5f4a6f4629
commit 862d974619

View file

@ -13,18 +13,12 @@ import 'dart:io';
/// Note: we don't search for the directory "sdk" because this may not be
/// available when running this test in a shard.
Future<Uri> findRoot() async {
Uri current = Platform.script;
while (true) {
var segments = current.pathSegments;
var index = segments.lastIndexOf('pkg');
if (index == -1) {
exitCode = 1;
throw "error: cannot find the root of the Dart SDK";
}
current = current.resolve("../" * (segments.length - index - 1));
if (await File.fromUri(current.resolve("DEPS")).exists()) {
break;
}
Uri script = Platform.script;
var segments = script.pathSegments;
var index = segments.lastIndexOf('pkg');
if (index == -1) {
exitCode = 1;
throw "error: cannot find the root of the Dart SDK";
}
return current;
return script.resolve("../" * (segments.length - index - 1));
}