test_cls_rbd: avoid warning -Wno-unnamed-template-args

According to this https://code.google.com/p/googletest/source/detail?r=446
the use of unnamed types (in this case the protection flag enums from
librbd/parent_types.h) as template parameters (in this case the gtest
macros) is not valid C++ pre C++0x.

As suggested, converting the enum into an int with integral promotion
via unary plus operator solves the problem.

Signed-off-by: Noah Watkins <noahwatkins@gmail.com>
This commit is contained in:
Noah Watkins 2013-12-30 12:43:57 -08:00
parent fdd85625c7
commit 9d41fd2c85

View File

@ -476,37 +476,37 @@ TEST(cls_rbd, protection_status)
ASSERT_EQ(0, snapshot_add(&ioctx, "foo", 10, "snap1"));
ASSERT_EQ(0, get_protection_status(&ioctx, "foo",
10, &status));
ASSERT_EQ(RBD_PROTECTION_STATUS_UNPROTECTED, status);
ASSERT_EQ(+RBD_PROTECTION_STATUS_UNPROTECTED, status);
ASSERT_EQ(0, set_protection_status(&ioctx, "foo",
10, RBD_PROTECTION_STATUS_PROTECTED));
ASSERT_EQ(0, get_protection_status(&ioctx, "foo",
10, &status));
ASSERT_EQ(RBD_PROTECTION_STATUS_PROTECTED, status);
ASSERT_EQ(+RBD_PROTECTION_STATUS_PROTECTED, status);
ASSERT_EQ(-EBUSY, snapshot_remove(&ioctx, "foo", 10));
ASSERT_EQ(0, set_protection_status(&ioctx, "foo",
10, RBD_PROTECTION_STATUS_UNPROTECTING));
ASSERT_EQ(0, get_protection_status(&ioctx, "foo",
10, &status));
ASSERT_EQ(RBD_PROTECTION_STATUS_UNPROTECTING, status);
ASSERT_EQ(+RBD_PROTECTION_STATUS_UNPROTECTING, status);
ASSERT_EQ(-EBUSY, snapshot_remove(&ioctx, "foo", 10));
ASSERT_EQ(-EINVAL, set_protection_status(&ioctx, "foo",
10, RBD_PROTECTION_STATUS_LAST));
ASSERT_EQ(0, get_protection_status(&ioctx, "foo",
10, &status));
ASSERT_EQ(RBD_PROTECTION_STATUS_UNPROTECTING, status);
ASSERT_EQ(+RBD_PROTECTION_STATUS_UNPROTECTING, status);
ASSERT_EQ(0, snapshot_add(&ioctx, "foo", 20, "snap2"));
ASSERT_EQ(0, get_protection_status(&ioctx, "foo",
20, &status));
ASSERT_EQ(RBD_PROTECTION_STATUS_UNPROTECTED, status);
ASSERT_EQ(+RBD_PROTECTION_STATUS_UNPROTECTED, status);
ASSERT_EQ(0, set_protection_status(&ioctx, "foo",
10, RBD_PROTECTION_STATUS_UNPROTECTED));
ASSERT_EQ(0, get_protection_status(&ioctx, "foo",
10, &status));
ASSERT_EQ(RBD_PROTECTION_STATUS_UNPROTECTED, status);
ASSERT_EQ(+RBD_PROTECTION_STATUS_UNPROTECTED, status);
ASSERT_EQ(0, snapshot_remove(&ioctx, "foo", 10));
ASSERT_EQ(0, snapshot_remove(&ioctx, "foo", 20));