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

Unified Diff: utils/testrunner/utils.dart

Issue 11093033: Added ability to have custom test HTTP server handlers in the test directories. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 2 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 side-by-side diff with in-line comments
Download patch
« utils/testrunner/run_pipeline.dart ('K') | « utils/testrunner/testrunner.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: utils/testrunner/utils.dart
===================================================================
--- utils/testrunner/utils.dart (revision 13447)
+++ utils/testrunner/utils.dart (working copy)
@@ -39,14 +39,29 @@
* Create the list of all the files in a set of directories
* ([dirs]) whose names match [filePat]. If [recurse] is true
* look at subdirectories too. Once they have all been enumerated,
- * call [onComplete].
+ * call [onComplete]. An optional [excludePat] can be supplied
+ * and files or directories that match that will be excluded.
+ * If [symLinks] is false, symlinks will be excluded.
Siggi Cherem (dart-lang) 2012/10/10 17:51:32 I rather name the variable 'includeSymLinks' and r
gram 2012/10/17 00:03:28 Done.
*/
+ // TODO(gram): The key thing here is we want to avoid package
+ // directories, which have symlinks. excludePat was added for
+ // that but can't currently be used because the symlinked files
+ // have canonicalized paths. So instead we exploit that fact and
+ // assert that every file must have a prefix that matches the
+ // directory. If this changes then we will need to switch to using
+ // the exclude pattern or some other mechanism.
+ //
+
void buildFileList(List dirs, RegExp filePat, bool recurse,
- Function onComplete) {
+ Function onComplete,
+ [RegExp excludePat, bool symLinks = false]) {
var files = new List();
var dirCount = 1;
for (var i = 0; i < dirs.length; i++) {
var path = dirs[i];
+ if (excludePat != null && excludePat.hasMatch(path)) {
+ continue;
+ }
// Is this a regular file?
File f = new File(path);
if (f.existsSync()) {
@@ -54,13 +69,18 @@
files.add(path);
}
} else { // Try treat it as a directory.
+ path = makePathAbsolute(path);
Directory d = new Directory(path);
if (d.existsSync()) {
++dirCount;
var lister = d.list(recursive: recurse);
lister.onFile = (file) {
if (filePat.hasMatch(file)) {
- files.add(file);
+ if (excludePat == null || !excludePat.hasMatch(file)) {
+ if (symLinks || file.startsWith(path)) {
+ files.add(file);
+ }
+ }
}
};
lister.onDone = (complete) {
« utils/testrunner/run_pipeline.dart ('K') | « utils/testrunner/testrunner.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698