Ensure short path names for generated tests on Windows, in test runner.
BUG=
R=sgjesse@google.com
Review URL: https://codereview.chromium.org/2104333002 .
diff --git a/tools/testing/dart/test_suite.dart b/tools/testing/dart/test_suite.dart
index ce30a73..c73dc7c 100644
--- a/tools/testing/dart/test_suite.dart
+++ b/tools/testing/dart/test_suite.dart
@@ -2394,6 +2394,8 @@
static List<String> getExtraVmOptions(Map configuration) =>
getExtraOptions(configuration, 'vm_options');
+ static int shortNameCounter = 0; // Make unique short file names on Windows.
+
static String getShortName(String path) {
final PATH_REPLACEMENTS = const {
"pkg_polymer_e2e_test_bad_import_test": "polymer_bi",
@@ -2457,6 +2459,7 @@
}
path = path.replaceAll('/', '_');
final int WINDOWS_SHORTEN_PATH_LIMIT = 58;
+ final int WINDOWS_PATH_END_LENGTH = 30;
if (Platform.operatingSystem == 'windows' &&
path.length > WINDOWS_SHORTEN_PATH_LIMIT) {
for (var key in PATH_REPLACEMENTS.keys) {
@@ -2465,6 +2468,11 @@
break;
}
}
+ if (path.length > WINDOWS_SHORTEN_PATH_LIMIT) {
+ ++shortNameCounter;
+ var pathEnd = path.substring(path.length - WINDOWS_PATH_END_LENGTH);
+ path = "short${shortNameCounter}_$pathEnd";
+ }
}
return path;
}