summaryrefslogtreecommitdiffstats
path: root/src/test/librbd/test_main.cc
blob: 82b72b1ef7e85e424764faa89b8043e2ad9f958b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
// vim: ts=8 sw=2 smarttab

#include "include/rados/librados.hpp"
#include "global/global_context.h"
#include "test/librados/test.h"
#include "test/librados/test_cxx.h"
#include "gtest/gtest.h"
#include <iostream>
#include <string>

extern void register_test_librbd();
#ifdef TEST_LIBRBD_INTERNALS
extern void register_test_deep_copy();
extern void register_test_groups();
extern void register_test_image_watcher();
extern void register_test_internal();
extern void register_test_journal_entries();
extern void register_test_journal_replay();
extern void register_test_journal_stress();
extern void register_test_migration();
extern void register_test_mirroring();
extern void register_test_mirroring_watcher();
extern void register_test_object_map();
extern void register_test_operations();
extern void register_test_trash();
#endif // TEST_LIBRBD_INTERNALS

int main(int argc, char **argv)
{
  setenv("RBD_FORCE_ALLOW_V1","1",1);

  register_test_librbd();
#ifdef TEST_LIBRBD_INTERNALS
  register_test_deep_copy();
  register_test_groups();
  register_test_image_watcher();
  register_test_internal();
  register_test_journal_entries();
  register_test_journal_replay();
  register_test_journal_stress();
  register_test_migration();
  register_test_mirroring();
  register_test_mirroring_watcher();
  register_test_object_map();
  register_test_operations();
  register_test_trash();
#endif // TEST_LIBRBD_INTERNALS

  ::testing::InitGoogleTest(&argc, argv);

  librados::Rados rados;
  std::string result = connect_cluster_pp(rados);
  if (result != "" ) {
    std::cerr << result << std::endl;
    return 1;
  }

#ifdef TEST_LIBRBD_INTERNALS
  g_ceph_context = reinterpret_cast<CephContext*>(rados.cct());
#endif // TEST_LIBRBD_INTERNALS

  int r = rados.conf_set("lockdep", "true");
  if (r < 0) {
    std::cerr << "warning: failed to enable lockdep" << std::endl;
  }

  int seed = getpid();
  std::cout << "seed " << seed << std::endl;
  srand(seed);

  return RUN_ALL_TESTS();
}