Fix some bugs when testing opensds ansible
[stor4nfv.git] / src / ceph / src / test / erasure-code / TestErasureCodePluginLrc.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 distributed storage system
5  *
6  * Copyright (C) 2014 Cloudwatt <libre.licensing@cloudwatt.com>
7  * Copyright (C) 2014 Red Hat <contact@redhat.com>
8  *
9  * Author: Loic Dachary <loic@dachary.org>
10  *
11  *  This library is free software; you can redistribute it and/or
12  *  modify it under the terms of the GNU Lesser General Public
13  *  License as published by the Free Software Foundation; either
14  *  version 2.1 of the License, or (at your option) any later version.
15  *
16  */
17
18 #include <errno.h>
19 #include <stdlib.h>
20 #include "arch/probe.h"
21 #include "arch/intel.h"
22 #include "erasure-code/ErasureCodePlugin.h"
23 #include "global/global_context.h"
24 #include "common/config.h"
25 #include "gtest/gtest.h"
26
27
28 TEST(ErasureCodePlugin, factory)
29 {
30   ErasureCodePluginRegistry &instance = ErasureCodePluginRegistry::instance();
31   ErasureCodeProfile profile;
32   profile["mapping"] = "DD_";
33   profile["layers"] = "[ [ \"DDc\", \"\" ] ]";
34   ErasureCodeInterfaceRef erasure_code;
35   EXPECT_FALSE(erasure_code);
36   EXPECT_EQ(0, instance.factory("lrc",
37                                 g_conf->get_val<std::string>("erasure_code_dir"),
38                                 profile, &erasure_code, &cerr));
39   EXPECT_TRUE(erasure_code.get());
40 }
41
42 /*
43  * Local Variables:
44  * compile-command: "cd ../.. ; make -j4 &&
45  *   make unittest_erasure_code_plugin_lrc &&
46  *   valgrind --tool=memcheck ./unittest_erasure_code_plugin_lrc \
47  *      --gtest_filter=*.* --log-to-stderr=true --debug-osd=20"
48  * End:
49  */