]> git.proxmox.com Git - ceph.git/blame - ceph/src/test/erasure-code/TestErasureCodePluginShec.cc
update sources to ceph Nautilus 14.2.1
[ceph.git] / ceph / src / test / erasure-code / TestErasureCodePluginShec.cc
CommitLineData
7c673cae
FG
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) 2015 FUJITSU LIMITED
7 *
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>
11 *
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.
16 *
17 */
18
19#include <errno.h>
20#include <stdlib.h>
21#include "erasure-code/ErasureCodePlugin.h"
22#include "global/global_context.h"
23#include "gtest/gtest.h"
11fdf7f2 24#include "common/config_proxy.h"
7c673cae
FG
25
26TEST(ErasureCodePlugin, factory)
27{
28 ErasureCodePluginRegistry &instance = ErasureCodePluginRegistry::instance();
29 map<std::string,std::string> profile;
30 {
31 ErasureCodeInterfaceRef erasure_code;
32 EXPECT_FALSE(erasure_code);
33 EXPECT_EQ(0, instance.factory("shec",
11fdf7f2 34 g_conf().get_val<std::string>("erasure_code_dir"),
7c673cae
FG
35 profile,
36 &erasure_code, &cerr));
37 EXPECT_TRUE(erasure_code.get());
38 }
39 const char *techniques[] = {
40 "single",
41 "multiple",
42 0
43 };
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",
11fdf7f2 49 g_conf().get_val<std::string>("erasure_code_dir"),
7c673cae
FG
50 profile,
51 &erasure_code, &cerr));
52 EXPECT_TRUE(erasure_code.get());
53 }
54}
55
56/*
57 * Local Variables:
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"
62 * End:
63 */