]> git.proxmox.com Git - ceph.git/blame - ceph/src/test/common/test_util.cc
update source to Ceph Pacific 16.2.2
[ceph.git] / ceph / src / test / common / test_util.cc
CommitLineData
7c673cae
FG
1// -*- mode:C; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
2// vim: ts=8 sw=2 smarttab
3/*
4 * Ceph - scalable distributed file system
5 *
6 * Copyright (C) 2011 New Dream Network
7 *
8 * This is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public
10 * License version 2, as published by the Free Software
11 * Foundation. See file COPYING.
12 *
13 */
14
15#include "common/ceph_context.h"
16#include "include/util.h"
17#include "gtest/gtest.h"
18
f67539c2
TL
19#if __has_include(<filesystem>)
20#include <filesystem>
21namespace fs = std::filesystem;
22#else
9f95a23c 23#include <experimental/filesystem>
f67539c2
TL
24namespace fs = std::experimental::filesystem;
25#endif
7c673cae 26
7c673cae
FG
27#if defined(__linux__)
28TEST(util, collect_sys_info)
29{
f67539c2 30 if (!fs::exists("/etc/os-release")) {
9f95a23c
TL
31 GTEST_SKIP() << "skipping as '/etc/os-release' does not exist";
32 }
33
7c673cae
FG
34 map<string, string> sys_info;
35
36 CephContext *cct = (new CephContext(CEPH_ENTITY_TYPE_CLIENT))->get();
37 collect_sys_info(&sys_info, cct);
38
39 ASSERT_TRUE(sys_info.find("distro") != sys_info.end());
7c673cae
FG
40 ASSERT_TRUE(sys_info.find("distro_description") != sys_info.end());
41
42 cct->put();
43}
44#endif