r201635 - Add an OverlayFileSystem class
Ben Langmuir
blangmuir at apple.com
Wed Feb 19 07:56:23 PST 2014
On Feb 19, 2014, at 2:07 AM, Dmitri Gribenko <gribozavr at gmail.com> wrote:
> On Wed, Feb 19, 2014 at 10:06 AM, Dmitri Gribenko <gribozavr at gmail.com> wrote:
>> On Wed, Feb 19, 2014 at 3:29 AM, Ben Langmuir <blangmuir at apple.com> wrote:
>>> +TEST(VirtualFileSystemTest, overlay_dirs) {
>>> + IntrusiveRefCntPtr<DummyFileSystem> Lower(new DummyFileSystem());
>>> + IntrusiveRefCntPtr<DummyFileSystem> Upper(new DummyFileSystem());
>>> + IntrusiveRefCntPtr<vfs::OverlayFileSystem>
>>> + O(new vfs::OverlayFileSystem(Lower));
>>> + O->pushOverlay(Upper);
>>> +
>>> + ErrorOr<vfs::Status> Status1((error_code())), Status2((error_code())),
>>> + Status3((error_code()));
>>> +
>>> + Lower->addDirectory("/lower-only");
>>> + Lower->addDirectory("/both");
>>> + Upper->addDirectory("/both");
>>> + Upper->addDirectory("/upper-only");
>>> +
>>> + // non-merged paths should be the same
>>> + ASSERT_TRUE(Status1 = Lower->status("/lower-only"));
>>> + ASSERT_TRUE(Status2 = O->status("/lower-only"));
>>> + EXPECT_TRUE(Status1->equivalent(*Status2));
>>> +
>>> + ASSERT_TRUE(Status1 = Lower->status("/lower-only"));
>>> + ASSERT_TRUE(Status2 = O->status("/lower-only"));
>>> + EXPECT_TRUE(Status1->equivalent(*Status2));
>>> +}
>>
>> What was the purpose of "/both" and Status3 in this test?
>
> Also, the second time it should probably be testing upper-only.
Hmm, originally I was checking that the unique ID for /both in the overlay was distinct from its value in either lower or upper. However, I decided that wasn’t worth implementing right now, as tracking it is expensive and might be pointless if no one ever looks at the UIDs for the original file systems. I guess I’ll remove that code. The permissions test covers checking that the merged directory looks correct.
And yes, the upper test was obviously wrong, thanks!
Ben
>
> Dmitri
>
> --
> main(i,j){for(i=2;;i++){for(j=2;j<i;j++){if(!(i%j)){j=0;break;}}if
> (j){printf("%d\n",i);}}} /*Dmitri Gribenko <gribozavr at gmail.com>*/
More information about the cfe-commits
mailing list