1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2025-12-25 14:33:52 +01:00

tests/sys/congure_*: migrate to XFA SHELL_COMMAND

This commit is contained in:
Mikolai Gütschow 2025-05-27 21:23:45 +02:00
parent f02cfc9a02
commit a04fcb9d18
No known key found for this signature in database
GPG Key ID: 943E2F37AA659AD5
4 changed files with 48 additions and 71 deletions

View File

@ -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);
/** @} */

View File

@ -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);
/** @} */

View File

@ -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);
/** @} */

View File

@ -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);
/** @} */