Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 1862 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1873 * script must set this to '.../dart/tools/test.dart'. | 1873 * script must set this to '.../dart/tools/test.dart'. |
| 1874 */ | 1874 */ |
| 1875 static String testScriptPath = new Path(Platform.script.path).toNativePath(); | 1875 static String testScriptPath = new Path(Platform.script.path).toNativePath(); |
| 1876 static LastModifiedCache lastModifiedCache = new LastModifiedCache(); | 1876 static LastModifiedCache lastModifiedCache = new LastModifiedCache(); |
| 1877 static ExistsCache existsCache = new ExistsCache(); | 1877 static ExistsCache existsCache = new ExistsCache(); |
| 1878 static Path currentWorkingDirectory = | 1878 static Path currentWorkingDirectory = |
| 1879 new Path(Directory.current.path); | 1879 new Path(Directory.current.path); |
| 1880 static Path dartDir = new Path(new File(testScriptPath).absolute.path) | 1880 static Path dartDir = new Path(new File(testScriptPath).absolute.path) |
| 1881 .directoryPath.directoryPath; | 1881 .directoryPath.directoryPath; |
| 1882 | 1882 |
| 1883 | |
|
Bill Hesse
2014/04/29 17:51:55
In the class below this, we don't have a double li
ricow1
2014/04/30 06:51:01
Done.
| |
| 1883 /** | 1884 /** |
| 1884 * Creates a directory using a [relativePath] to an existing | 1885 * Creates a directory using a [relativePath] to an existing |
| 1885 * [base] directory if that [relativePath] does not already exist. | 1886 * [base] directory if that [relativePath] does not already exist. |
| 1886 */ | 1887 */ |
| 1887 static Directory mkdirRecursive(Path base, Path relativePath) { | 1888 static Directory mkdirRecursive(Path base, Path relativePath) { |
| 1888 if (relativePath.isAbsolute) { | 1889 if (relativePath.isAbsolute) { |
| 1889 base = new Path('/'); | 1890 base = new Path('/'); |
| 1890 } | 1891 } |
| 1891 Directory dir = new Directory(base.toNativePath()); | 1892 Directory dir = new Directory(base.toNativePath()); |
| 1892 assert(dir.existsSync()); | 1893 assert(dir.existsSync()); |
| (...skipping 17 matching lines...) Expand all Loading... | |
| 1910 | 1911 |
| 1911 /** | 1912 /** |
| 1912 * Copy a [source] file to a new place. | 1913 * Copy a [source] file to a new place. |
| 1913 * Assumes that the directory for [dest] already exists. | 1914 * Assumes that the directory for [dest] already exists. |
| 1914 */ | 1915 */ |
| 1915 static Future copyFile(Path source, Path dest) { | 1916 static Future copyFile(Path source, Path dest) { |
| 1916 return new File(source.toNativePath()).openRead() | 1917 return new File(source.toNativePath()).openRead() |
| 1917 .pipe(new File(dest.toNativePath()).openWrite()); | 1918 .pipe(new File(dest.toNativePath()).openWrite()); |
| 1918 } | 1919 } |
| 1919 | 1920 |
| 1921 static Future isContentEqual(Path source, Path dest) { | |
| 1922 return new File(source.toNativePath()).readAsString() | |
| 1923 .then((srcString) { | |
| 1924 return new File(dest.toNativePath()).readAsString() | |
| 1925 .then((destString) => srcString == destString); | |
| 1926 }) | |
| 1927 .catchError((error) { | |
| 1928 return false; | |
| 1929 }); | |
| 1930 } | |
| 1931 | |
| 1920 static Future copyDirectory(String source, String dest) { | 1932 static Future copyDirectory(String source, String dest) { |
| 1921 source = new Path(source).toNativePath(); | 1933 source = new Path(source).toNativePath(); |
| 1922 dest = new Path(dest).toNativePath(); | 1934 dest = new Path(dest).toNativePath(); |
| 1923 | 1935 |
| 1924 var executable = 'cp'; | 1936 var executable = 'cp'; |
| 1925 var args = ['-Rp', source, dest]; | 1937 var args = ['-Rp', source, dest]; |
| 1926 if (Platform.operatingSystem == 'windows') { | 1938 if (Platform.operatingSystem == 'windows') { |
| 1927 executable = 'xcopy'; | 1939 executable = 'xcopy'; |
| 1928 args = [source, dest, '/e', '/i']; | 1940 args = [source, dest, '/e', '/i']; |
| 1929 } | 1941 } |
| (...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2138 path.length > WINDOWS_SHORTEN_PATH_LIMIT) { | 2150 path.length > WINDOWS_SHORTEN_PATH_LIMIT) { |
| 2139 for (var key in PATH_REPLACEMENTS.keys) { | 2151 for (var key in PATH_REPLACEMENTS.keys) { |
| 2140 if (path.startsWith(key)) { | 2152 if (path.startsWith(key)) { |
| 2141 path = path.replaceFirst(key, PATH_REPLACEMENTS[key]); | 2153 path = path.replaceFirst(key, PATH_REPLACEMENTS[key]); |
| 2142 break; | 2154 break; |
| 2143 } | 2155 } |
| 2144 } | 2156 } |
| 2145 } | 2157 } |
| 2146 return path; | 2158 return path; |
| 2147 } | 2159 } |
| 2160 | |
| 2161 static String cachedOutputFile(String outputFile) { | |
| 2162 return "$outputFile.cached_output"; | |
| 2163 } | |
| 2164 | |
| 2148 } | 2165 } |
| 2149 | 2166 |
| 2150 class SummaryReport { | 2167 class SummaryReport { |
| 2151 static int total = 0; | 2168 static int total = 0; |
| 2152 static int skipped = 0; | 2169 static int skipped = 0; |
| 2153 static int skippedByDesign = 0; | 2170 static int skippedByDesign = 0; |
| 2154 static int noCrash = 0; | 2171 static int noCrash = 0; |
| 2155 static int pass = 0; | 2172 static int pass = 0; |
| 2156 static int failOk = 0; | 2173 static int failOk = 0; |
| 2157 static int fail = 0; | 2174 static int fail = 0; |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2209 * $pass tests are expected to pass | 2226 * $pass tests are expected to pass |
| 2210 * $failOk tests are expected to fail that we won't fix | 2227 * $failOk tests are expected to fail that we won't fix |
| 2211 * $fail tests are expected to fail that we should fix | 2228 * $fail tests are expected to fail that we should fix |
| 2212 * $crash tests are expected to crash that we should fix | 2229 * $crash tests are expected to crash that we should fix |
| 2213 * $timeout tests are allowed to timeout | 2230 * $timeout tests are allowed to timeout |
| 2214 * $compileErrorSkip tests are skipped on browsers due to compile-time error | 2231 * $compileErrorSkip tests are skipped on browsers due to compile-time error |
| 2215 """; | 2232 """; |
| 2216 print(report); | 2233 print(report); |
| 2217 } | 2234 } |
| 2218 } | 2235 } |
| OLD | NEW |