1 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
2 // vim: ts=8 sw=2 smarttab
4 * Ceph distributed storage system
6 * Copyright (C) 2018 Indian Institute of Science <office.ece@iisc.ac.in>
8 * Author: Myna Vajha <mynaramana@gmail.com>
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.
19 #include "erasure-code/ErasureCodePlugin.h"
21 #include "global/global_context.h"
22 #include "common/config_proxy.h"
23 #include "gtest/gtest.h"
27 TEST(ErasureCodePlugin
, factory
)
29 ErasureCodePluginRegistry
&instance
= ErasureCodePluginRegistry::instance();
30 ErasureCodeProfile profile
;
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"),
37 &erasure_code
, &cerr
));
38 EXPECT_TRUE(erasure_code
);
40 //check clay plugin with scalar_mds=jerasure
42 const char *techniques
[] = {
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"),
59 &erasure_code
, &cerr
));
60 EXPECT_TRUE(erasure_code
.get());
63 #ifdef WITH_EC_ISA_PLUGIN
64 //check clay plugin with scalar_mds=isa
66 const char *techniques
[] = {
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"),
80 &erasure_code
, &cerr
));
81 EXPECT_TRUE(erasure_code
.get());
85 //check clay plugin with scalar_mds=shec
87 const char *techniques
[] = {
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"),
101 &erasure_code
, &cerr
));
102 EXPECT_TRUE(erasure_code
.get());
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"