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) 2013,2014 Cloudwatt <libre.licensing@cloudwatt.com>
7 * Copyright (C) 2014 Red Hat <contact@redhat.com>
9 * Author: Loic Dachary <loic@dachary.org>
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.
20 #include "erasure-code/ErasureCodePlugin.h"
22 #include "global/global_context.h"
23 #include "common/config.h"
24 #include "gtest/gtest.h"
26 TEST(ErasureCodePlugin, factory)
28 ErasureCodePluginRegistry &instance = ErasureCodePluginRegistry::instance();
29 ErasureCodeProfile profile;
31 ErasureCodeInterfaceRef erasure_code;
32 EXPECT_FALSE(erasure_code);
33 EXPECT_EQ(-ENOENT, instance.factory("jerasure",
34 g_conf->get_val<std::string>("erasure_code_dir"),
36 &erasure_code, &cerr));
37 EXPECT_FALSE(erasure_code);
39 const char *techniques[] = {
49 for(const char **technique = techniques; *technique; technique++) {
50 ErasureCodeInterfaceRef erasure_code;
51 ErasureCodeProfile profile;
52 profile["technique"] = *technique;
53 EXPECT_FALSE(erasure_code);
54 EXPECT_EQ(0, instance.factory("jerasure",
55 g_conf->get_val<std::string>("erasure_code_dir"),
57 &erasure_code, &cerr));
58 EXPECT_TRUE(erasure_code.get());
64 * compile-command: "cd ../.. ; make -j4 &&
65 * make unittest_erasure_code_plugin_jerasure &&
66 * valgrind --tool=memcheck ./unittest_erasure_code_plugin_jerasure \
67 * --gtest_filter=*.* --log-to-stderr=true --debug-osd=20"