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) 2015 FUJITSU LIMITED
8 * Author: Shotaro Kawaguchi <kawaguchi.s@jp.fujitsu.com>
9 * Author: Takanori Nakao <nakao.takanori@jp.fujitsu.com>
10 * Author: Takeshi Miyamae <miyamae.takeshi@jp.fujitsu.com>
12 * This library is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU Lesser General Public
14 * License as published by the Free Software Foundation; either
15 * version 2.1 of the License, or (at your option) any later version.
21 #include "erasure-code/ErasureCodePlugin.h"
22 #include "global/global_context.h"
23 #include "gtest/gtest.h"
24 #include "common/config.h"
26 TEST(ErasureCodePlugin, factory)
28 ErasureCodePluginRegistry &instance = ErasureCodePluginRegistry::instance();
29 map<std::string,std::string> profile;
31 ErasureCodeInterfaceRef erasure_code;
32 EXPECT_FALSE(erasure_code);
33 EXPECT_EQ(0, instance.factory("shec",
34 g_conf->get_val<std::string>("erasure_code_dir"),
36 &erasure_code, &cerr));
37 EXPECT_TRUE(erasure_code.get());
39 const char *techniques[] = {
44 for(const char **technique = techniques; *technique; technique++) {
45 ErasureCodeInterfaceRef erasure_code;
46 profile["technique"] = *technique;
47 EXPECT_FALSE(erasure_code);
48 EXPECT_EQ(0, instance.factory("shec",
49 g_conf->get_val<std::string>("erasure_code_dir"),
51 &erasure_code, &cerr));
52 EXPECT_TRUE(erasure_code.get());
58 * compile-command: "cd ../.. ; make -j4 &&
59 * make unittest_erasure_code_plugin_shec &&
60 * valgrind --tool=memcheck ./unittest_erasure_code_plugin_shec \
61 * --gtest_filter=*.* --log-to-stderr=true --debug-osd=20"