'msg_manager.cpp',
'gtest/tuple_gen_test.cpp',
'gtest/nat_test.cpp',
- 'gtest/rpc_test.cpp',
'pal/linux/pal_utl.cpp',
'pal/linux/mbuf.cpp'
# RPC mock server (test)
rpc_server_mock_src = SrcGroup(dir='src/rpc-server/src',
src_list=[
- 'trex_rpc_server_mock.cpp'
+ 'trex_rpc_server_mock.cpp',
+ '../../gtest/rpc_test.cpp',
])
# JSON package
'jsoncpp.cpp'
])
-rpc_server_mock = SrcGroups([rpc_server_src,
- rpc_server_mock_src,
- json_src
- ])
+rpc_server_mock = SrcGroups([cmn_src,
+ rpc_server_src,
+ rpc_server_mock_src,
+ json_src
+ ])
yaml_src = SrcGroup(dir='yaml-cpp/src/',
src_list=[
main_src,
cmn_src ,
net_src ,
- rpc_server_src,
yaml_src,
- json_src
]);
class build_option:
- def __init__(self, name, src, platform, debug_mode, is_pie):
+ def __init__(self, name, src, platform, debug_mode, is_pie, use = []):
self.mode = debug_mode; ##debug,release
self.platform = platform; #['32','64']
self.is_pie = is_pie
self.name = name
self.src = src
+ self.use = use
def __str__(self):
s=self.mode+","+self.platform;
return result;
+ def get_use_libs (self):
+ return self.use
+
def get_target (self):
return self.update_executable_name(self.name);
build_option(name = "bp-sim", src = bp, debug_mode= RELEASE_,platform = PLATFORM_32, is_pie = False),
build_option(name = "bp-sim", src = bp, debug_mode= RELEASE_,platform = PLATFORM_64, is_pie = False),
- build_option(name = "mock-rpc-server", src = rpc_server_mock, debug_mode= DEBUG_,platform = PLATFORM_64, is_pie = False),
+ build_option(name = "mock-rpc-server", use = ['zmq'], src = rpc_server_mock, debug_mode= DEBUG_,platform = PLATFORM_64, is_pie = False),
]
cxxflags =build_obj.get_flags(),
linkflags = build_obj.get_link_flags(),
source = build_obj.get_src(),
- use = ['zmq'],
+ use = build_obj.get_use_libs(),
rpath = bld.env.RPATH,
target = build_obj.get_target())
string resp_str;
/* simple add - missing paramters */
- req_str = "{\"jsonrpc\": \"2.0\", \"method\": \"test_rpc_add\", \"id\": 488}";
+ req_str = "{\"jsonrpc\": \"2.0\", \"method\": \"rpc_test_add\", \"id\": 488}";
resp_str = send_msg(req_str);
EXPECT_TRUE(reader.parse(resp_str, response, false));
EXPECT_EQ(response["error"]["code"], -32602);
/* simple add that works */
- req_str = "{\"jsonrpc\": \"2.0\", \"method\": \"test_rpc_add\", \"params\": {\"x\": 17, \"y\": -13} , \"id\": \"itay\"}";
+ req_str = "{\"jsonrpc\": \"2.0\", \"method\": \"rpc_test_add\", \"params\": {\"x\": 17, \"y\": -13} , \"id\": \"itay\"}";
resp_str = send_msg(req_str);
EXPECT_TRUE(reader.parse(resp_str, response, false));
EXPECT_EQ(response["result"], 4);
/* add with bad paratemers types */
- req_str = "{\"jsonrpc\": \"2.0\", \"method\": \"test_rpc_add\", \"params\": {\"x\": \"blah\", \"y\": -13} , \"id\": 17}";
+ req_str = "{\"jsonrpc\": \"2.0\", \"method\": \"rpc_test_add\", \"params\": {\"x\": \"blah\", \"y\": -13} , \"id\": 17}";
resp_str = send_msg(req_str);
EXPECT_TRUE(reader.parse(resp_str, response, false));
EXPECT_EQ(response["error"]["code"], -32602);
/* add with invalid count of parameters */
- req_str = "{\"jsonrpc\": \"2.0\", \"method\": \"test_rpc_add\", \"params\": {\"y\": -13} , \"id\": 17}";
+ req_str = "{\"jsonrpc\": \"2.0\", \"method\": \"rpc_test_add\", \"params\": {\"y\": -13} , \"id\": 17}";
resp_str = send_msg(req_str);
EXPECT_TRUE(reader.parse(resp_str, response, false));
/* big numbers */
- req_str = "{\"jsonrpc\": \"2.0\", \"method\": \"test_rpc_add\", \"params\": {\"x\": 4827371, \"y\": -39181273} , \"id\": \"itay\"}";
+ req_str = "{\"jsonrpc\": \"2.0\", \"method\": \"rpc_test_add\", \"params\": {\"x\": 4827371, \"y\": -39181273} , \"id\": \"itay\"}";
resp_str = send_msg(req_str);
EXPECT_TRUE(reader.parse(resp_str, response, false));
string resp_str;
req_str = "[ \
- {\"jsonrpc\": \"2.0\", \"method\": \"test_rpc_add\", \"params\": {\"x\": 22, \"y\": 17}, \"id\": \"1\"}, \
- {\"jsonrpc\": \"2.0\", \"method\": \"test_rpc_sub\", \"params\": {\"x\": 22, \"y\": 17}, \"id\": \"2\"}, \
- {\"jsonrpc\": \"2.0\", \"method\": \"test_rpc_add\", \"params\": {\"x\": 22, \"y\": \"itay\"}, \"id\": \"2\"}, \
+ {\"jsonrpc\": \"2.0\", \"method\": \"rpc_test_add\", \"params\": {\"x\": 22, \"y\": 17}, \"id\": \"1\"}, \
+ {\"jsonrpc\": \"2.0\", \"method\": \"rpc_test_sub\", \"params\": {\"x\": 22, \"y\": 17}, \"id\": \"2\"}, \
+ {\"jsonrpc\": \"2.0\", \"method\": \"rpc_test_add\", \"params\": {\"x\": 22, \"y\": \"itay\"}, \"id\": \"2\"}, \
{\"foo\": \"boo\"}, \
{\"jsonrpc\": \"2.0\", \"method\": \"test_rpc_sheker\", \"params\": {\"name\": \"myself\"}, \"id\": 5}, \
- {\"jsonrpc\": \"2.0\", \"method\": \"test_rpc_add\", \"params\": {\"x\": 22, \"y\": 17} } \
+ {\"jsonrpc\": \"2.0\", \"method\": \"rpc_test_add\", \"params\": {\"x\": 22, \"y\": 17} } \
]";
resp_str = send_msg(req_str);