Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(233)

Side by Side Diff: tools/testing/dart/test_suite.dart

Issue 2104333002: Ensure short path names for generated tests on Windows, in test runner. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 /** 5 /**
6 * Classes and methods for enumerating and preparing tests. 6 * Classes and methods for enumerating and preparing tests.
7 * 7 *
8 * This library includes: 8 * This library includes:
9 * 9 *
10 * - Creating tests by listing all the Dart files in certain directories, 10 * - Creating tests by listing all the Dart files in certain directories,
(...skipping 2376 matching lines...) Expand 10 before | Expand all | Expand 10 after
2387 .where((s) => s.isNotEmpty) 2387 .where((s) => s.isNotEmpty)
2388 .toList(); 2388 .toList();
2389 } 2389 }
2390 2390
2391 /** 2391 /**
2392 * Gets extra vm options passed to the testing script. 2392 * Gets extra vm options passed to the testing script.
2393 */ 2393 */
2394 static List<String> getExtraVmOptions(Map configuration) => 2394 static List<String> getExtraVmOptions(Map configuration) =>
2395 getExtraOptions(configuration, 'vm_options'); 2395 getExtraOptions(configuration, 'vm_options');
2396 2396
2397 static int shortNameCounter = 0; // Make unique short file names on Windows.
2398
2397 static String getShortName(String path) { 2399 static String getShortName(String path) {
2398 final PATH_REPLACEMENTS = const { 2400 final PATH_REPLACEMENTS = const {
2399 "pkg_polymer_e2e_test_bad_import_test": "polymer_bi", 2401 "pkg_polymer_e2e_test_bad_import_test": "polymer_bi",
2400 "pkg_polymer_e2e_test_canonicalization_test": "polymer_c16n", 2402 "pkg_polymer_e2e_test_canonicalization_test": "polymer_c16n",
2401 "pkg_polymer_e2e_test_experimental_boot_test": "polymer_boot", 2403 "pkg_polymer_e2e_test_experimental_boot_test": "polymer_boot",
2402 "pkg_polymer_e2e_test_good_import_test": "polymer_gi", 2404 "pkg_polymer_e2e_test_good_import_test": "polymer_gi",
2403 "tests_co19_src_Language_12_Expressions_14_Function_Invocation_": 2405 "tests_co19_src_Language_12_Expressions_14_Function_Invocation_":
2404 "co19_fn_invoke_", 2406 "co19_fn_invoke_",
2405 "tests_co19_src_LayoutTests_fast_css_getComputedStyle_getComputedStyle-": 2407 "tests_co19_src_LayoutTests_fast_css_getComputedStyle_getComputedStyle-":
2406 "co19_css_getComputedStyle_", 2408 "co19_css_getComputedStyle_",
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
2450 }; 2452 };
2451 2453
2452 // Some tests are already in [build_dir]/generated_tests. 2454 // Some tests are already in [build_dir]/generated_tests.
2453 String GEN_TESTS = 'generated_tests/'; 2455 String GEN_TESTS = 'generated_tests/';
2454 if (path.contains(GEN_TESTS)) { 2456 if (path.contains(GEN_TESTS)) {
2455 int index = path.indexOf(GEN_TESTS) + GEN_TESTS.length; 2457 int index = path.indexOf(GEN_TESTS) + GEN_TESTS.length;
2456 path = 'multitest/${path.substring(index)}'; 2458 path = 'multitest/${path.substring(index)}';
2457 } 2459 }
2458 path = path.replaceAll('/', '_'); 2460 path = path.replaceAll('/', '_');
2459 final int WINDOWS_SHORTEN_PATH_LIMIT = 58; 2461 final int WINDOWS_SHORTEN_PATH_LIMIT = 58;
2462 final int WINDOWS_PATH_END_LENGTH = 30;
2460 if (Platform.operatingSystem == 'windows' && 2463 if (Platform.operatingSystem == 'windows' &&
2461 path.length > WINDOWS_SHORTEN_PATH_LIMIT) { 2464 path.length > WINDOWS_SHORTEN_PATH_LIMIT) {
2462 for (var key in PATH_REPLACEMENTS.keys) { 2465 for (var key in PATH_REPLACEMENTS.keys) {
2463 if (path.startsWith(key)) { 2466 if (path.startsWith(key)) {
2464 path = path.replaceFirst(key, PATH_REPLACEMENTS[key]); 2467 path = path.replaceFirst(key, PATH_REPLACEMENTS[key]);
2465 break; 2468 break;
2466 } 2469 }
2467 } 2470 }
2471 if (path.length > WINDOWS_SHORTEN_PATH_LIMIT) {
2472 ++shortNameCounter;
2473 var pathEnd = path.substring(path.length - WINDOWS_PATH_END_LENGTH);
2474 path = "short${shortNameCounter}_$pathEnd";
Søren Gjesse 2016/06/29 15:35:56 Maybe add __ in front as well to lower the probabi
2475 }
2468 } 2476 }
2469 return path; 2477 return path;
2470 } 2478 }
2471 } 2479 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698