]> git.proxmox.com Git - ceph.git/blob - ceph/src/test/erasure-code/TestErasureCodePluginClay.cc
update sources to ceph Nautilus 14.2.1
[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 TEST(ErasureCodePlugin, factory)
26 {
27 ErasureCodePluginRegistry &instance = ErasureCodePluginRegistry::instance();
28 ErasureCodeProfile profile;
29 {
30 ErasureCodeInterfaceRef erasure_code;
31 EXPECT_FALSE(erasure_code);
32 EXPECT_EQ(0, instance.factory("clay",
33 g_conf().get_val<std::string>("erasure_code_dir"),
34 profile,
35 &erasure_code, &cerr));
36 EXPECT_TRUE(erasure_code);
37 }
38 //check clay plugin with scalar_mds=jerasure
39 {
40 const char *techniques[] = {
41 "reed_sol_van",
42 "reed_sol_r6_op",
43 "cauchy_orig",
44 "cauchy_good",
45 "liber8tion",
46 0
47 };
48 for(const char **technique = techniques; *technique; technique++) {
49 ErasureCodeInterfaceRef erasure_code;
50 ErasureCodeProfile profile;
51 profile["scalar_mds"] = "jerasure";
52 profile["technique"] = *technique;
53 EXPECT_FALSE(erasure_code);
54 EXPECT_EQ(0, instance.factory("clay",
55 g_conf().get_val<std::string>("erasure_code_dir"),
56 profile,
57 &erasure_code, &cerr));
58 EXPECT_TRUE(erasure_code.get());
59 }
60 }
61 #ifdef HAVE_BETTER_YASM_ELF64
62 //check clay plugin with scalar_mds=isa
63 {
64 const char *techniques[] = {
65 "reed_sol_van",
66 "cauchy",
67 0
68 };
69 for(const char **technique = techniques; *technique; technique++) {
70 ErasureCodeInterfaceRef erasure_code;
71 ErasureCodeProfile profile;
72 profile["scalar_mds"] = "isa";
73 profile["technique"] = *technique;
74 EXPECT_FALSE(erasure_code);
75 EXPECT_EQ(0, instance.factory("clay",
76 g_conf().get_val<std::string>("erasure_code_dir"),
77 profile,
78 &erasure_code, &cerr));
79 EXPECT_TRUE(erasure_code.get());
80 }
81 }
82 #endif
83 //check clay plugin with scalar_mds=shec
84 {
85 const char *techniques[] = {
86 "single",
87 "multiple",
88 0
89 };
90 for(const char **technique = techniques; *technique; technique++) {
91 ErasureCodeInterfaceRef erasure_code;
92 ErasureCodeProfile profile;
93 profile["scalar_mds"] = "shec";
94 profile["technique"] = *technique;
95 EXPECT_FALSE(erasure_code);
96 EXPECT_EQ(0, instance.factory("clay",
97 g_conf().get_val<std::string>("erasure_code_dir"),
98 profile,
99 &erasure_code, &cerr));
100 EXPECT_TRUE(erasure_code.get());
101 }
102 }
103 }
104
105 /*
106 * Local Variables:
107 * compile-command: "cd ../.. ; make -j4 &&
108 * make unittest_erasure_code_plugin_clay &&
109 * valgrind --tool=memcheck ./unittest_erasure_code_plugin_clay \
110 * --gtest_filter=*.* --log-to-stderr=true --debug-osd=20"
111 * End:
112 */