diff options
Diffstat (limited to 'src/test/libcephfs')
-rw-r--r-- | src/test/libcephfs/CMakeLists.txt | 7 | ||||
-rw-r--r-- | src/test/libcephfs/access.cc | 16 | ||||
-rw-r--r-- | src/test/libcephfs/test.cc | 6 |
3 files changed, 18 insertions, 11 deletions
diff --git a/src/test/libcephfs/CMakeLists.txt b/src/test/libcephfs/CMakeLists.txt index 672e6dd8f..09cb7e6de 100644 --- a/src/test/libcephfs/CMakeLists.txt +++ b/src/test/libcephfs/CMakeLists.txt @@ -56,7 +56,8 @@ if(WITH_LIBCEPHFS) add_executable(ceph_test_libcephfs_reclaim reclaim.cc ) - target_link_libraries(ceph_test_libcephfs_reclaim + target_link_libraries(ceph_test_libcephfs_reclaim + ceph-common cephfs ${UNITTEST_LIBS} ${EXTRALIBS} @@ -69,7 +70,8 @@ if(WITH_LIBCEPHFS) add_executable(ceph_test_libcephfs_lazyio lazyio.cc ) - target_link_libraries(ceph_test_libcephfs_lazyio +target_link_libraries(ceph_test_libcephfs_lazyio + ceph-common cephfs librados ${UNITTEST_LIBS} @@ -80,7 +82,6 @@ if(WITH_LIBCEPHFS) DESTINATION ${CMAKE_INSTALL_BINDIR}) add_executable(ceph_test_libcephfs_access - test.cc access.cc ) target_link_libraries(ceph_test_libcephfs_access diff --git a/src/test/libcephfs/access.cc b/src/test/libcephfs/access.cc index 57b1a89fa..1260a23e5 100644 --- a/src/test/libcephfs/access.cc +++ b/src/test/libcephfs/access.cc @@ -74,13 +74,13 @@ int do_mon_command(string s, string *key) return r; } -string get_unique_dir() +string get_unique_dir(string name) { - return string("/ceph_test_libcephfs_access.") + stringify(rand()); + return string("/ceph_test_libcephfs_access.") + name + string(".") + stringify(rand()); } TEST(AccessTest, Foo) { - string dir = get_unique_dir(); + string dir = get_unique_dir("foo"); string user = "libcephfs_foo_test." + stringify(rand()); // admin mount to set up test struct ceph_mount_info *admin; @@ -113,8 +113,8 @@ TEST(AccessTest, Foo) { } TEST(AccessTest, Path) { - string good = get_unique_dir(); - string bad = get_unique_dir(); + string good = get_unique_dir("good"); + string bad = get_unique_dir("bad"); string user = "libcephfs_path_test." + stringify(rand()); struct ceph_mount_info *admin; ASSERT_EQ(0, ceph_create(&admin, NULL)); @@ -199,8 +199,8 @@ TEST(AccessTest, Path) { } TEST(AccessTest, ReadOnly) { - string dir = get_unique_dir(); - string dir2 = get_unique_dir(); + string dir = get_unique_dir("dir"); + string dir2 = get_unique_dir("dir2"); string user = "libcephfs_readonly_test." + stringify(rand()); struct ceph_mount_info *admin; ASSERT_EQ(0, ceph_create(&admin, NULL)); @@ -243,7 +243,7 @@ TEST(AccessTest, ReadOnly) { } TEST(AccessTest, User) { - string dir = get_unique_dir(); + string dir = get_unique_dir("user"); string user = "libcephfs_user_test." + stringify(rand()); // admin mount to set up test diff --git a/src/test/libcephfs/test.cc b/src/test/libcephfs/test.cc index c83ddccf9..57c5eefa6 100644 --- a/src/test/libcephfs/test.cc +++ b/src/test/libcephfs/test.cc @@ -3711,8 +3711,11 @@ TEST(LibCephFS, SnapdirAttrsOnSnapDelete) { struct ceph_statx stx_snap_dir_2; ASSERT_EQ(ceph_statx(cmount, snap_dir_path, &stx_snap_dir_2, CEPH_STATX_MTIME|CEPH_STATX_CTIME|CEPH_STATX_VERSION, 0), 0); + // Flaky assertion on Windows, potentially due to timestamp precision. + #ifndef _WIN32 ASSERT_LT(utime_t(stx_snap_dir_1.stx_mtime), utime_t(stx_snap_dir_2.stx_mtime)); ASSERT_LT(utime_t(stx_snap_dir_1.stx_ctime), utime_t(stx_snap_dir_2.stx_ctime)); + #endif ASSERT_LT(stx_snap_dir_1.stx_version, stx_snap_dir_2.stx_version); ASSERT_EQ(0, ceph_rmdir(cmount, dir_path)); @@ -3764,8 +3767,11 @@ TEST(LibCephFS, SnapdirAttrsOnSnapRename) { struct ceph_statx stx_snap_dir_2; ASSERT_EQ(ceph_statx(cmount, snap_dir_path, &stx_snap_dir_2, CEPH_STATX_MTIME|CEPH_STATX_CTIME|CEPH_STATX_VERSION, 0), 0); + // Flaky assertion on Windows, potentially due to timestamp precision. + #ifndef _WIN32 ASSERT_LT(utime_t(stx_snap_dir_1.stx_mtime), utime_t(stx_snap_dir_2.stx_mtime)); ASSERT_LT(utime_t(stx_snap_dir_1.stx_ctime), utime_t(stx_snap_dir_2.stx_ctime)); + #endif ASSERT_LT(stx_snap_dir_1.stx_version, stx_snap_dir_2.stx_version); ASSERT_EQ(0, ceph_rmdir(cmount, snap_path_r)); |