[PATCH] D29706: [libcxx] [test] Fix hard_link_count test to account for fs with dir nlink==1

Michał Górny via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Feb 8 01:37:05 PST 2017


mgorny created this revision.

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.


Repository:
  rL LLVM

https://reviews.llvm.org/D29706

Files:
  test/std/experimental/filesystem/fs.op.funcs/fs.op.hard_lk_ct/hard_link_count.pass.cpp


Index: test/std/experimental/filesystem/fs.op.funcs/fs.op.hard_lk_ct/hard_link_count.pass.cpp
===================================================================
--- test/std/experimental/filesystem/fs.op.funcs/fs.op.hard_lk_ct/hard_link_count.pass.cpp
+++ test/std/experimental/filesystem/fs.op.funcs/fs.op.hard_lk_ct/hard_link_count.pass.cpp
@@ -57,15 +57,19 @@
     Dir3Expect = 3; // .  ..  file5
 #endif
     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 ||
-               hard_link_count(StaticEnv::Dir3) == Dir3ExpectAlt);
+               hard_link_count(StaticEnv::Dir3) == Dir3ExpectAlt ||
+               hard_link_count(StaticEnv::Dir3) == 1);
 
     std::error_code ec;
     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 ||
-               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)
 {


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D29706.87613.patch
Type: text/x-patch
Size: 1532 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20170208/48322411/attachment-0001.bin>


More information about the cfe-commits mailing list