2 * Ceph - scalable distributed file system
4 * Copyright (C) 2014 CERN (Switzerland)
6 * Author: Andreas-Joachim Peters <Andreas.Joachim.Peters@cern.ch>
8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public
10 * License as published by the Free Software Foundation; either
11 * version 2.1 of the License, or (at your option) any later version.
17 #include "arch/probe.h"
18 #include "arch/intel.h"
19 #include "erasure-code/ErasureCodePlugin.h"
20 #include "global/global_context.h"
21 #include "common/config_proxy.h"
22 #include "gtest/gtest.h"
26 TEST(ErasureCodePlugin
, factory
)
28 ErasureCodePluginRegistry
&instance
= ErasureCodePluginRegistry::instance();
29 ErasureCodeProfile profile
;
31 ErasureCodeInterfaceRef erasure_code
;
32 EXPECT_FALSE(erasure_code
);
33 EXPECT_EQ(-EIO
, instance
.factory("no-isa",
34 g_conf().get_val
<std::string
>("erasure_code_dir"),
36 &erasure_code
, &cerr
));
37 EXPECT_FALSE(erasure_code
);
39 const char *techniques
[] = {
43 for(const char **technique
= techniques
; *technique
; technique
++) {
44 ErasureCodeInterfaceRef erasure_code
;
45 profile
["technique"] = *technique
;
46 EXPECT_FALSE(erasure_code
);
47 EXPECT_EQ(0, instance
.factory("isa",
48 g_conf().get_val
<std::string
>("erasure_code_dir"),
50 &erasure_code
, &cerr
));
51 EXPECT_TRUE(erasure_code
.get());
57 * compile-command: "cd ../.. ; make -j4 &&
58 * make unittest_erasure_code_plugin_isa &&
59 * valgrind --tool=memcheck ./unittest_erasure_code_plugin_isa \
60 * --gtest_filter=*.* --log-to-stderr=true --debug-osd=20"