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"
25 TEST(ErasureCodePlugin
, factory
)
27 ErasureCodePluginRegistry
&instance
= ErasureCodePluginRegistry::instance();
28 ErasureCodeProfile profile
;
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"),
35 &erasure_code
, &cerr
));
36 EXPECT_TRUE(erasure_code
);
38 //check clay plugin with scalar_mds=jerasure
40 const char *techniques
[] = {
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"),
57 &erasure_code
, &cerr
));
58 EXPECT_TRUE(erasure_code
.get());
61 #ifdef HAVE_BETTER_YASM_ELF64
62 //check clay plugin with scalar_mds=isa
64 const char *techniques
[] = {
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"),
78 &erasure_code
, &cerr
));
79 EXPECT_TRUE(erasure_code
.get());
83 //check clay plugin with scalar_mds=shec
85 const char *techniques
[] = {
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"),
99 &erasure_code
, &cerr
));
100 EXPECT_TRUE(erasure_code
.get());
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"