Skip to content

Commit

Permalink
[CI][doc][build] Trim src folder files trailing blanks (#15162)
Browse files Browse the repository at this point in the history
- Run pre-commit tox profile to trim all trailing blanks
- Use several commits with a per-folder based strategy
  to ease their merge

Issue #15114

Signed-off-by: Guillaume Lambert <[email protected]>
  • Loading branch information
guillaumelambert authored May 24, 2023
1 parent 6745691 commit a73d443
Show file tree
Hide file tree
Showing 192 changed files with 1,216 additions and 1,216 deletions.
2 changes: 1 addition & 1 deletion src/bash/Files/unittest/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ all:
gcc plugin_test.c $(IFLAGS) $(CFLAGS) -o plugin_test.o
gcc mock_helper.c $(IFLAGS) $(CFLAGS) -o mock_helper.o
gcc ../plugin.c $(IFLAGS) $(CFLAGS) $(MFLAG) -o plugin.o
gcc plugin_test.o mock_helper.o plugin.o -o plugin_test -lc -lcunit
gcc plugin_test.o mock_helper.o plugin.o -o plugin_test -lc -lcunit

test:
# run unit test, if UT failed, build will break
Expand Down
10 changes: 5 additions & 5 deletions src/bash/Files/unittest/mock_helper.c
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ void *dlopen(const char *filename, int flags)
mock_dlerror = mock_dlerror_failed;
return NULL;
}

// all other case return mock handle
mock_dlerror = NULL;
return mock_plugin_handle;
Expand All @@ -133,21 +133,21 @@ void *dlsym(void *restrict handle, const char *restrict symbol)
mock_dlerror = mock_dlerror_failed;
return NULL;
}

case TEST_SCEANRIO_PLUGIN_UNINIT_NOT_EXIT:
if (strcmp(symbol, "plugin_uninit") == 0)
{
mock_dlerror = mock_dlerror_failed;
return NULL;
}

case TEST_SCEANRIO_PLUGIN_INIT_NOT_EXIT:
if (strcmp(symbol, "plugin_init") == 0)
{
mock_dlerror = mock_dlerror_failed;
return NULL;
}

case TEST_SCEANRIO_PLUGIN_INIT_SUCCESS:
if (strcmp(symbol, "plugin_init") == 0)
{
Expand All @@ -165,7 +165,7 @@ void *dlsym(void *restrict handle, const char *restrict symbol)
return mock_on_shell_execve;
}
}

return mock_plugin_default_function_handle;
}

