Skip to content

Commit

Permalink
Remove white space endings (sonic-net#922)
Browse files Browse the repository at this point in the history
  • Loading branch information
kcudnik authored Sep 8, 2021
1 parent 1c4f04c commit f3bc342
Show file tree
Hide file tree
Showing 25 changed files with 52 additions and 49 deletions.
2 changes: 1 addition & 1 deletion lib/Switch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ void Switch::updateNotifications(
break;

case SAI_SWITCH_ATTR_BFD_SESSION_STATE_CHANGE_NOTIFY:
m_switchNotifications.on_bfd_session_state_change =
m_switchNotifications.on_bfd_session_state_change =
(sai_bfd_session_state_change_notification_fn)attr.value.ptr;
break;

Expand Down
2 changes: 1 addition & 1 deletion meta/Meta.h
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ namespace saimeta

void meta_sai_on_bfd_session_state_change(
_In_ uint32_t count,
_In_ const sai_bfd_session_state_notification_t *data);
_In_ const sai_bfd_session_state_notification_t *data);

private: // notifications helpers

Expand Down
2 changes: 1 addition & 1 deletion meta/SaiObject.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ SaiObject::SaiObject(
m_metaKey(metaKey)
{
SWSS_LOG_ENTER();

if (!sai_metadata_is_object_type_valid(metaKey.objecttype))
{
SWSS_LOG_THROW("invalid object type: %d", metaKey.objecttype);
Expand Down
2 changes: 1 addition & 1 deletion meta/sai_serialize.h
Original file line number Diff line number Diff line change
Expand Up @@ -412,7 +412,7 @@ void sai_deserialize_free_queue_deadlock_ntf(

void sai_deserialize_free_bfd_session_state_ntf(
_In_ uint32_t count,
_In_ sai_bfd_session_state_notification_t* bfdsessionstate);
_In_ sai_bfd_session_state_notification_t* bfdsessionstate);

void sai_deserialize_ingress_priority_group_attr(
_In_ const std::string& s,
Expand Down
6 changes: 3 additions & 3 deletions syncd/scripts/syncd_init_common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -161,11 +161,11 @@ config_syncd_bcm()
fi

fi
if [ -f "$HWSKU_DIR/context_config.json" ]; then

if [ -f "$HWSKU_DIR/context_config.json" ]; then
CMD_ARGS+=" -x $HWSKU_DIR/context_config.json -g 0"
fi

[ -e /dev/linux-bcm-knet ] || mknod /dev/linux-bcm-knet c 122 0
[ -e /dev/linux-user-bde ] || mknod /dev/linux-user-bde c 126 0
[ -e /dev/linux-kernel-bde ] || mknod /dev/linux-kernel-bde c 127 0
Expand Down
6 changes: 5 additions & 1 deletion tests/checkwhitespace.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,11 @@

echo Checkig for white spaces ...

find .. -type f | grep -v SAI/ |grep -f _wrap.cpp| perl -ne 'print if /\.(c|cpp|h|hpp|am|sh|pl|pm|install|dirs|links|json|ini|yml|pws|md|py|cfg|conf|i|ac)$/' | xargs grep -P "\\s\$"
find .. -type f |
grep -v SAI/ |
grep -v _wrap.cpp |
perl -ne 'print if /\.(c|cpp|h|hpp|am|sh|pl|pm|install|dirs|links|json|ini|yml|pws|md|py|cfg|conf|i|ac)$/' |
xargs grep -P "\\s\$"

if [ $? -eq 0 ]; then
echo ERROR: some files contain white spaces at the end of line, please fix
Expand Down
2 changes: 1 addition & 1 deletion tests/findcrossinclude.sh
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ find ../meta/.deps -name "*.Plo" -o -name "*.Po"|xargs grep -P "[^r]/lib/|vslib/
echo -- find cross include in lib directory

find ../lib/.deps -name "*.Plo" -o -name "*.Po"|xargs grep -P "vslib/|syncd/"

echo -- find cross include in vslib directory

find ../vslib/.deps -name "*.Plo" -o -name "*.Po"|xargs grep -P "[^r]/lib/|syncd/"| \
Expand Down
5 changes: 2 additions & 3 deletions unittest/lib/TestUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ using namespace sairedis;
TEST(Utils, clearOidValues)
{
sai_attribute_t attr;

sai_object_id_t oids[1];

attr.id = 1000;

EXPECT_THROW(Utils::clearOidValues(SAI_OBJECT_TYPE_NULL, 1, &attr), std::runtime_error);
Expand Down Expand Up @@ -59,4 +59,3 @@ TEST(Utils, clearOidValues)
EXPECT_EQ(oids[0], 0);

}

2 changes: 1 addition & 1 deletion unittest/lib/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

#include <iostream>

class SwsscommonEnvironment:
class SwsscommonEnvironment:
public ::testing::Environment
{
public:
Expand Down
6 changes: 3 additions & 3 deletions unittest/lib/main_libsairedis.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -76,12 +76,12 @@ static sai_service_method_table_t test_services = {
profile_get_next_value
};

class sairedisEnvironment:
class sairedisEnvironment:
public ::testing::Environment
{
public:

virtual void SetUp() override
virtual void SetUp() override
{
SWSS_LOG_ENTER();

Expand All @@ -91,7 +91,7 @@ class sairedisEnvironment:

EXPECT_EQ(status, SAI_STATUS_SUCCESS);
}

virtual void TearDown() override
{
SWSS_LOG_ENTER();
Expand Down
2 changes: 1 addition & 1 deletion unittest/lib/test_sai_redis_hostif.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ TEST(libsairedis, hostif)
EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_hostif_trap_group(0));
EXPECT_NE(SAI_STATUS_SUCCESS, api->set_hostif_trap_group_attribute(0,0));
EXPECT_NE(SAI_STATUS_SUCCESS, api->get_hostif_trap_group_attribute(0,0,0));

EXPECT_NE(SAI_STATUS_SUCCESS, api->create_hostif_trap(&id,0,0,0));
EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_hostif_trap(0));
EXPECT_NE(SAI_STATUS_SUCCESS, api->set_hostif_trap_attribute(0,0));
Expand Down
2 changes: 1 addition & 1 deletion unittest/meta/TestLegacy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ namespace TestLegacy
auto status = g_meta->remove(SAI_OBJECT_TYPE_SWITCH, switchId);

EXPECT_EQ(SAI_STATUS_SUCCESS, status);

if (g_meta->isEmpty() == false)
{
g_meta->dump();
Expand Down
2 changes: 1 addition & 1 deletion unittest/meta/TestNotificationFactory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ TEST(NotificationFactory, deserialize_switch_state_change)
auto str = sai_serialize_switch_oper_status(0x2100000000, status);

// {"status":"SAI_SWITCH_OPER_STATUS_UP","switch_id":"oid:0x2100000000"}

auto ntf = NotificationFactory::deserialize(
SAI_SWITCH_NOTIFICATION_NAME_SWITCH_STATE_CHANGE,
str);
Expand Down
4 changes: 2 additions & 2 deletions unittest/meta/TestNotificationFdbEvent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@
using namespace sairedis;
using namespace saimeta;

static std::string s =
static std::string s =
"[{\"fdb_entry\":\"{\\\"bvid\\\":\\\"oid:0x260000000005be\\\",\\\"mac\\\":\\\"52:54:00:86:DD:7A\\\",\\\"switch_id\\\":\\\"oid:0x21000000000000\\\"}\","
"\"fdb_event\":\"SAI_FDB_EVENT_LEARNED\","
"\"list\":[{\"id\":\"SAI_FDB_ENTRY_ATTR_TYPE\",\"value\":\"SAI_FDB_ENTRY_TYPE_DYNAMIC\"},{\"id\":\"SAI_FDB_ENTRY_ATTR_BRIDGE_PORT_ID\",\"value\":\"oid:0x3a000000000660\"}]}]";

static std::string null =
static std::string null =
"[{\"fdb_entry\":\"{\\\"bvid\\\":\\\"oid:0x260000000005be\\\",\\\"mac\\\":\\\"52:54:00:86:DD:7A\\\",\\\"switch_id\\\":\\\"oid:0x0\\\"}\","
"\"fdb_event\":\"SAI_FDB_EVENT_LEARNED\","
"\"list\":[{\"id\":\"SAI_FDB_ENTRY_ATTR_TYPE\",\"value\":\"SAI_FDB_ENTRY_TYPE_DYNAMIC\"},{\"id\":\"SAI_FDB_ENTRY_ATTR_BRIDGE_PORT_ID\",\"value\":\"oid:0x3a000000000660\"}]}]";
Expand Down
4 changes: 2 additions & 2 deletions unittest/meta/TestSaiSerialize.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -585,7 +585,7 @@ TEST(SaiSerialize, serialize_chardata)
EXPECT_THROW(sai_deserialize_attr_value("\\x2g", *meta, attr), std::runtime_error);

EXPECT_THROW(sai_deserialize_attr_value("\\x2", *meta, attr), std::runtime_error);

EXPECT_THROW(sai_deserialize_attr_value("\\s45", *meta, attr), std::runtime_error);

EXPECT_THROW(sai_deserialize_attr_value("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", *meta, attr), std::runtime_error);
Expand Down Expand Up @@ -626,7 +626,7 @@ TEST(SaiSerialize, serialize_uint64)
EXPECT_EQ(12345, attr.value.u64);

EXPECT_THROW(sai_deserialize_attr_value("22345235345345345435", *meta, attr), std::runtime_error);

EXPECT_THROW(sai_deserialize_attr_value("2a", *meta, attr), std::runtime_error);
}

Expand Down
2 changes: 1 addition & 1 deletion unittest/meta/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

#include <iostream>

class SwsscommonEnvironment:
class SwsscommonEnvironment:
public ::testing::Environment
{
public:
Expand Down
2 changes: 1 addition & 1 deletion unittest/syncd/Makefile.am
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
AM_CXXFLAGS = $(SAIINC) -I$(top_srcdir)/syncd -I$(top_srcdir)/lib -I$(top_srcdir)/vslib
AM_CXXFLAGS = $(SAIINC) -I$(top_srcdir)/syncd -I$(top_srcdir)/lib -I$(top_srcdir)/vslib

bin_PROGRAMS = tests

Expand Down
14 changes: 7 additions & 7 deletions unittest/vslib/TestFdbInfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ TEST(FdbInfo, serialize)

TEST(FdbInfo, deserialize)
{
std::string str =
std::string str =
"{\"bridge_port_id\":\"oid:0x1\","
"\"fdb_entry\":\"{\\\"bvid\\\":\\\"oid:0x0\\\",\\\"mac\\\":\\\"00:00:00:00:00:00\\\",\\\"switch_id\\\":\\\"oid:0x0\\\"}\","
"\"port_id\":\"oid:0x0\","
Expand Down Expand Up @@ -124,14 +124,14 @@ TEST(FdbInfo, setTimestamp)

TEST(FdbInfo, operator_bracket)
{
std::string strA =
std::string strA =
"{\"bridge_port_id\":\"oid:0x1\","
"\"fdb_entry\":\"{\\\"bvid\\\":\\\"oid:0x0\\\",\\\"mac\\\":\\\"00:00:00:00:00:00\\\",\\\"switch_id\\\":\\\"oid:0x0\\\"}\","
"\"port_id\":\"oid:0x0\","
"\"timestamp\":\"0\","
"\"vlan_id\":\"0\"}";

std::string strB =
std::string strB =
"{\"bridge_port_id\":\"oid:0x1\","
"\"fdb_entry\":\"{\\\"bvid\\\":\\\"oid:0x0\\\",\\\"mac\\\":\\\"00:00:00:00:00:01\\\",\\\"switch_id\\\":\\\"oid:0x0\\\"}\","
"\"port_id\":\"oid:0x0\","
Expand All @@ -147,14 +147,14 @@ TEST(FdbInfo, operator_bracket)

TEST(FdbInfo, operator_lt)
{
std::string strA =
std::string strA =
"{\"bridge_port_id\":\"oid:0x1\","
"\"fdb_entry\":\"{\\\"bvid\\\":\\\"oid:0x0\\\",\\\"mac\\\":\\\"00:00:00:00:00:00\\\",\\\"switch_id\\\":\\\"oid:0x0\\\"}\","
"\"port_id\":\"oid:0x0\","
"\"timestamp\":\"0\","
"\"vlan_id\":\"0\"}";

std::string strB =
std::string strB =
"{\"bridge_port_id\":\"oid:0x1\","
"\"fdb_entry\":\"{\\\"bvid\\\":\\\"oid:0x0\\\",\\\"mac\\\":\\\"00:00:00:00:00:01\\\",\\\"switch_id\\\":\\\"oid:0x0\\\"}\","
"\"port_id\":\"oid:0x0\","
Expand All @@ -169,14 +169,14 @@ TEST(FdbInfo, operator_lt)
EXPECT_EQ(a < a, false);
EXPECT_EQ(b < b, false);

std::string strC =
std::string strC =
"{\"bridge_port_id\":\"oid:0x1\","
"\"fdb_entry\":\"{\\\"bvid\\\":\\\"oid:0x0\\\",\\\"mac\\\":\\\"00:00:00:00:00:00\\\",\\\"switch_id\\\":\\\"oid:0x0\\\"}\","
"\"port_id\":\"oid:0x0\","
"\"timestamp\":\"0\","
"\"vlan_id\":\"1\"}";

std::string strD =
std::string strD =
"{\"bridge_port_id\":\"oid:0x1\","
"\"fdb_entry\":\"{\\\"bvid\\\":\\\"oid:0x0\\\",\\\"mac\\\":\\\"00:00:00:00:00:00\\\",\\\"switch_id\\\":\\\"oid:0x0\\\"}\","
"\"port_id\":\"oid:0x0\","
Expand Down
8 changes: 4 additions & 4 deletions unittest/vslib/TestSwitchBCM56850.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ TEST(SwitchBCM56850, ctr)
nullptr);

sai_attribute_t attr;

attr.id = SAI_SWITCH_ATTR_INIT_SWITCH;
attr.value.booldata = true;

Expand Down Expand Up @@ -67,7 +67,7 @@ TEST(SwitchBCM56850, refresh_bridge_port_list)
sc);

sai_attribute_t attr;

attr.id = SAI_SWITCH_ATTR_INIT_SWITCH;
attr.value.booldata = true;

Expand All @@ -92,7 +92,7 @@ TEST(SwitchBCM56850, refresh_bridge_port_list)
attr.value.objlist.list = list;

EXPECT_EQ(sw.get(SAI_OBJECT_TYPE_BRIDGE, sboid, 1, &attr), SAI_STATUS_SUCCESS);

//std::cout << sw.dump_switch_database_for_warm_restart();
}

Expand Down Expand Up @@ -242,7 +242,7 @@ TEST(SwitchBCM56850, warm_update_queues)
warmBootState);

sai_attribute_t attr;

attr.id = SAI_SWITCH_ATTR_INIT_SWITCH;
attr.value.booldata = true;

Expand Down
6 changes: 3 additions & 3 deletions unittest/vslib/TestSwitchBCM81724.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ TEST(SwitchBCM81724, ctr)
nullptr);

sai_attribute_t attr;

attr.id = SAI_SWITCH_ATTR_INIT_SWITCH;
attr.value.booldata = true;

Expand Down Expand Up @@ -71,7 +71,7 @@ TEST(SwitchBCM81724, refresh_read_only)
sc);

sai_attribute_t attr;

attr.id = SAI_SWITCH_ATTR_INIT_SWITCH;
attr.value.booldata = true;

Expand All @@ -98,7 +98,7 @@ TEST(SwitchBCM81724, refresh_read_only)
attrs[1].value.u32 = 10000;

sai_object_id_t portId = mgr->allocateNewObjectId(SAI_OBJECT_TYPE_PORT, switchId);

auto strPortId = sai_serialize_object_id(portId);

EXPECT_EQ(sw.create(SAI_OBJECT_TYPE_PORT, strPortId, switchId, 2, attrs), SAI_STATUS_SUCCESS);
Expand Down
6 changes: 3 additions & 3 deletions unittest/vslib/TestSwitchMLNX2700.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ TEST(SwitchMLNX2700, ctr)
nullptr);

sai_attribute_t attr;

attr.id = SAI_SWITCH_ATTR_INIT_SWITCH;
attr.value.booldata = true;

Expand Down Expand Up @@ -67,7 +67,7 @@ TEST(SwitchMLNX2700, refresh_bridge_port_list)
sc);

sai_attribute_t attr;

attr.id = SAI_SWITCH_ATTR_INIT_SWITCH;
attr.value.booldata = true;

Expand Down Expand Up @@ -241,7 +241,7 @@ TEST(SwitchMLNX2700, warm_update_queues)
warmBootState);

sai_attribute_t attr;

attr.id = SAI_SWITCH_ATTR_INIT_SWITCH;
attr.value.booldata = true;

Expand Down
4 changes: 2 additions & 2 deletions unittest/vslib/TestTrafficForwarder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ TEST(TrafficForwarder, addVlanTag)
struct tpacket_auxdata* aux = (struct tpacket_auxdata*)CMSG_DATA(cmsg);

// https://en.wikipedia.org/wiki/IEEE_802.1Q
//
//
// TPID(16) | TCI(16)
// | PCP(3) DEI(1) VID(12)

Expand All @@ -62,5 +62,5 @@ TEST(TrafficForwarder, addVlanTag)

EXPECT_TRUE(TrafficForwarder::addVlanTag(buffer, length, hdr));

EXPECT_EQ(length, 68);
EXPECT_EQ(length, 68);
}
6 changes: 3 additions & 3 deletions unittest/vslib/main_libsaivs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -76,12 +76,12 @@ static sai_service_method_table_t test_services = {
profile_get_next_value
};

