]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
test/librbd: use GTEST_SKIP macro to skip tests 51264/head
authorIlya Dryomov <idryomov@gmail.com>
Thu, 27 Apr 2023 13:43:05 +0000 (15:43 +0200)
committerIlya Dryomov <idryomov@gmail.com>
Thu, 27 Apr 2023 13:53:14 +0000 (15:53 +0200)
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 <idryomov@gmail.com>
src/test/librbd/operation/test_mock_SnapshotRemoveRequest.cc
src/test/librbd/test_internal.cc
src/test/librbd/test_librbd.cc
src/test/librbd/test_support.h

index 886ac768e74b2ad8223ff9c5cdd0e41effb2e260..1189f76fb4696704140e0c336e3bd0ed3182d907 100644 (file)
@@ -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"));
index 0ec4462687d7546e526193ea42a7ee7005cbc484..5a090930fba2de50477c53433cc5229f16831f68 100644 (file)
@@ -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();
index 8c7eb2ba4ca8b6df78ffa81bafb24ecc26bdda62..05e7b1aa24074c6e437f95b59ebf503b3c3163bd 100644 (file)
@@ -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;
index 2d2de175ba79001324745fd0a095c17b5ca54954..602ec09556bd1736f14d7fe27aa3e6cb1ca3be2a 100644 (file)
@@ -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"; \
   }                                      \
 }