]> git.proxmox.com Git - ceph.git/blame - ceph/src/test/test_features.cc
update sources to ceph Nautilus 14.2.1
[ceph.git] / ceph / src / test / test_features.cc
CommitLineData
31f18b77
FG
1// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
2// vim: ts=8 sw=2 smarttab
3#include <stdio.h>
4
5#include "global/global_init.h"
6#include "common/ceph_argparse.h"
7#include "global/global_context.h"
8#include "gtest/gtest.h"
9#include "include/ceph_features.h"
10#include "include/rados.h"
11
12
13TEST(features, release_features)
14{
15 for (int r = 1; r < CEPH_RELEASE_MAX; ++r) {
16 const char *name = ceph_release_name(r);
17 ASSERT_NE(string("unknown"), name);
18 ASSERT_EQ(r, ceph_release_from_name(name));
19 uint64_t features = ceph_release_features(r);
20 int rr = ceph_release_from_features(features);
21 cout << r << " " << name << " features 0x" << std::hex << features
22 << std::dec << " looks like " << ceph_release_name(rr) << std::endl;
23 EXPECT_LE(rr, r);
24 }
25}
26
27TEST(features, release_from_features) {
28 ASSERT_EQ(CEPH_RELEASE_JEWEL, ceph_release_from_features(575862587619852283));
29 ASSERT_EQ(CEPH_RELEASE_LUMINOUS,
30 ceph_release_from_features(1152323339925389307));
31}
32
33int main(int argc, char **argv)
34{
35 vector<const char*> args;
36 argv_to_vec(argc, (const char **)argv, args);
37
38 auto cct = global_init(NULL, args, CEPH_ENTITY_TYPE_CLIENT,
11fdf7f2
TL
39 CODE_ENVIRONMENT_UTILITY,
40 CINIT_FLAG_NO_DEFAULT_CONFIG_FILE);
31f18b77
FG
41 common_init_finish(g_ceph_context);
42
43 ::testing::InitGoogleTest(&argc, argv);
44 return RUN_ALL_TESTS();
45}