class VirtualSwitchEnvironment:
class VirtualSwitchEnvironment:
public ::testing::Environment
{
public:

virtual void SetUp() override
virtual void SetUp() override
{
SWSS_LOG_ENTER();

Expand All @@ -93,7 +93,7 @@ class VirtualSwitchEnvironment:

EXPECT_EQ(status, SAI_STATUS_SUCCESS);
}

virtual void TearDown() override
{
SWSS_LOG_ENTER();
Expand Down
2 changes: 1 addition & 1 deletion unittest/vslib/test_sai_vs_hostif.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ TEST(libsaivs, hostif)
EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_hostif_trap_group(0));
EXPECT_NE(SAI_STATUS_SUCCESS, api->set_hostif_trap_group_attribute(0,0));
EXPECT_NE(SAI_STATUS_SUCCESS, api->get_hostif_trap_group_attribute(0,0,0));

EXPECT_NE(SAI_STATUS_SUCCESS, api->create_hostif_trap(&id,0,0,0));
EXPECT_NE(SAI_STATUS_SUCCESS, api->remove_hostif_trap(0));
EXPECT_NE(SAI_STATUS_SUCCESS, api->set_hostif_trap_attribute(0,0));
Expand Down
Loading

0 comments on commit f3bc342

Please sign in to comment.