From: Ilya Dryomov Date: Thu, 27 Apr 2023 13:43:05 +0000 (+0200) Subject: test/librbd: use GTEST_SKIP macro to skip tests X-Git-Tag: v19.0.0~1305^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F51264%2Fhead;p=ceph.git test/librbd: use GTEST_SKIP macro to skip tests The use of SUCCEED macro predates the introduction of GTEST_SKIP macro to GTest 1.10. Having skipped tests reported as passed is misleading! Before: [ RUN ] TestMockOperationSnapshotRemoveRequest.FlattenedCloneRemovesChild SKIPPING [ OK ] TestMockOperationSnapshotRemoveRequest.FlattenedCloneRemovesChild (9 ms) ... [ RUN ] TestMockOperationSnapshotRemoveRequest.RemoveChildError SKIPPING [ OK ] TestMockOperationSnapshotRemoveRequest.RemoveChildError (112 ms) ... [ PASSED ] 16 tests. After: [ RUN ] TestMockOperationSnapshotRemoveRequest.FlattenedCloneRemovesChild ../src/test/librbd/operation/test_mock_SnapshotRemoveRequest.cc:381: Skipped Skipping due to unmet REQUIRE [ SKIPPED ] TestMockOperationSnapshotRemoveRequest.FlattenedCloneRemovesChild (9 ms) ... [ RUN ] TestMockOperationSnapshotRemoveRequest.RemoveChildError ../src/test/librbd/operation/test_mock_SnapshotRemoveRequest.cc:727: Skipped Skipping due to enabled deep-flatten [ SKIPPED ] TestMockOperationSnapshotRemoveRequest.RemoveChildError (111 ms) ... [ PASSED ] 14 tests. [ SKIPPED ] 2 tests, listed below: [ SKIPPED ] TestMockOperationSnapshotRemoveRequest.FlattenedCloneRemovesChild [ SKIPPED ] TestMockOperationSnapshotRemoveRequest.RemoveChildError Signed-off-by: Ilya Dryomov --- diff --git a/src/test/librbd/operation/test_mock_SnapshotRemoveRequest.cc b/src/test/librbd/operation/test_mock_SnapshotRemoveRequest.cc index 886ac768e74b..1189f76fb469 100644 --- a/src/test/librbd/operation/test_mock_SnapshotRemoveRequest.cc +++ b/src/test/librbd/operation/test_mock_SnapshotRemoveRequest.cc @@ -724,8 +724,7 @@ TEST_F(TestMockOperationSnapshotRemoveRequest, RemoveChildError) { librbd::ImageCtx *ictx; ASSERT_EQ(0, open_image(clone_name, &ictx)); if (ictx->test_features(RBD_FEATURE_DEEP_FLATTEN)) { - std::cout << "SKIPPING" << std::endl; - return SUCCEED(); + GTEST_SKIP() << "Skipping due to enabled deep-flatten"; } ASSERT_EQ(0, snap_create(*ictx, "snap1")); diff --git a/src/test/librbd/test_internal.cc b/src/test/librbd/test_internal.cc index 0ec4462687d7..5a090930fba2 100644 --- a/src/test/librbd/test_internal.cc +++ b/src/test/librbd/test_internal.cc @@ -1304,8 +1304,7 @@ TEST_F(TestInternal, TestCoR) std::string config_value; ASSERT_EQ(0, _rados.conf_get("rbd_clone_copy_on_read", config_value)); if (config_value == "false") { - std::cout << "SKIPPING due to disabled rbd_copy_on_read" << std::endl; - return; + GTEST_SKIP() << "Skipping due to disabled copy-on-read"; } m_image_name = get_temp_image_name(); diff --git a/src/test/librbd/test_librbd.cc b/src/test/librbd/test_librbd.cc index 8c7eb2ba4ca8..05e7b1aa2407 100644 --- a/src/test/librbd/test_librbd.cc +++ b/src/test/librbd/test_librbd.cc @@ -8114,8 +8114,7 @@ TEST_F(TestLibRBD, LargeCacheRead) std::string config_value; ASSERT_EQ(0, _rados.conf_get("rbd_cache", config_value)); if (config_value == "false") { - std::cout << "SKIPPING due to disabled cache" << std::endl; - return; + GTEST_SKIP() << "Skipping due to disabled cache"; } rados_ioctx_t ioctx; diff --git a/src/test/librbd/test_support.h b/src/test/librbd/test_support.h index 2d2de175ba79..602ec09556bd 100644 --- a/src/test/librbd/test_support.h +++ b/src/test/librbd/test_support.h @@ -30,8 +30,7 @@ bool is_rbd_pwl_enabled(ceph::common::CephContext *ctx); #define REQUIRE(x) { \ if (!(x)) { \ - std::cout << "SKIPPING" << std::endl; \ - return SUCCEED(); \ + GTEST_SKIP() << "Skipping due to unmet REQUIRE"; \ } \ }