]> git.proxmox.com Git - ceph.git/blame - ceph/src/test/erasure-code/TestErasureCodePluginJerasure.cc
import quincy beta 17.1.0
[ceph.git] / ceph / src / test / erasure-code / TestErasureCodePluginJerasure.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) 2013,2014 Cloudwatt <libre.licensing@cloudwatt.com>
7 * Copyright (C) 2014 Red Hat <contact@redhat.com>
8 *
9 * Author: Loic Dachary <loic@dachary.org>
10 *
11 * This library is free software; you can redistribute it and/or
12 * modify it under the terms of the GNU Lesser General Public
13 * License as published by the Free Software Foundation; either
14 * version 2.1 of the License, or (at your option) any later version.
15 *
16 */
17
18#include <errno.h>
19#include <stdlib.h>
20#include "erasure-code/ErasureCodePlugin.h"
21#include "log/Log.h"
22#include "global/global_context.h"
11fdf7f2 23#include "common/config_proxy.h"
7c673cae
FG
24#include "gtest/gtest.h"
25
20effc67
TL
26using namespace std;
27
7c673cae
FG
28TEST(ErasureCodePlugin, factory)
29{
30 ErasureCodePluginRegistry &instance = ErasureCodePluginRegistry::instance();
31 ErasureCodeProfile profile;
32 {
33 ErasureCodeInterfaceRef erasure_code;
34 EXPECT_FALSE(erasure_code);
35 EXPECT_EQ(-ENOENT, instance.factory("jerasure",
11fdf7f2 36 g_conf().get_val<std::string>("erasure_code_dir"),
7c673cae
FG
37 profile,
38 &erasure_code, &cerr));
39 EXPECT_FALSE(erasure_code);
40 }
41 const char *techniques[] = {
42 "reed_sol_van",
43 "reed_sol_r6_op",
44 "cauchy_orig",
45 "cauchy_good",
46 "liberation",
47 "blaum_roth",
48 "liber8tion",
49 0
50 };
51 for(const char **technique = techniques; *technique; technique++) {
52 ErasureCodeInterfaceRef erasure_code;
53 ErasureCodeProfile profile;
54 profile["technique"] = *technique;
55 EXPECT_FALSE(erasure_code);
56 EXPECT_EQ(0, instance.factory("jerasure",
11fdf7f2 57 g_conf().get_val<std::string>("erasure_code_dir"),
7c673cae
FG
58 profile,
59 &erasure_code, &cerr));
60 EXPECT_TRUE(erasure_code.get());
61 }
62}
63
64/*
65 * Local Variables:
66 * compile-command: "cd ../.. ; make -j4 &&
67 * make unittest_erasure_code_plugin_jerasure &&
68 * valgrind --tool=memcheck ./unittest_erasure_code_plugin_jerasure \
69 * --gtest_filter=*.* --log-to-stderr=true --debug-osd=20"
70 * End:
71 */