From 472c7b60fd9db5ab33aae250f54db0ae1007b348 Mon Sep 17 00:00:00 2001 From: Ilya Dryomov Date: Thu, 27 Apr 2023 15:43:05 +0200 Subject: [PATCH] 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 --- src/test/librbd/operation/test_mock_SnapshotRemoveRequest.cc | 3 +-- src/test/librbd/test_internal.cc | 3 +-- src/test/librbd/test_librbd.cc | 3 +-- src/test/librbd/test_support.h | 3 +-- 4 files changed, 4 insertions(+), 8 deletions(-) diff --git a/src/test/librbd/operation/test_mock_SnapshotRemoveRequest.cc b/src/test/librbd/operation/test_mock_SnapshotRemoveRequest.cc index 886ac768e74b2..1189f76fb4696 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 0ec4462687d75..5a090930fba2d 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 8c7eb2ba4ca8b..05e7b1aa24074 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 2d2de175ba790..602ec09556bd1 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"; \ } \ } -- 2.39.5