Expand Down
50 changes: 25 additions & 25 deletions src/bash/Files/unittest/plugin_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ int start_up() {
/* Test plugin not exist scenario */
void testcase_try_load_plugin_by_path_not_exist() {
set_test_scenario(TEST_SCEANRIO_PLUGIN_NOT_EXIT);

try_load_plugin_by_path("./testplugin.so");

CU_ASSERT_STRING_EQUAL(mock_itrace_message_buffer, "Plugin: can't load plugin ./testplugin.so: MOCK error\n");
Expand All @@ -25,7 +25,7 @@ void testcase_try_load_plugin_by_path_not_exist() {
/* Test plugin exist but not support shell_execve scenario */
void testcase_try_load_plugin_by_path_execve_not_exist() {
set_test_scenario(TEST_SCEANRIO_PLUGIN_EXECVE_NOT_EXIT);

try_load_plugin_by_path("./testplugin.so");

CU_ASSERT_STRING_EQUAL(mock_itrace_message_buffer, "Plugin: can't find on_shell_execve function ./testplugin.so: MOCK error\n");
Expand All @@ -34,18 +34,18 @@ void testcase_try_load_plugin_by_path_execve_not_exist() {
/* Test plugin exist but not support plugin_uninit scenario */
void testcase_try_load_plugin_by_path_plugin_uninit_not_exist() {
set_test_scenario(TEST_SCEANRIO_PLUGIN_UNINIT_NOT_EXIT);

try_load_plugin_by_path("./testplugin.so");

CU_ASSERT_STRING_EQUAL(mock_itrace_message_buffer, "Plugin: can't find plugin_uninit function ./testplugin.so: MOCK error\n");
}

/* Test plugin exist but not support plugin_init scenario */
void testcase_try_load_plugin_by_path_plugin_init_not_exist() {
set_test_scenario(TEST_SCEANRIO_PLUGIN_INIT_NOT_EXIT);

try_load_plugin_by_path("./testplugin.so");

CU_ASSERT_STRING_EQUAL(mock_itrace_message_buffer, "Plugin: can't find plugin_init function ./testplugin.so: MOCK error\n");
}

Expand All @@ -54,22 +54,22 @@ void testcase_try_load_plugin_by_path_plugin_init_success() {
set_test_scenario(TEST_SCEANRIO_PLUGIN_INIT_SUCCESS);
set_memory_allocate_count(0);
set_plugin_init_status(PLUGIN_NOT_INITIALIZE);

try_load_plugin_by_path("./testplugin.so");

// check plugin init success
CU_ASSERT_EQUAL(get_plugin_init_status(), PLUGIN_INITIALIZED);

// check API success
CU_ASSERT_STRING_EQUAL(mock_itrace_message_buffer, "Plugin: plugin ./testplugin.so loaded\n");

// check global plugin list not empty and contains correct pluginglobal_plugin_list
CU_ASSERT_NOT_EQUAL(global_plugin_list, NULL);
CU_ASSERT_EQUAL(global_plugin_list->plugin_handle, TEST_MOCK_PLUGIN_HANDLE);

// release all loaded plugins
free_loaded_plugins();

// check if memory fully released
CU_ASSERT_EQUAL(global_plugin_list, NULL);
CU_ASSERT_EQUAL(get_memory_allocate_count(), 0);
Expand All @@ -80,16 +80,16 @@ void testcase_release_loaded_plugin() {
set_test_scenario(TEST_SCEANRIO_PLUGIN_INIT_SUCCESS);
set_memory_allocate_count(0);
try_load_plugin_by_path("./testplugin.so");

// check memory allocated
CU_ASSERT_NOT_EQUAL(get_memory_allocate_count(), 0);

// check plugin init success
CU_ASSERT_EQUAL(get_plugin_init_status(), PLUGIN_INITIALIZED);

// release all loaded plugins
free_loaded_plugins();

// check if memory fully released
CU_ASSERT_EQUAL(global_plugin_list, NULL);
CU_ASSERT_EQUAL(get_memory_allocate_count(), 0);
Expand All @@ -100,22 +100,22 @@ void testcase_load_plugin_by_config() {
set_test_scenario(TEST_SCEANRIO_PLUGIN_INIT_SUCCESS);
set_memory_allocate_count(0);
load_plugin_by_config("./bash_plugins.conf");

// check memory allocated
CU_ASSERT_NOT_EQUAL(get_memory_allocate_count(), 0);

// check plugin init success
CU_ASSERT_EQUAL(get_plugin_init_status(), PLUGIN_INITIALIZED);

// check target plugin in config file loaded
CU_ASSERT_STRING_EQUAL(mock_itrace_message_buffer, "Plugin: plugin /usr/lib/bash-plugins/another_test_plugin.so loaded\n");

// check there are 2 plugins loaded
CU_ASSERT_EQUAL(get_memory_allocate_count(), 2);

// release all loaded plugins
free_loaded_plugins();

// check if memory fully released
CU_ASSERT_EQUAL(global_plugin_list, NULL);
printf("Count %d\n", get_memory_allocate_count());
Expand All @@ -127,16 +127,16 @@ void testcase_invoke_plugin_on_shell_execve() {
set_test_scenario(TEST_SCEANRIO_PLUGIN_INIT_SUCCESS);
set_memory_allocate_count(0);
load_plugin_by_config("./bash_plugins.conf");

// invoke plugin method
char** pargv = (char**)0x5234;
invoke_plugin_on_shell_execve("testuser", "testcommand", pargv);
printf(mock_onshell_execve_command_buffer);
CU_ASSERT_STRING_EQUAL(mock_onshell_execve_command_buffer, "on_shell_execve: user: testuser, level: 1, command: testcommand, argv: 0x5234\n");

// release all loaded plugins
free_loaded_plugins();

// check if memory fully released
CU_ASSERT_EQUAL(global_plugin_list, NULL);
printf("Count %d\n", get_memory_allocate_count());
Expand Down Expand Up @@ -198,7 +198,7 @@ int main(void) {
CU_cleanup_registry();
return CU_get_error();
}

if (CU_get_error() != CUE_SUCCESS) {
fprintf(stderr, "Error adding test: (%d)%s\n", CU_get_error(), CU_get_error_msg());
}
Expand All @@ -211,7 +211,7 @@ int main(void) {
}

CU_basic_show_failures(CU_get_failure_list());

// use failed UT count as return value
return CU_get_number_of_failure_records();
}
2 changes: 1 addition & 1 deletion src/ethtool/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ else ifeq ($(CROSS_BUILD_ENVIRON), y)
else
dpkg-buildpackage -rfakeroot -b -us -uc -j$(SONIC_CONFIG_MAKE_JOBS) --admindir $(SONIC_DPKG_ADMINDIR)
endif

popd
mv $(DERIVED_TARGET) $* $(DEST)/

Expand Down
4 changes: 2 additions & 2 deletions src/gobgp/debian/control
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Standards-Version: 3.9.3
Section: net

Package: gobgp
Priority: extra
Priority: extra
Architecture: amd64
Depends: ${shlibs:Depends}, ${misc:Depends}
Depends: ${shlibs:Depends}, ${misc:Depends}
Description: gobgp BGP daemon
2 changes: 1 addition & 1 deletion src/gobgp/debian/gobgp.init.d
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ case "$1" in
echo /etc/gobgp/gobgpd.conf not found
fi
;;

stop)
kill -9 $(echo /var/run/gobgpd.pid)
;;
Expand Down
4 changes: 2 additions & 2 deletions src/gobgp/debian/rules
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#!/usr/bin/make -f
%:
#!/usr/bin/make -f
%:
dh $@ --with systemd
14 changes: 7 additions & 7 deletions src/iccpd/include/msg_format.h
Original file line number Diff line number Diff line change
Expand Up @@ -487,17 +487,17 @@ enum MCLAG_DOMAIN_CFG_OP_TYPE {
MCLAG_CFG_OPER_ADD = 1, //Add domain
MCLAG_CFG_OPER_DEL = 2, //Delete domain
MCLAG_CFG_OPER_UPDATE = 3, //update domain
MCLAG_CFG_OPER_ATTR_DEL = 4 //Attribute del
MCLAG_CFG_OPER_ATTR_DEL = 4 //Attribute del
};


enum MCLAG_DOMAIN_CFG_ATTR_BMAP_FLAGS {
MCLAG_CFG_ATTR_NONE = 0x0,
MCLAG_CFG_ATTR_SRC_ADDR = 0x1,
MCLAG_CFG_ATTR_PEER_ADDR = 0x2,
MCLAG_CFG_ATTR_PEER_LINK = 0x4,
MCLAG_CFG_ATTR_KEEPALIVE_INTERVAL = 0x8,
MCLAG_CFG_ATTR_SESSION_TIMEOUT = 0x10
MCLAG_CFG_ATTR_NONE = 0x0,
MCLAG_CFG_ATTR_SRC_ADDR = 0x1,
MCLAG_CFG_ATTR_PEER_ADDR = 0x2,
MCLAG_CFG_ATTR_PEER_LINK = 0x4,
MCLAG_CFG_ATTR_KEEPALIVE_INTERVAL = 0x8,
MCLAG_CFG_ATTR_SESSION_TIMEOUT = 0x10
};

struct IccpSyncdHDr
Expand Down
4 changes: 2 additions & 2 deletions src/iccpd/include/system.h
Original file line number Diff line number Diff line change
Expand Up @@ -270,9 +270,9 @@ typedef struct system_dbg_counter_info
uint32_t peer_link_down_counter;
uint32_t warmboot_counter;
uint32_t rx_peer_invalid_msg_counter; //counts partial msgs received as sending end is not sending partial msgs
uint32_t rx_peer_hdr_read_sock_err_counter; //counts socket header read errors
uint32_t rx_peer_hdr_read_sock_err_counter; //counts socket header read errors
uint32_t rx_peer_hdr_read_sock_zero_len_counter; //counts socket header read zero length
uint32_t rx_peer_tlv_read_sock_err_counter; //counts socket data/tlv read errors
uint32_t rx_peer_tlv_read_sock_err_counter; //counts socket data/tlv read errors
uint32_t rx_peer_tlv_read_sock_zero_len_counter; //counts socket data/tlv read zero length
uint32_t socket_close_err_counter; //socket close failure
uint32_t socket_cleanup_counter; //socket cleanup outside of session down
Expand Down
2 changes: 1 addition & 1 deletion src/iccpd/src/iccp_cmd_show.c
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ int iccp_mclag_config_dump(char * *buf, int *num, int mclag_id)

state_info.keepalive_time = csm->keepalive_time;
state_info.session_timeout = csm->session_timeout;

logconfig = logger_get_configuration();
memcpy(state_info.loglevel, log_level_to_string(logconfig->log_level), strlen( log_level_to_string(logconfig->log_level)));

Expand Down
4 changes: 2 additions & 2 deletions src/iccpd/src/iccp_csm.c
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ void iccp_csm_init(struct CSM* csm)
memset(csm->peer_ip, 0, INET_ADDRSTRLEN);
memset(csm->iccp_info.sender_name, 0, MAX_L_ICC_SENDER_NAME);
csm->iccp_info.icc_rg_id = 0x0;
csm->keepalive_time = CONNECT_INTERVAL_SEC;
csm->keepalive_time = CONNECT_INTERVAL_SEC;
csm->session_timeout = HEARTBEAT_TIMEOUT_SEC;
}

Expand Down Expand Up @@ -217,7 +217,7 @@ void iccp_csm_finalize(struct CSM* csm)
LIST_REMOVE(cif,csm_next);
free(cif);
}

/* Release iccp_csm */
pthread_mutex_destroy(&(csm->conn_mutex));
iccp_csm_msg_list_finalize(csm);
Expand Down
Loading

0 comments on commit a73d443

Please sign in to comment.