enabled all warnings for the mock RPC server target
authorimarom <[email protected]>
Wed, 16 Sep 2015 14:12:30 +0000 (17:12 +0300)
committerimarom <[email protected]>
Wed, 16 Sep 2015 14:12:30 +0000 (17:12 +0300)
linux/ws_main.py
src/common/captureFile.cpp
src/gtest/rpc_test.cpp
src/rpc-server/commands/trex_rpc_cmd_general.cpp
src/rpc-server/trex_rpc_cmd_api.h
src/stateless/trex_stateless.cpp

index e9f21d1..789895d 100755 (executable)
@@ -368,7 +368,8 @@ build_types = [
                #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", use = ['zmq'], src = rpc_server_mock, debug_mode= DEBUG_,platform = PLATFORM_64, is_pie = False, flags = ['-DTREX_RPC_MOCK_SERVER'],
+               build_option(name = "mock-rpc-server", use = ['zmq'], src = rpc_server_mock, debug_mode= DEBUG_,platform = PLATFORM_64, is_pie = False, 
+                            flags = ['-DTREX_RPC_MOCK_SERVER', '-Wall', '-Wno-sign-compare', '-Werror'],
                             rpath = ['.']),
               ]
 
index a4fe78b..0062518 100755 (executable)
@@ -110,7 +110,7 @@ void CCapPktRaw::CloneShalow(CCapPktRaw  *obj){
 }
 
 void CCapPktRaw::Dump(FILE *fd,int verbose){
-       fprintf(fd," =>pkt (%p) %llu , len %d, time [%x:%x] \n",raw,pkt_cnt,pkt_len,time_sec,time_nsec);
+       fprintf(fd," =>pkt (%p) %llu , len %d, time [%x:%x] \n",raw, (unsigned long long)pkt_cnt,pkt_len,time_sec,time_nsec);
        if (verbose) {
                utl_DumpBuffer(fd,raw,pkt_len,0);
        }
index 02d88ea..5819700 100644 (file)
@@ -25,6 +25,8 @@ limitations under the License.
 #include <zmq.h>
 #include <json/json.h>
 #include <sstream>
+#include <vector>
+#include <algorithm>
 
 using namespace std;
 
@@ -518,3 +520,62 @@ TEST_F(RpcTestOwned, add_remove_stream) {
 }
 
 
+TEST_F(RpcTestOwned, get_stream_id_list) {
+    Json::Value request;
+    Json::Value response;
+    Json::Reader reader;
+
+    
+     /* add stream 1 */
+    create_request(request, "add_stream");
+    request["params"]["port_id"] = 1;
+
+
+    Json::Value stream;
+    create_simple_stream(stream);
+
+    request["params"]["stream"] = stream;
+
+    request["params"]["stream_id"] = 5;
+    send_request(request, response);
+    EXPECT_EQ(response["result"], "ACK");
+
+    request["params"]["stream_id"] = 12;
+    send_request(request, response);
+    EXPECT_EQ(response["result"], "ACK");
+
+    request["params"]["stream_id"] = 19;
+    send_request(request, response);
+    EXPECT_EQ(response["result"], "ACK");
+
+
+    create_request(request, "get_stream_list");
+    request["params"]["port_id"] = 1;
+    send_request(request, response);
+
+    EXPECT_TRUE(response["result"].isArray());
+    vector<int> vec;
+    for (auto x : response["result"]) {
+        vec.push_back(x.asInt());
+    }
+
+    sort(vec.begin(), vec.end());
+
+    EXPECT_EQ(vec[0], 5);
+    EXPECT_EQ(vec[1], 12);
+    EXPECT_EQ(vec[2], 19);
+
+    create_request(request, "remove_all_streams");
+    request["params"]["port_id"] = 1;
+    send_request(request, response);
+
+    EXPECT_TRUE(response["result"] == "ACK");
+
+    /* make sure the lights are off ... */
+    create_request(request, "get_stream_list");
+    request["params"]["port_id"] = 1;
+    send_request(request, response);
+
+    EXPECT_TRUE(response["result"].isArray());
+    EXPECT_TRUE(response["result"].size() == 0);
+}
index afa1597..fcdb7ac 100644 (file)
@@ -28,8 +28,6 @@ limitations under the License.
 #include <iostream>
 #include <unistd.h>
 
-//#include <netdb.h>
-
 #ifndef TREX_RPC_MOCK_SERVER
     #include <../linux_dpdk/version.h>
 #endif
index c72b3e3..cab50cf 100644 (file)
@@ -177,6 +177,9 @@ protected:
         s.pop_back();
         s += "]";
         generate_parse_err(result, s);
+
+        /* dummy return value - does not matter, the above will throw exception */
+        return (*choices.begin());
     }
 
     /**
index b51c4e6..537dfa4 100644 (file)
@@ -107,7 +107,7 @@ void
 TrexStatelessPort::stop_traffic(void) {
 
     /* real code goes here */
-    if (m_port_state = PORT_STATE_TRANSMITTING) {
+    if (m_port_state == PORT_STATE_TRANSMITTING) {
         m_port_state = PORT_STATE_UP_IDLE;
     }
 }