Skip to content

Commit

Permalink
use macro for file names of dynamic link libraries
Browse files Browse the repository at this point in the history
  • Loading branch information
unnonouno committed Oct 31, 2011
1 parent 4ef2f79 commit a64079d
Show file tree
Hide file tree
Showing 12 changed files with 21 additions and 16 deletions.
2 changes: 1 addition & 1 deletion src/client/wscript
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ def build(bld):
bld.shlib(
source = ['classifier.cpp', 'accessor.cpp'],
target = 'jubatus',
use = 'PFICOMMON'
use = 'PFICOMMON MSGPACK'
)

bld.program(
Expand Down
6 changes: 3 additions & 3 deletions src/server/fv_converter/dynamic_loader_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@
namespace jubatus {

TEST(dynamic_loader, trivial) {
dynamic_loader l("libsplitter_sample.so");
dynamic_loader l(LIBSPLITTER_SAMPLE);
l.load_symbol("create");
{
dynamic_loader l2("libsplitter_sample.so");
dynamic_loader l2(LIBSPLITTER_SAMPLE);
// destroctor of l2 call dlclose, but you can use l
}
l.load_symbol("create");
Expand All @@ -36,7 +36,7 @@ TEST(dynamic_loader, unknown_so_file) {
}

TEST(dynamic_loader, unknown_function) {
dynamic_loader l("libsplitter_sample.so");
dynamic_loader l(LIBSPLITTER_SAMPLE);
EXPECT_THROW(l.load_symbol("unknown"), converter_exception);
}

Expand Down
2 changes: 1 addition & 1 deletion src/server/fv_converter/dynamic_num_feature_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ TEST(dynamic_num_feature, trivial) {
map<string, string> params;

{
dynamic_num_feature f("libnum_feature_sample.so",
dynamic_num_feature f(LIBNUM_FEATURE_SAMPLE,
"create",
params);
sfv_t fv;
Expand Down
4 changes: 2 additions & 2 deletions src/server/fv_converter/dynamic_num_filter_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ namespace jubatus {
TEST(dynamic_num_filter, trivial) {
map<string, string> params;

dynamic_num_filter f("libnum_filter_sample.so",
dynamic_num_filter f(LIBNUM_FILTER_SAMPLE,
"create",
params);
EXPECT_EQ(6.0, f.filter(3.0));
Expand All @@ -42,7 +42,7 @@ TEST(dynamic_num_filter, unknown_file) {

TEST(dynamic_num_filter, unknown_function) {
map<string, string> params;
EXPECT_THROW(dynamic_num_filter f("libfilter_sample.so",
EXPECT_THROW(dynamic_num_filter f(LIBNUM_FILTER_SAMPLE,
"unknown_function",
params),
converter_exception);
Expand Down
4 changes: 2 additions & 2 deletions src/server/fv_converter/dynamic_splitter_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ using namespace jubatus;
using namespace pfi::lang;

TEST(dynamic_splitter, trivial) {
dynamic_splitter s("libsplitter_sample.so",
dynamic_splitter s(LIBSPLITTER_SAMPLE,
"create",
map<string, string>());
vector<pair<size_t, size_t> > bounds;
Expand All @@ -49,7 +49,7 @@ TEST(dynamic_splitter, unknown_file) {

TEST(dynamic_splitter, unknown_function) {
EXPECT_THROW(
dynamic_splitter s("libsplitter_sample.so",
dynamic_splitter s(LIBSPLITTER_SAMPLE,
"unknown_function",
map<string, string>()),
converter_exception);
Expand Down
4 changes: 2 additions & 2 deletions src/server/fv_converter/dynamic_string_filter_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ namespace jubatus {
TEST(dynamic_string_filter, trivial) {
map<string, string> params;

dynamic_string_filter f("libfilter_sample.so",
dynamic_string_filter f(LIBFILTER_SAMPLE,
"create",
params);
string out;
Expand All @@ -44,7 +44,7 @@ TEST(dynamic_string_filter, unknown_file) {

TEST(dynamic_string_filter, unknown_function) {
map<string, string> params;
EXPECT_THROW(dynamic_string_filter f("libfilter_sample.so",
EXPECT_THROW(dynamic_string_filter f(LIBFILTER_SAMPLE,
"unknown_function",
params),
converter_exception);
Expand Down
2 changes: 1 addition & 1 deletion src/server/fv_converter/num_feature_factory_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ TEST(num_feature_factory, dynamic) {
param["path"] = "unknown_file_name";
ASSERT_THROW(f.create("dynamic", param), converter_exception);

param["path"] = "./libnum_feature_sample.so";
param["path"] = LIBNUM_FEATURE_SAMPLE;
ASSERT_THROW(f.create("dynamic", param), converter_exception);

param["function"] = "create";
Expand Down
2 changes: 1 addition & 1 deletion src/server/fv_converter/num_filter_factory_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ TEST(num_filter_factory, create_dynamic) {
EXPECT_THROW(f.create("dynamic", params),
converter_exception);

params["path"] = "./libnum_filter_sample.so";
params["path"] = LIBNUM_FILTER_SAMPLE;
EXPECT_THROW(f.create("dynamic", params),
converter_exception);

Expand Down
2 changes: 1 addition & 1 deletion src/server/fv_converter/splitter_factory_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ TEST(splitter_factory, dynamic) {
param["path"] = "unknown_file_name";
ASSERT_THROW(f.create("dynamic", param), converter_exception);

param["path"] = "./libsplitter_sample.so";
param["path"] = LIBSPLITTER_SAMPLE;
ASSERT_THROW(f.create("dynamic", param), converter_exception);

param["function"] = "create";
Expand Down
2 changes: 1 addition & 1 deletion src/server/fv_converter/string_filter_factory_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ TEST(string_filter_factory, dynamic) {
p["path"] = "unknown_file_name";
ASSERT_THROW(f.create("dynamic", p), converter_exception);

p["path"] = "./libfilter_sample.so";
p["path"] = LIBFILTER_SAMPLE;
ASSERT_THROW(f.create("dynamic", p), converter_exception);

p["function"] = "create";
Expand Down
5 changes: 5 additions & 0 deletions src/server/fv_converter/wscript
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,11 @@ def configure(conf):
conf.check_cxx(lib = 're2', define_name = 'HAVE_RE2',
errmsg = 'not found (add "--disable-re2" option if not necessary)')

libpat = conf.env.cxxshlib_PATTERN
conf.define('LIBSPLITTER_SAMPLE', libpat % 'splitter_sample')
conf.define('LIBFILTER_SAMPLE', libpat % 'filter_sample')
conf.define('LIBNUM_FEATURE_SAMPLE', libpat % 'num_feature_sample')
conf.define('LIBNUM_FILTER_SAMPLE', libpat % 'num_filter_sample')

def make_test(bld, use, src):
bld.program(
Expand Down
2 changes: 1 addition & 1 deletion src/server/storage/wscript
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ def make_tests(bld, srcs):
def build(bld):
cppfiles = ['storage_factory.cpp', 'storage_base.cpp', 'local_storage.cpp',
'local_storage_mixture.cpp']
use = 'PFICOMMON jubacommon'
use = 'PFICOMMON jubacommon MSGPACK'

bld.shlib(
source = cppfiles,
Expand Down

0 comments on commit a64079d

Please sign in to comment.