Fix some bugs when testing opensds ansible
[stor4nfv.git] / src / ceph / src / test / libcephfs / main.cc
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  * Copyright (C) 2016 Red Hat
8  *
9  * This is free software; you can redistribute it and/or
10  * modify it under the terms of the GNU Lesser General Public
11  * License version 2.1, as published by the Free Software
12  * Foundation.  See file COPYING.
13  *
14  */
15
16 #include "gtest/gtest.h"
17 #include "include/cephfs/libcephfs.h"
18
19 static int update_root_mode()
20 {
21   struct ceph_mount_info *admin;
22   int r = ceph_create(&admin, NULL);
23   if (r < 0)
24     return r;
25   ceph_conf_read_file(admin, NULL);
26   ceph_conf_parse_env(admin, NULL);
27   ceph_conf_set(admin, "client_permissions", "false");
28   r = ceph_mount(admin, "/");
29   if (r < 0)
30     goto out;
31   r = ceph_chmod(admin, "/", 01777);
32 out:
33   ceph_shutdown(admin);
34   return r;
35 }
36
37
38 int main(int argc, char **argv)
39 {
40   int r = update_root_mode();
41   if (r < 0)
42     exit(1);
43
44   ::testing::InitGoogleTest(&argc, argv);
45
46   srand(getpid());
47
48   return RUN_ALL_TESTS();
49 }