]> git.proxmox.com Git - ceph.git/blob - ceph/src/test/erasure-code/TestErasureCodePluginIsa.cc
bump version to 18.2.2-pve1
[ceph.git] / ceph / src / test / erasure-code / TestErasureCodePluginIsa.cc
1 /*
2 * Ceph - scalable distributed file system
3 *
4 * Copyright (C) 2014 CERN (Switzerland)
5 *
6 * Author: Andreas-Joachim Peters <Andreas.Joachim.Peters@cern.ch>
7 *
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.
12 *
13 */
14
15 #include <errno.h>
16 #include <stdlib.h>
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"
23
24 using namespace std;
25
26 TEST(ErasureCodePlugin, factory)
27 {
28 ErasureCodePluginRegistry &instance = ErasureCodePluginRegistry::instance();
29 ErasureCodeProfile profile;
30 {
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"),
35 profile,
36 &erasure_code, &cerr));
37 EXPECT_FALSE(erasure_code);
38 }
39 const char *techniques[] = {
40 "reed_sol_van",
41 0
42 };
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"),
49 profile,
50 &erasure_code, &cerr));
51 EXPECT_TRUE(erasure_code.get());
52 }
53 }
54
55 /*
56 * Local Variables:
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"
61 * End:
62 */