]> git.proxmox.com Git - ceph.git/blob - ceph/src/test/erasure-code/TestErasureCodePluginClay.cc
import quincy beta 17.1.0
[ceph.git] / ceph / src / test / erasure-code / TestErasureCodePluginClay.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) 2018 Indian Institute of Science <office.ece@iisc.ac.in>
7 *
8 * Author: Myna Vajha <mynaramana@gmail.com>
9 *
10 * This library is free software; you can redistribute it and/or
11 * modify it under the terms of the GNU Lesser General Public
12 * License as published by the Free Software Foundation; either
13 * version 2.1 of the License, or (at your option) any later version.
14 *
15 */
16
17 #include <errno.h>
18 #include <stdlib.h>
19 #include "erasure-code/ErasureCodePlugin.h"
20 #include "log/Log.h"
21 #include "global/global_context.h"
22 #include "common/config_proxy.h"
23 #include "gtest/gtest.h"
24
25 using namespace std;
26
27 TEST(ErasureCodePlugin, factory)
28 {
29 ErasureCodePluginRegistry &instance = ErasureCodePluginRegistry::instance();
30 ErasureCodeProfile profile;
31 {
32 ErasureCodeInterfaceRef erasure_code;
33 EXPECT_FALSE(erasure_code);
34 EXPECT_EQ(0, instance.factory("clay",
35 g_conf().get_val<std::string>("erasure_code_dir"),
36 profile,
37 &erasure_code, &cerr));
38 EXPECT_TRUE(erasure_code);
39 }
40 //check clay plugin with scalar_mds=jerasure
41 {
42 const char *techniques[] = {
43 "reed_sol_van",
44 "reed_sol_r6_op",
45 "cauchy_orig",
46 "cauchy_good",
47 "liber8tion",
48 0
49 };
50 for(const char **technique = techniques; *technique; technique++) {
51 ErasureCodeInterfaceRef erasure_code;
52 ErasureCodeProfile profile;
53 profile["scalar_mds"] = "jerasure";
54 profile["technique"] = *technique;
55 EXPECT_FALSE(erasure_code);
56 EXPECT_EQ(0, instance.factory("clay",
57 g_conf().get_val<std::string>("erasure_code_dir"),
58 profile,
59 &erasure_code, &cerr));
60 EXPECT_TRUE(erasure_code.get());
61 }
62 }
63 #ifdef WITH_EC_ISA_PLUGIN
64 //check clay plugin with scalar_mds=isa
65 {
66 const char *techniques[] = {
67 "reed_sol_van",
68 "cauchy",
69 0
70 };
71 for(const char **technique = techniques; *technique; technique++) {
72 ErasureCodeInterfaceRef erasure_code;
73 ErasureCodeProfile profile;
74 profile["scalar_mds"] = "isa";
75 profile["technique"] = *technique;
76 EXPECT_FALSE(erasure_code);
77 EXPECT_EQ(0, instance.factory("clay",
78 g_conf().get_val<std::string>("erasure_code_dir"),
79 profile,
80 &erasure_code, &cerr));
81 EXPECT_TRUE(erasure_code.get());
82 }
83 }
84 #endif
85 //check clay plugin with scalar_mds=shec
86 {
87 const char *techniques[] = {
88 "single",
89 "multiple",
90 0
91 };
92 for(const char **technique = techniques; *technique; technique++) {
93 ErasureCodeInterfaceRef erasure_code;
94 ErasureCodeProfile profile;
95 profile["scalar_mds"] = "shec";
96 profile["technique"] = *technique;
97 EXPECT_FALSE(erasure_code);
98 EXPECT_EQ(0, instance.factory("clay",
99 g_conf().get_val<std::string>("erasure_code_dir"),
100 profile,
101 &erasure_code, &cerr));
102 EXPECT_TRUE(erasure_code.get());
103 }
104 }
105 }
106
107 /*
108 * Local Variables:
109 * compile-command: "cd ../.. ; make -j4 &&
110 * make unittest_erasure_code_plugin_clay &&
111 * valgrind --tool=memcheck ./unittest_erasure_code_plugin_clay \
112 * --gtest_filter=*.* --log-to-stderr=true --debug-osd=20"
113 * End:
114 */