[libcxx] r278191 - test/hard_link_count(): Fix test on darwin

Adrian Prantl via cfe-commits cfe-commits at lists.llvm.org
Thu Aug 11 12:05:22 PDT 2016


I'm just curious: Is libcxx generally supposed to merely pass through what the operating system is returning (as in this case) or is is supposed to provide a common abstraction that behaves the same on all platforms?

-- adrian

> On Aug 10, 2016, at 8:23 PM, Eric Fiselier via cfe-commits <cfe-commits at lists.llvm.org> wrote:
> 
> Thanks Matthias. My apoligies, I lost track of this patch.
> 
> On Tue, Aug 9, 2016 at 7:31 PM, Bruno Cardoso Lopes via cfe-commits <cfe-commits at lists.llvm.org <mailto:cfe-commits at lists.llvm.org>> wrote:
> Thanks Matthias!
> 
> On Tue, Aug 9, 2016 at 6:02 PM, Matthias Braun via cfe-commits
> <cfe-commits at lists.llvm.org <mailto:cfe-commits at lists.llvm.org>> wrote:
> > Author: matze
> > Date: Tue Aug  9 20:02:28 2016
> > New Revision: 278191
> >
> > URL: http://llvm.org/viewvc/llvm-project?rev=278191&view=rev <http://llvm.org/viewvc/llvm-project?rev=278191&view=rev>
> > Log:
> > test/hard_link_count(): Fix test on darwin
> >
> > The hard link count that stat reports are different between normal hfs and the
> > case sensitive variant. Accept both.
> >
> > Modified:
> >     libcxx/trunk/test/std/experimental/filesystem/fs.op.funcs/fs.op.hard_lk_ct/hard_link_count.pass.cpp
> >
> > Modified: libcxx/trunk/test/std/experimental/filesystem/fs.op.funcs/fs.op.hard_lk_ct/hard_link_count.pass.cpp
> > URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/experimental/filesystem/fs.op.funcs/fs.op.hard_lk_ct/hard_link_count.pass.cpp?rev=278191&r1=278190&r2=278191&view=diff <http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/experimental/filesystem/fs.op.funcs/fs.op.hard_lk_ct/hard_link_count.pass.cpp?rev=278191&r1=278190&r2=278191&view=diff>
> > ==============================================================================
> > --- libcxx/trunk/test/std/experimental/filesystem/fs.op.funcs/fs.op.hard_lk_ct/hard_link_count.pass.cpp (original)
> > +++ libcxx/trunk/test/std/experimental/filesystem/fs.op.funcs/fs.op.hard_lk_ct/hard_link_count.pass.cpp Tue Aug  9 20:02:28 2016
> > @@ -45,18 +45,27 @@ TEST_CASE(hard_link_count_for_file)
> >
> >  TEST_CASE(hard_link_count_for_directory)
> >  {
> > -    uintmax_t DirExpect = 3;
> > -    uintmax_t Dir3Expect = 2;
> > +    uintmax_t DirExpect = 3; // hard link from . .. and Dir2
> > +    uintmax_t Dir3Expect = 2; // hard link from . ..
> > +    uintmax_t DirExpectAlt = DirExpect;
> > +    uintmax_t Dir3ExpectAlt = Dir3Expect;
> >  #if defined(__APPLE__)
> > -    DirExpect += 2;
> > -    Dir3Expect += 1;
> > +    // Filesystems formatted with case sensitive hfs+ behave unixish as
> > +    // expected. Normal hfs+ filesystems report the number of directory
> > +    // entries instead.
> > +    DirExpectAlt = 5; // .  ..  Dir2  file1  file2
> > +    Dir3Expect = 3; // .  ..  file5
> >  #endif
> > -    TEST_CHECK(hard_link_count(StaticEnv::Dir) == DirExpect);
> > -    TEST_CHECK(hard_link_count(StaticEnv::Dir3) == Dir3Expect);
> > +    TEST_CHECK(hard_link_count(StaticEnv::Dir) == DirExpect ||
> > +               hard_link_count(StaticEnv::Dir) == DirExpectAlt);
> > +    TEST_CHECK(hard_link_count(StaticEnv::Dir3) == Dir3Expect ||
> > +               hard_link_count(StaticEnv::Dir3) == Dir3ExpectAlt);
> >
> >      std::error_code ec;
> > -    TEST_CHECK(hard_link_count(StaticEnv::Dir, ec) == DirExpect);
> > -    TEST_CHECK(hard_link_count(StaticEnv::Dir3, ec) == Dir3Expect);
> > +    TEST_CHECK(hard_link_count(StaticEnv::Dir, ec) == DirExpect ||
> > +               hard_link_count(StaticEnv::Dir, ec) == DirExpectAlt);
> > +    TEST_CHECK(hard_link_count(StaticEnv::Dir3, ec) == Dir3Expect ||
> > +               hard_link_count(StaticEnv::Dir3, ec) == Dir3ExpectAlt);
> >  }
> >  TEST_CASE(hard_link_count_increments_test)
> >  {
> >
> >
> > _______________________________________________
> > cfe-commits mailing list
> > cfe-commits at lists.llvm.org <mailto:cfe-commits at lists.llvm.org>
> > http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits <http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits>
> 
> 
> 
> --
> Bruno Cardoso Lopes
> http://www.brunocardoso.cc <http://www.brunocardoso.cc/>
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at lists.llvm.org <mailto:cfe-commits at lists.llvm.org>
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits <http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits>
> 
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20160811/448f6e76/attachment.html>


More information about the cfe-commits mailing list