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.h"
22 #include "gtest/gtest.h"
24 TEST(ErasureCodePlugin, factory)
26 ErasureCodePluginRegistry &instance = ErasureCodePluginRegistry::instance();
27 ErasureCodeProfile profile;
29 ErasureCodeInterfaceRef erasure_code;
30 EXPECT_FALSE(erasure_code);
31 EXPECT_EQ(-EIO, instance.factory("no-isa",
32 g_conf->get_val<std::string>("erasure_code_dir"),
34 &erasure_code, &cerr));
35 EXPECT_FALSE(erasure_code);
37 const char *techniques[] = {
41 for(const char **technique = techniques; *technique; technique++) {
42 ErasureCodeInterfaceRef erasure_code;
43 profile["technique"] = *technique;
44 EXPECT_FALSE(erasure_code);
45 EXPECT_EQ(0, instance.factory("isa",
46 g_conf->get_val<std::string>("erasure_code_dir"),
48 &erasure_code, &cerr));
49 EXPECT_TRUE(erasure_code.get());
55 * compile-command: "cd ../.. ; make -j4 &&
56 * make unittest_erasure_code_plugin_isa &&
57 * valgrind --tool=memcheck ./unittest_erasure_code_plugin_isa \
58 * --gtest_filter=*.* --log-to-stderr=true --debug-osd=20"