Skip to content

Commit

Permalink
Fix the compiler warnings in the contrail agent test cases
Browse files Browse the repository at this point in the history
Change-Id: I0808192a0082d74b5800f8d4d9810197bb0730e0
Closes-bug: #1400267
  • Loading branch information
numansiddique committed Dec 8, 2014
1 parent c7f3cc1 commit 92f398b
Show file tree
Hide file tree
Showing 11 changed files with 144 additions and 148 deletions.
4 changes: 2 additions & 2 deletions src/vnsw/agent/diag/test/test_ping.cc
Expand Up @@ -95,7 +95,7 @@ class DiagTest : public ::testing::Test {
mac.ToArray(eth->ether_shost, sizeof(eth->ether_shost));

agent_hdr *agent = (agent_hdr *)(eth + 1);
int intf_id = ntohs(agent->hdr_ifindex);
uint16_t intf_id = ntohs(agent->hdr_ifindex);
LOG(DEBUG, "Diag Callback; Agent index : " <<
ntohs(agent->hdr_ifindex) << " Interface index : " <<
GetItfId(0) << " " << GetItfId(1));
Expand Down Expand Up @@ -220,7 +220,7 @@ TEST_F(DiagTest, DiagReqTest) {
EXPECT_TRUE(count() == 3);

client->Reset();
DeleteVmportEnv(input, 2, 1, 0);
DeleteVmportEnv(input, 2, 1, 0);
client->WaitForIdle();
}

Expand Down
6 changes: 3 additions & 3 deletions src/vnsw/agent/init/test/test_vmware.cc
Expand Up @@ -38,9 +38,9 @@ class VmwareTest : public ::testing::Test {
AgentParam *param;
Agent *agent;

int intf_count_;
int nh_count_;
int vrf_count_;
unsigned int intf_count_;
unsigned int nh_count_;
unsigned int vrf_count_;

opt::options_description desc;
opt::variables_map var_map;
Expand Down
38 changes: 19 additions & 19 deletions src/vnsw/agent/kstate/test/test_kstate.cc
Expand Up @@ -101,33 +101,33 @@ class KStateTest : public ::testing::Test {
idx = i;
WAIT_FOR(1000, 1000, (VmPortActive(input, idx) == true));
}
WAIT_FOR(1000, 1000, (num_ports == Agent::GetInstance()->vm_table()->Size()));
WAIT_FOR(1000, 1000, ((unsigned int)num_ports == Agent::GetInstance()->vm_table()->Size()));
WAIT_FOR(1000, 1000, (1 == Agent::GetInstance()->vn_table()->Size()));
WaitForVrf(input, 0, true);
if (if_count) {
unsigned int oper_if_count = num_ports + if_count;
WAIT_FOR(1000, 1000, ((oper_if_count) ==
WAIT_FOR(1000, 1000, ((oper_if_count) ==
Agent::GetInstance()->interface_table()->Size()));
}
WAIT_FOR(1000, 1000, ((num_ports * 2)==
WAIT_FOR(1000, 1000, ((unsigned int)(num_ports * 2)==
Agent::GetInstance()->mpls_table()->Size()));
if (!ksync_init_) {
WAIT_FOR(1000, 1000, ((num_ports * 2) ==
KSyncSockTypeMap::MplsCount()));
if (if_count) {
WAIT_FOR(1000, 1000, ((num_ports + if_count) ==
WAIT_FOR(1000, 1000, ((num_ports + if_count) ==
KSyncSockTypeMap::IfCount()));
}
if (nh_count) {
//5 interface nexthops get created for each interface
//(l2 with policy, l2 without policy, l3 with policy, l3
//5 interface nexthops get created for each interface
//(l2 with policy, l2 without policy, l3 with policy, l3
// without policy and 1 multicast - mac as all f's)
//plus 4 Nexthops for each VRF (1 VRF NH and 2 Composite NHs)
WAIT_FOR(1000, 1000, ((nh_count + (num_ports * 5) + 3) ==
KSyncSockTypeMap::NHCount()));
}
if (rt_count) {
WAIT_FOR(1000, 1000, ((rt_count + (num_ports * 2) + 1) ==
WAIT_FOR(1000, 1000, ((rt_count + (num_ports * 2) + 1) ==
KSyncSockTypeMap::RouteCount()));
}
}
Expand Down Expand Up @@ -216,7 +216,7 @@ TEST_F(KStateTest, IfDumpTest) {
client->KStateResponseWait(1);
if_count = TestKStateBase::fetched_count_;
LOG(DEBUG, "if count " << if_count);

CreatePorts(if_count, 0, 0);
TestIfKState::Init(-1, true, if_count + MAX_TEST_FD);
client->WaitForIdle();
Expand All @@ -231,7 +231,7 @@ TEST_F(KStateTest, IfGetTest) {
client->KStateResponseWait(1);
if_count = TestKStateBase::fetched_count_;
LOG(DEBUG, "if count " << if_count);

CreatePorts(if_count, 0, 0);
for (int i = 0; i < MAX_TEST_FD; i++) {
TestIfKState::Init(if_count + i);
Expand All @@ -251,8 +251,8 @@ TEST_F(KStateTest, NHDumpTest) {
int max_ports = 2;

CreatePorts(0, nh_count, 0, max_ports);
//5 interface nexthops get created for each interface
//(l2 with policy, l2 without policy, l3 with policy, l3 without policy
//5 interface nexthops get created for each interface
//(l2 with policy, l2 without policy, l3 with policy, l3 without policy
// and 1 multicast - mac as all f's )
//plus 4 Nexthops for each VRF (1 VRF NH and 2 Composite NHs)
TestNHKState::Init(-1, true, nh_count + (max_ports * 5) + 3);
Expand Down Expand Up @@ -294,7 +294,7 @@ TEST_F(KStateTest, MplsDumpTest) {
client->WaitForIdle();
client->KStateResponseWait(1);
mpls_count = TestKStateBase::fetched_count_;

CreatePorts(0, 0, 0);
TestMplsKState::Init(-1, true, mpls_count + MAX_TEST_MPLS);
client->WaitForIdle(3);
Expand Down Expand Up @@ -384,7 +384,7 @@ TEST_F(KStateTest, RouteDumpTest) {
//Default
//Addition of 2 vm ports in a new VN (VRF) will result in the following routes
// 2 routes corresponding to the addresses of VM
// l2 broadcast
// l2 broadcast
// 2 - v6 host route for new vrf addition
TestRouteKState::Init(true, prev_rt_count + (MAX_TEST_FD * 2) + 3);
client->WaitForIdle();
Expand All @@ -411,31 +411,31 @@ TEST_F(KStateTest, DISABLED_FlowDumpTest) {
//Flow creation using IP packet
TxIpPacketUtil(test0->id(), vm1_ip, vm2_ip, 0, hash_id);
client->WaitForIdle(2);
EXPECT_TRUE(FlowGet("vrf3", vm1_ip, vm2_ip, 0, 0, 0, false,
EXPECT_TRUE(FlowGet("vrf3", vm1_ip, vm2_ip, 0, 0, 0, false,
"vn3", "vn3", hash_id++,
test0->flow_key_nh()->id()));

//Create flow in reverse direction
TxIpPacketUtil(test1->id(), vm2_ip, vm1_ip, 0, hash_id);
client->WaitForIdle(2);
EXPECT_TRUE(FlowGet("vrf3", vm2_ip, vm1_ip, 0, 0, 0, true,
EXPECT_TRUE(FlowGet("vrf3", vm2_ip, vm1_ip, 0, 0, 0, true,
"vn3", "vn3", hash_id++,
test1->flow_key_nh()->id(),
test0->flow_key_nh()->id()));

//Flow creation using TCP packet
TxTcpPacketUtil(test0->id(), vm1_ip, vm2_ip, 1000, 200,
TxTcpPacketUtil(test0->id(), vm1_ip, vm2_ip, 1000, 200,
hash_id);
client->WaitForIdle(2);
EXPECT_TRUE(FlowGet("vrf3", vm1_ip, vm2_ip, 6, 1000, 200, false,
"vn3", "vn3", hash_id++,
test0->flow_key_nh()->id()));

//Create flow in reverse direction and make sure it is linked to previous flow
TxTcpPacketUtil(test1->id(), vm2_ip, vm1_ip, 200, 1000,
TxTcpPacketUtil(test1->id(), vm2_ip, vm1_ip, 200, 1000,
hash_id);
client->WaitForIdle(2);
EXPECT_TRUE(FlowGet("vrf3", vm2_ip, vm1_ip, 6, 200, 1000, true,
EXPECT_TRUE(FlowGet("vrf3", vm2_ip, vm1_ip, 6, 200, 1000, true,
"vn3", "vn3", hash_id++,
test1->flow_key_nh()->id(),
test0->flow_key_nh()->id()));
Expand All @@ -455,7 +455,7 @@ TEST_F(KStateTest, DISABLED_FlowDumpTest) {
int main(int argc, char *argv[]) {
int ret;
GETUSERARGS();

/* Supported only with non-ksync mode for now */
ksync_init = false;

Expand Down
8 changes: 4 additions & 4 deletions src/vnsw/agent/oper/test/test_inet_interface.cc
Expand Up @@ -81,9 +81,9 @@ class InetInterfaceTest : public ::testing::Test {
WAIT_FOR(100, 1000, (agent_->vn_table()->Size() == 0U));
}

int intf_count_;
int nh_count_;
int vrf_count_;
unsigned int intf_count_;
unsigned int nh_count_;
unsigned int vrf_count_;
Agent *agent_;
InterfaceTable *interface_table_;
NextHopTable *nh_table_;
Expand Down Expand Up @@ -156,7 +156,7 @@ TEST_F(InetInterfaceTest, vhost_key_manipulations) {
"1.1.1.1", 24, "1.1.1.254");
client->WaitForIdle();

ReceiveNH *nh = static_cast<ReceiveNH *>(ReceiveNHGet(nh_table_, "vhost1",
ReceiveNH *nh = static_cast<ReceiveNH *>(ReceiveNHGet(nh_table_, "vhost1",
false));
EXPECT_TRUE(nh != NULL);
DBEntryBase::KeyPtr key = nh->GetDBRequestKey();
Expand Down
3 changes: 2 additions & 1 deletion src/vnsw/agent/oper/test/test_instance_task.cc
Expand Up @@ -22,7 +22,8 @@ class InstanceTaskFdTest : public ::testing::Test {
virtual void SetUp() {
memset(tmpfilename, 0, sizeof(tmpfilename));
strcpy(tmpfilename, "task_fd_XXXXXX");
mkstemp(tmpfilename);
if(mkstemp(tmpfilename) == -1)
return;
std::fstream testfile(tmpfilename);
testfile << "while true; do sleep 1; done";
testfile.close();
Expand Down

0 comments on commit 92f398b

Please sign in to comment.