diff --git a/tests/sys/congure_abe/main.c b/tests/sys/congure_abe/main.c index 8180c6bbb2..ae919a322f 100644 --- a/tests/sys/congure_abe/main.c +++ b/tests/sys/congure_abe/main.c @@ -24,28 +24,12 @@ #include "congure_impl.h" -static int _json_statham(int argc, char **argv); -static int _set_cwnd(int argc, char **argv); -static int _get_fr_calls(int argc, char **argv); -static int _set_same_wnd_adv_res(int argc, char **argv); - static congure_abe_snd_t _congure_state; -static const shell_command_t shell_commands[] = { - { "state", "Prints current CongURE state object as JSON", _json_statham }, - { "set_cwnd", "Set cwnd member for CongURE state object", _set_cwnd }, - { "get_ff_calls", - "Get the number of calls to fast_retransmit callback of CongURE state " - "object", _get_fr_calls }, - { "set_same_wnd_adv", - "Set the result for the same_window_advertised callback of CongURE state " - "object", _set_same_wnd_adv_res }, - { NULL, NULL, NULL } -}; int main(void) { char line_buf[SHELL_DEFAULT_BUFSIZE]; - shell_run(shell_commands, line_buf, SHELL_DEFAULT_BUFSIZE); + shell_run(NULL, line_buf, SHELL_DEFAULT_BUFSIZE); return 0; } @@ -109,6 +93,8 @@ static int _json_statham(int argc, char **argv) return 0; } +SHELL_COMMAND(state, "Prints current CongURE state object as JSON", _json_statham ); + static int _set_cwnd(int argc, char **argv) { uint32_t tmp; @@ -125,6 +111,8 @@ static int _set_cwnd(int argc, char **argv) return 0; } +SHELL_COMMAND(set_cwnd, "Set cwnd member for CongURE state object", _set_cwnd ); + static int _get_fr_calls(int argc, char **argv) { (void)argc; @@ -136,6 +124,9 @@ static int _get_fr_calls(int argc, char **argv) return 0; } +SHELL_COMMAND(get_ff_calls, "Get the number of calls to fast_retransmit" + "callback of CongURE state object", _get_fr_calls); + static int _set_same_wnd_adv_res(int argc, char **argv) { if (argc < 2) { @@ -148,4 +139,7 @@ static int _set_same_wnd_adv_res(int argc, char **argv) return 0; } +SHELL_COMMAND(set_same_wnd_adv, "Set the result for the same_window_advertised" + "callback of CongURE state object", _set_same_wnd_adv_res); + /** @} */ diff --git a/tests/sys/congure_quic/main.c b/tests/sys/congure_quic/main.c index 2ff91920f0..02b6edf6de 100644 --- a/tests/sys/congure_quic/main.c +++ b/tests/sys/congure_quic/main.c @@ -24,36 +24,12 @@ #include "congure_impl.h" -static int _json_statham(int argc, char **argv); -static int _set_cwnd(int argc, char **argv); -static int _set_ssthresh(int argc, char **argv); -static int _set_limited(int argc, char **argv); -static int _set_max_ack_delay(int argc, char **argv); -static int _set_recovery_start(int argc, char **argv); -static int _get_event_cb(int argc, char **argv); - static congure_quic_snd_t _congure_state; -static const shell_command_t shell_commands[] = { - { "state", "Prints current CongURE state object as JSON", _json_statham }, - { "set_cwnd", "Set cwnd member for CongURE state object", _set_cwnd }, - { "set_ssthresh", "Set ssthresh member for CongURE state object", - _set_ssthresh }, - { "set_limited", "Set limited member for CongURE state object", - _set_limited }, - { "set_max_ack_delay", "Set max_ack_delay member for CongURE state object", - _set_max_ack_delay }, - { "set_recovery_start", "Set recovery_start member for CongURE state object", - _set_recovery_start }, - { "get_event_cb", - "Get state of cong_event_cb mock of CongURE state object", - _get_event_cb }, - { NULL, NULL, NULL } -}; int main(void) { char line_buf[SHELL_DEFAULT_BUFSIZE]; - shell_run(shell_commands, line_buf, SHELL_DEFAULT_BUFSIZE); + shell_run(NULL, line_buf, SHELL_DEFAULT_BUFSIZE); return 0; } @@ -124,6 +100,8 @@ static int _json_statham(int argc, char **argv) return 0; } +SHELL_COMMAND(state, "Prints current CongURE state object as JSON", _json_statham); + static int _set_cwnd(int argc, char **argv) { uint32_t tmp; @@ -140,6 +118,8 @@ static int _set_cwnd(int argc, char **argv) return 0; } +SHELL_COMMAND(set_cwnd, "Set cwnd member for CongURE state object", _set_cwnd); + static int _set_ssthresh(int argc, char **argv) { uint32_t tmp; @@ -156,6 +136,8 @@ static int _set_ssthresh(int argc, char **argv) return 0; } +SHELL_COMMAND(set_ssthresh, "Set ssthresh member for CongURE state object", _set_ssthresh); + static int _set_limited(int argc, char **argv) { uint32_t tmp; @@ -172,6 +154,8 @@ static int _set_limited(int argc, char **argv) return 0; } +SHELL_COMMAND(set_limited, "Set limited member for CongURE state object", _set_limited); + static int _set_max_ack_delay(int argc, char **argv) { uint32_t tmp; @@ -188,6 +172,9 @@ static int _set_max_ack_delay(int argc, char **argv) return 0; } +SHELL_COMMAND(set_max_ack_delay, + "Set max_ack_delay member for CongURE state object", _set_max_ack_delay); + static int _set_recovery_start(int argc, char **argv) { if (argc < 2) { @@ -198,6 +185,9 @@ static int _set_recovery_start(int argc, char **argv) return 0; } +SHELL_COMMAND(set_recovery_start, + "Set recovery_start member for CongURE state object", _set_recovery_start); + static int _get_event_cb(int argc, char **argv) { (void)argc; @@ -215,4 +205,7 @@ static int _get_event_cb(int argc, char **argv) return 0; } +SHELL_COMMAND(get_event_cb,# + "Get state of cong_event_cb mock of CongURE state object", _get_event_cb); + /** @} */ diff --git a/tests/sys/congure_reno/main.c b/tests/sys/congure_reno/main.c index 56d9cfc134..0a7c3c38fc 100644 --- a/tests/sys/congure_reno/main.c +++ b/tests/sys/congure_reno/main.c @@ -28,32 +28,11 @@ static char _line_buf[SHELL_BUFSIZE]; -static int _json_statham(int argc, char **argv); -static int _set_mss(int argc, char **argv); -static int _set_cwnd(int argc, char **argv); -static int _set_ssthresh(int argc, char **argv); -static int _get_fr_calls(int argc, char **argv); -static int _set_same_wnd_adv_res(int argc, char **argv); - static congure_reno_snd_t _congure_state; -static const shell_command_t shell_commands[] = { - { "state", "Prints current CongURE state object as JSON", _json_statham }, - { "set_cwnd", "Set cwnd member for CongURE state object", _set_cwnd }, - { "set_mss", "Set new MSS for CongURE state object", _set_mss }, - { "set_ssthresh", "Set ssthresh member for CongURE state object", - _set_ssthresh }, - { "get_ff_calls", - "Get the number of calls to fast_retransmit callback of CongURE state " - "object", _get_fr_calls }, - { "set_same_wnd_adv", - "Set the result for the same_window_advertised callback of CongURE state " - "object", _set_same_wnd_adv_res }, - { NULL, NULL, NULL } -}; int main(void) { - shell_run(shell_commands, _line_buf, SHELL_BUFSIZE); + shell_run(NULL, _line_buf, SHELL_BUFSIZE); return 0; } @@ -113,6 +92,8 @@ static int _json_statham(int argc, char **argv) return 0; } +SHELL_COMMAND(state, "Prints current CongURE state object as JSON", _json_statham); + static int _set_mss(int argc, char **argv) { uint32_t tmp; @@ -129,6 +110,8 @@ static int _set_mss(int argc, char **argv) return 0; } +SHELL_COMMAND(set_mss, "Set new MSS for CongURE state object", _set_mss); + static int _set_cwnd(int argc, char **argv) { uint32_t tmp; @@ -145,6 +128,8 @@ static int _set_cwnd(int argc, char **argv) return 0; } +SHELL_COMMAND(set_cwnd, "Set cwnd member for CongURE state object", _set_cwnd); + static int _set_ssthresh(int argc, char **argv) { uint32_t tmp; @@ -161,6 +146,8 @@ static int _set_ssthresh(int argc, char **argv) return 0; } +SHELL_COMMAND(set_ssthresh, "Set ssthresh member for CongURE state object", _set_ssthresh); + static int _get_fr_calls(int argc, char **argv) { (void)argc; @@ -172,6 +159,9 @@ static int _get_fr_calls(int argc, char **argv) return 0; } +SHELL_COMMAND(get_ff_calls, + "Get the number of calls to fast_retransmit callback of CongURE state object", _get_fr_calls); + static int _set_same_wnd_adv_res(int argc, char **argv) { if (argc < 2) { @@ -184,4 +174,8 @@ static int _set_same_wnd_adv_res(int argc, char **argv) return 0; } +SHELL_COMMAND(set_same_wnd_adv, + "Set the result for the same_window_advertised callback of CongURE state object", + _set_same_wnd_adv_res); + /** @} */ diff --git a/tests/sys/congure_test/main.c b/tests/sys/congure_test/main.c index ab7558dde7..4bd14b5387 100644 --- a/tests/sys/congure_test/main.c +++ b/tests/sys/congure_test/main.c @@ -22,18 +22,12 @@ #include "congure_impl.h" -static int _json_statham(int argc, char **argv); - static congure_test_snd_t _congure_state; -static const shell_command_t shell_commands[] = { - { "state", "Prints current CongURE state object as JSON", _json_statham }, - { NULL, NULL, NULL } -}; int main(void) { char line_buf[SHELL_DEFAULT_BUFSIZE]; - shell_run(shell_commands, line_buf, SHELL_DEFAULT_BUFSIZE); + shell_run(NULL, line_buf, SHELL_DEFAULT_BUFSIZE); return 0; } @@ -332,4 +326,6 @@ static int _json_statham(int argc, char **argv) return 0; } +SHELL_COMMAND(state, "Prints current CongURE state object as JSON", _json_statham); + /** @} */