some GNU/Linux distros do not ship this file, and we should not fail the
test on them.
inspired by
http://git.savannah.gnu.org/cgit/guix.git/tree/gnu/packages/patches/ceph-skip-collect-sys-info-test.patch?id=
48f19e60c4677e392ee2c23f28098cfcaf9d1710
Signed-off-by: Kefu Chai <kchai@redhat.com>
${CMAKE_SOURCE_DIR}/src/common/util.cc
)
add_ceph_unittest(unittest_util)
-target_link_libraries(unittest_util global)
+target_link_libraries(unittest_util global StdFilesystem::filesystem)
# unittest_random
add_executable(unittest_random
#include "include/util.h"
#include "gtest/gtest.h"
-#include <sstream>
+#include <experimental/filesystem>
#if defined(__linux__)
TEST(util, collect_sys_info)
{
+ if (!std::experimental::filesystem::exists("/etc/os-release")) {
+ GTEST_SKIP() << "skipping as '/etc/os-release' does not exist";
+ }
+
map<string, string> sys_info;
CephContext *cct = (new CephContext(CEPH_ENTITY_TYPE_CLIENT))->get();