Bug 67462 - fix MockFileSystem.glob(), refactor filesystem tests
Summary: fix MockFileSystem.glob(), refactor filesystem tests
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: New Bugs (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Dirk Pranke
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-09-01 19:17 PDT by Dirk Pranke
Modified: 2022-02-27 23:45 PST (History)
2 users (show)

See Also:


Attachments
Patch (8.45 KB, patch)
2011-09-01 19:55 PDT, Dirk Pranke
eric: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Dirk Pranke 2011-09-01 19:17:24 PDT
fix MockFileSystem.glob(), refactor filesystem tests
Comment 1 Dirk Pranke 2011-09-01 19:55:59 PDT
Created attachment 106085 [details]
Patch
Comment 2 Eric Seidel (no email) 2011-09-01 20:03:45 PDT
Comment on attachment 106085 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=106085&action=review

OK.

> Tools/Scripts/webkitpy/common/system/filesystem_mock.py:155
> +        glob_string = glob_string.replace('\\*', '[^\\/]*') + '$'
> +        glob_string = glob_string.replace('\\/', '/')
> +        path_filter = lambda path: re.match(glob_string, path)

This is going to end up matching . in glob_string against any char.  Which is OK, but you shoudl be aware.
Comment 3 Dirk Pranke 2011-09-01 20:21:24 PDT
Comment on attachment 106085 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=106085&action=review

>> Tools/Scripts/webkitpy/common/system/filesystem_mock.py:155
>> +        path_filter = lambda path: re.match(glob_string, path)
> 
> This is going to end up matching . in glob_string against any char.  Which is OK, but you shoudl be aware.

If I understand you correctly (you're saying that glob('foo.ar') will match a file called 'foobar', I don't think so; the '.' in glob string is escaped out on line 152. Or am I missing something?
Comment 4 Eric Seidel (no email) 2011-09-01 20:29:56 PDT
Comment on attachment 106085 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=106085&action=review

>>> Tools/Scripts/webkitpy/common/system/filesystem_mock.py:155
>>> +        path_filter = lambda path: re.match(glob_string, path)
>> 
>> This is going to end up matching . in glob_string against any char.  Which is OK, but you shoudl be aware.
> 
> If I understand you correctly (you're saying that glob('foo.ar') will match a file called 'foobar', I don't think so; the '.' in glob string is escaped out on line 152. Or am I missing something?

Ah, I missed the regexp escape.
Comment 5 Dirk Pranke 2011-09-01 20:40:58 PDT
(In reply to comment #4)
> Ah, I missed the regexp escape.

Okay. Probably would be a good thing to test for, though. I'll add a test. Thanks!
Comment 6 Dirk Pranke 2011-09-06 18:42:53 PDT
Committed r94618: <http://trac.webkit.org/changeset/94618>