]>
Commit | Line | Data |
---|---|---|
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 Lesser General Public | |
10 | * License version 2.1, as published by the Free Software | |
11 | * Foundation. See file COPYING. | |
12 | * | |
13 | */ | |
14 | ||
15 | #ifndef CEPH_UNIT_TEST_H | |
16 | #define CEPH_UNIT_TEST_H | |
17 | ||
18 | #include "include/types.h" // FIXME: ordering shouldn't be important, but right | |
19 | // now, this include has to come before the others. | |
20 | ||
21 | #include "common/ceph_argparse.h" | |
22 | #include "common/code_environment.h" | |
23 | #include "common/config.h" | |
24 | #include "global/global_context.h" | |
25 | #include "global/global_init.h" | |
26 | #include "include/msgr.h" // for CEPH_ENTITY_TYPE_CLIENT | |
27 | #include "gtest/gtest.h" | |
28 | ||
29 | #include <vector> | |
30 | ||
31 | /* | |
32 | * You only need to include this file if you are testing Ceph internal code. If | |
33 | * you are testing library code, the library init() interfaces will handle | |
34 | * initialization for you. | |
35 | */ | |
36 | int main(int argc, char **argv) { | |
37 | std::vector<const char*> args(argv, argv + argc); | |
7c673cae FG |
38 | auto cct = global_init(NULL, args, |
39 | CEPH_ENTITY_TYPE_CLIENT, | |
11fdf7f2 TL |
40 | CODE_ENVIRONMENT_UTILITY, |
41 | CINIT_FLAG_NO_MON_CONFIG); | |
7c673cae FG |
42 | common_init_finish(g_ceph_context); |
43 | ||
7c673cae FG |
44 | ::testing::InitGoogleTest(&argc, argv); |
45 | return RUN_ALL_TESTS(); | |
46 | } | |
47 | ||
48 | #endif |