summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthias Braun <matze@braunis.de>2016-08-10 01:02:28 +0000
committerMatthias Braun <matze@braunis.de>2016-08-10 01:02:28 +0000
commit852f990ecb969351013ad0d037214b9e4530176c (patch)
tree5da925d79a81fdda8b1224c88a6e2e8fa54d9fe7
parentabd6186216461d2572c13a2e8959f908a6f2e020 (diff)
downloadbcm5719-llvm-852f990ecb969351013ad0d037214b9e4530176c.tar.gz
bcm5719-llvm-852f990ecb969351013ad0d037214b9e4530176c.zip
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. llvm-svn: 278191
-rw-r--r--libcxx/test/std/experimental/filesystem/fs.op.funcs/fs.op.hard_lk_ct/hard_link_count.pass.cpp25
1 files changed, 17 insertions, 8 deletions
diff --git a/libcxx/test/std/experimental/filesystem/fs.op.funcs/fs.op.hard_lk_ct/hard_link_count.pass.cpp b/libcxx/test/std/experimental/filesystem/fs.op.funcs/fs.op.hard_lk_ct/hard_link_count.pass.cpp
index abc50e9c6a4..7537ac20c75 100644
--- a/libcxx/test/std/experimental/filesystem/fs.op.funcs/fs.op.hard_lk_ct/hard_link_count.pass.cpp
+++ b/libcxx/test/std/experimental/filesystem/fs.op.funcs/fs.op.hard_lk_ct/hard_link_count.pass.cpp
@@ -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)
{
OpenPOWER on IntegriCloud