| 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 1899 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1910 | 1910 |
| 1911 /** | 1911 /** |
| 1912 * Copy a [source] file to a new place. | 1912 * Copy a [source] file to a new place. |
| 1913 * Assumes that the directory for [dest] already exists. | 1913 * Assumes that the directory for [dest] already exists. |
| 1914 */ | 1914 */ |
| 1915 static Future copyFile(Path source, Path dest) { | 1915 static Future copyFile(Path source, Path dest) { |
| 1916 return new File(source.toNativePath()).openRead() | 1916 return new File(source.toNativePath()).openRead() |
| 1917 .pipe(new File(dest.toNativePath()).openWrite()); | 1917 .pipe(new File(dest.toNativePath()).openWrite()); |
| 1918 } | 1918 } |
| 1919 | 1919 |
| 1920 static Future isContentEqual(Path source, Path dest) { | |
| 1921 return new File(source.toNativePath()).readAsString() | |
| 1922 .then((srcString) { | |
| 1923 return new File(dest.toNativePath()).readAsString() | |
| 1924 .then((destString) => srcString == destString); | |
| 1925 }) | |
| 1926 .catchError((error) { | |
| 1927 return false; | |
| 1928 }); | |
| 1929 } | |
| 1930 | |
| 1931 static Future copyIfDifferent(Path source, Path dest) { | |
| 1932 return isContentEqual(source, dest).then((equal) { | |
| 1933 return equal ? null : TestUtils.copyFile(source, dest); | |
| 1934 }); | |
| 1935 } | |
| 1936 | |
| 1937 static Future copyDirectory(String source, String dest) { | 1920 static Future copyDirectory(String source, String dest) { |
| 1938 source = new Path(source).toNativePath(); | 1921 source = new Path(source).toNativePath(); |
| 1939 dest = new Path(dest).toNativePath(); | 1922 dest = new Path(dest).toNativePath(); |
| 1940 | 1923 |
| 1941 var executable = 'cp'; | 1924 var executable = 'cp'; |
| 1942 var args = ['-Rp', source, dest]; | 1925 var args = ['-Rp', source, dest]; |
| 1943 if (Platform.operatingSystem == 'windows') { | 1926 if (Platform.operatingSystem == 'windows') { |
| 1944 executable = 'xcopy'; | 1927 executable = 'xcopy'; |
| 1945 args = [source, dest, '/e', '/i']; | 1928 args = [source, dest, '/e', '/i']; |
| 1946 } | 1929 } |
| (...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2157 path.length > WINDOWS_SHORTEN_PATH_LIMIT) { | 2140 path.length > WINDOWS_SHORTEN_PATH_LIMIT) { |
| 2158 for (var key in PATH_REPLACEMENTS.keys) { | 2141 for (var key in PATH_REPLACEMENTS.keys) { |
| 2159 if (path.startsWith(key)) { | 2142 if (path.startsWith(key)) { |
| 2160 path = path.replaceFirst(key, PATH_REPLACEMENTS[key]); | 2143 path = path.replaceFirst(key, PATH_REPLACEMENTS[key]); |
| 2161 break; | 2144 break; |
| 2162 } | 2145 } |
| 2163 } | 2146 } |
| 2164 } | 2147 } |
| 2165 return path; | 2148 return path; |
| 2166 } | 2149 } |
| 2167 | |
| 2168 static String cachedOutputFile(String outputFile) { | |
| 2169 return "$outputFile.cached_output"; | |
| 2170 } | |
| 2171 | |
| 2172 } | 2150 } |
| 2173 | 2151 |
| 2174 class SummaryReport { | 2152 class SummaryReport { |
| 2175 static int total = 0; | 2153 static int total = 0; |
| 2176 static int skipped = 0; | 2154 static int skipped = 0; |
| 2177 static int skippedByDesign = 0; | 2155 static int skippedByDesign = 0; |
| 2178 static int noCrash = 0; | 2156 static int noCrash = 0; |
| 2179 static int pass = 0; | 2157 static int pass = 0; |
| 2180 static int failOk = 0; | 2158 static int failOk = 0; |
| 2181 static int fail = 0; | 2159 static int fail = 0; |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2233 * $pass tests are expected to pass | 2211 * $pass tests are expected to pass |
| 2234 * $failOk tests are expected to fail that we won't fix | 2212 * $failOk tests are expected to fail that we won't fix |
| 2235 * $fail tests are expected to fail that we should fix | 2213 * $fail tests are expected to fail that we should fix |
| 2236 * $crash tests are expected to crash that we should fix | 2214 * $crash tests are expected to crash that we should fix |
| 2237 * $timeout tests are allowed to timeout | 2215 * $timeout tests are allowed to timeout |
| 2238 * $compileErrorSkip tests are skipped on browsers due to compile-time error | 2216 * $compileErrorSkip tests are skipped on browsers due to compile-time error |
| 2239 """; | 2217 """; |
| 2240 print(report); | 2218 print(report); |
| 2241 } | 2219 } |
| 2242 } | 2220 } |
| OLD | NEW |