Quellcode durchsuchen

Merging r294431:
------------------------------------------------------------------------
r294431 | mgorny | 2017-02-08 01:57:32 -0800 (Wed, 08 Feb 2017) | 7 lines

[test] Fix hard_link_count test to account for fs with dir nlink==1

Filesystems are not required to maintain a hard link count consistent
with number of subdirectories. For example, on btrfs all directories
have nlink==1. Account for that in the test.

Differential Revision: https://reviews.llvm.org/D29706
------------------------------------------------------------------------


git-svn-id: https://llvm.org/svn/llvm-project/libcxx/branches/release_40@295214 91177308-0d34-0410-b5e6-96231b3b80d8

Hans Wennborg vor 8 Jahren
Ursprung
Commit
0e8610273c

+ 8 - 4
test/std/experimental/filesystem/fs.op.funcs/fs.op.hard_lk_ct/hard_link_count.pass.cpp

@@ -57,15 +57,19 @@ TEST_CASE(hard_link_count_for_directory)
     Dir3Expect = 3; // .  ..  file5
     Dir3Expect = 3; // .  ..  file5
 #endif
 #endif
     TEST_CHECK(hard_link_count(StaticEnv::Dir) == DirExpect ||
     TEST_CHECK(hard_link_count(StaticEnv::Dir) == DirExpect ||
-               hard_link_count(StaticEnv::Dir) == DirExpectAlt);
+               hard_link_count(StaticEnv::Dir) == DirExpectAlt ||
+               hard_link_count(StaticEnv::Dir) == 1);
     TEST_CHECK(hard_link_count(StaticEnv::Dir3) == Dir3Expect ||
     TEST_CHECK(hard_link_count(StaticEnv::Dir3) == Dir3Expect ||
-               hard_link_count(StaticEnv::Dir3) == Dir3ExpectAlt);
+               hard_link_count(StaticEnv::Dir3) == Dir3ExpectAlt ||
+               hard_link_count(StaticEnv::Dir3) == 1);
 
 
     std::error_code ec;
     std::error_code ec;
     TEST_CHECK(hard_link_count(StaticEnv::Dir, ec) == DirExpect ||
     TEST_CHECK(hard_link_count(StaticEnv::Dir, ec) == DirExpect ||
-               hard_link_count(StaticEnv::Dir, ec) == DirExpectAlt);
+               hard_link_count(StaticEnv::Dir, ec) == DirExpectAlt ||
+               hard_link_count(StaticEnv::Dir) == 1);
     TEST_CHECK(hard_link_count(StaticEnv::Dir3, ec) == Dir3Expect ||
     TEST_CHECK(hard_link_count(StaticEnv::Dir3, ec) == Dir3Expect ||
-               hard_link_count(StaticEnv::Dir3, ec) == Dir3ExpectAlt);
+               hard_link_count(StaticEnv::Dir3, ec) == Dir3ExpectAlt ||
+               hard_link_count(StaticEnv::Dir3) == 1);
 }
 }
 TEST_CASE(hard_link_count_increments_test)
 TEST_CASE(hard_link_count_increments_test)
 {
 {