fix(build): Fix unused argument warnings in unit tests

Assisted-by: Gemini:Flash-3.5
Signed-off-by: Bartosz Podrygajlo <bartosz.podrygajlo@openairinterface.org>
This commit is contained in:
Bartosz Podrygajlo
2026-05-27 15:21:42 +02:00
parent cb0e501293
commit efdab585e2
33 changed files with 144 additions and 23 deletions

View File

@@ -17,6 +17,8 @@
#include "nfapi_nr_interface.h"
#include "nfapi_nr_interface_scf.h"
#include "common/platform_types.h"
#define FILL_TLV(TlV, TaG, VaL) \
do { \
TlV.tl.tag = TaG; \
@@ -64,8 +66,6 @@ uint32_t rand32_range(uint32_t lower, uint32_t upper)
return (rand() % (upper - lower + 1)) + lower;
}
int main(int n, char *v[]);
static inline void fapi_test_init_seeded(time_t seed)
{
srand(seed);

View File

@@ -495,7 +495,7 @@ static void test_config_req_fdd(void)
free_config_request(&req);
}
int main(int n, char *v[])
int main()
{
fapi_test_init();
test_config_req_rand();

View File

@@ -97,7 +97,7 @@ void test_copy(const nfapi_nr_config_response_scf_t *msg)
free_config_response(&copy);
}
int main(int n, char *v[])
int main()
{
fapi_test_init();

View File

@@ -45,7 +45,7 @@ void test_copy(const nfapi_nr_error_indication_scf_t *msg)
free_error_indication(&copy);
}
int main(int n, char *v[])
int main()
{
fapi_test_init();

View File

@@ -46,7 +46,7 @@ void test_copy(const nfapi_nr_param_request_scf_t *msg)
free_param_request(&copy);
}
int main(int n, char *v[])
int main()
{
fapi_test_init();

View File

@@ -238,7 +238,7 @@ void test_copy(const nfapi_nr_param_response_scf_t *msg)
free_param_response(&copy);
}
int main(int n, char *v[])
int main()
{
fapi_test_init();
nfapi_nr_param_response_scf_t req = {.header.message_id = NFAPI_NR_PHY_MSG_TYPE_PARAM_RESPONSE};

View File

@@ -46,7 +46,7 @@ void test_copy(const nfapi_nr_start_request_scf_t *msg)
free_start_request(&copy);
}
int main(int n, char *v[])
int main()
{
fapi_test_init();

View File

@@ -46,7 +46,7 @@ void test_copy(const nfapi_nr_start_response_scf_t *msg)
free_start_response(&copy);
}
int main(int n, char *v[])
int main()
{
fapi_test_init();

View File

@@ -46,7 +46,7 @@ void test_copy(const nfapi_nr_stop_indication_scf_t *msg)
free_stop_indication(&copy);
}
int main(int n, char *v[])
int main()
{
fapi_test_init();

View File

@@ -46,7 +46,7 @@ void test_copy(const nfapi_nr_stop_request_scf_t *msg)
free_stop_request(&copy);
}
int main(int n, char *v[])
int main()
{
fapi_test_init();

View File

@@ -78,7 +78,7 @@ static void test_copy(const nfapi_nr_crc_indication_t *msg)
free_crc_indication(&copy);
}
int main(int n, char *v[])
int main()
{
fapi_test_init();

View File

@@ -35,7 +35,7 @@ void test_pack_payload(uint8_t payloadSizeBits, uint8_t payload[])
// All tests successful!
}
int main(int n, char *v[])
int main()
{
fapi_test_init();
uint8_t upper = 8 * DCI_PAYLOAD_BYTE_LEN;

View File

@@ -246,7 +246,7 @@ static void test_copy(const nfapi_nr_dl_tti_request_t *msg)
free_dl_tti_request(&copy);
}
int main(int n, char *v[])
int main()
{
fapi_test_init();

View File

@@ -77,7 +77,7 @@ static void test_copy(const nfapi_nr_rach_indication_t *msg)
free_rach_indication(&copy);
}
int main(int n, char *v[])
int main()
{
fapi_test_init();

View File

@@ -75,7 +75,7 @@ static void test_copy(const nfapi_nr_rx_data_indication_t *msg)
free_rx_data_indication(&copy);
}
int main(int n, char *v[])
int main()
{
fapi_test_init();

View File

@@ -52,7 +52,7 @@ static void test_copy(const nfapi_nr_slot_indication_scf_t *msg)
free_slot_indication(&copy);
}
int main(int n, char *v[])
int main()
{
fapi_test_init();

View File

@@ -84,7 +84,7 @@ static void test_copy(const nfapi_nr_srs_indication_t *msg)
free_srs_indication(&copy);
}
int main(int n, char *v[])
int main()
{
fapi_test_init();

View File

@@ -138,7 +138,7 @@ static void test_copy(const nfapi_nr_tx_data_request_t *msg)
free_tx_data_request(&copy);
}
int main(int n, char *v[])
int main()
{
fapi_test_init();

View File

@@ -205,7 +205,7 @@ static void test_copy(const nfapi_nr_uci_indication_t *msg)
free_uci_indication(&copy);
}
int main(int n, char *v[])
int main()
{
fapi_test_init();

View File

@@ -108,7 +108,7 @@ static void test_copy(const nfapi_nr_ul_dci_request_t *msg)
free_ul_dci_request(&copy);
}
int main(int n, char *v[])
int main()
{
fapi_test_init();

View File

@@ -427,7 +427,7 @@ static void test_copy(const nfapi_nr_ul_tti_request_t *msg)
free_ul_tti_request(&copy);
}
int main(int n, char *v[])
int main()
{
fapi_test_init();

View File

@@ -18,6 +18,7 @@
void exit_function(const char *file, const char *function, const int line, const char *s, const int assert)
{
UNUSED(assert);
printf("detected error at %s:%d:%s: %s\n", file, line, function, s);
abort();
}

View File

@@ -22,6 +22,7 @@
void exit_function(const char *file, const char *function, const int line, const char *s, const int assert)
{
UNUSED(assert);
printf("detected error at %s:%d:%s: %s\n", file, line, function, s);
abort();
}

View File

@@ -4,6 +4,7 @@
#include "gtest/gtest.h"
extern "C" {
#include "common/platform_types.h"
#include "openair2/LAYER2/NR_MAC_UE/mac_proto.h"
#include "executables/softmodem-common.h"
#include "openair2/LAYER2/nr_rlc/nr_rlc_oai_api.h"
@@ -16,15 +17,26 @@ softmodem_params_t *get_softmodem_params(void)
}
void nr_mac_rrc_ra_ind(const module_id_t mod_id, bool success)
{
UNUSED(mod_id);
UNUSED(success);
}
void nr_mac_rrc_msg3_ind(const module_id_t mod_id, const int rnti, bool prepare_payload)
{
UNUSED(mod_id);
UNUSED(rnti);
UNUSED(prepare_payload);
}
void nr_mac_rlc_status_ind(uint16_t ue_id, frame_t frame, int n_ch, const logical_chan_id_t *ch, mac_rlc_status_resp_t *ret)
{
UNUSED(ue_id);
UNUSED(frame);
UNUSED(n_ch);
UNUSED(ch);
UNUSED(ret);
}
void nr_mac_rrc_inactivity_timer_ind(const module_id_t mod_id)
{
UNUSED(mod_id);
}
tbs_size_t nr_mac_rlc_data_req(const module_id_t module_idP,
const uint16_t ue_id,
@@ -33,6 +45,12 @@ tbs_size_t nr_mac_rlc_data_req(const module_id_t module_idP,
const tb_size_t tb_sizeP,
char *buffer_pP)
{
UNUSED(module_idP);
UNUSED(ue_id);
UNUSED(gnb_flagP);
UNUSED(channel_idP);
UNUSED(tb_sizeP);
UNUSED(buffer_pP);
return 0;
}
void nr_mac_rlc_data_ind(const module_id_t module_idP,
@@ -41,26 +59,42 @@ void nr_mac_rlc_data_ind(const module_id_t module_idP,
const nr_rlc_data_ind_t *data,
int num_data)
{
UNUSED(module_idP);
UNUSED(ue_id);
UNUSED(gnb_flagP);
UNUSED(data);
UNUSED(num_data);
}
void nr_mac_rrc_verification_failed(const module_id_t mod_id)
{
UNUSED(mod_id);
}
bool nr_rlc_activate_srb0(int ue_id,
void *data,
void (*send_initial_ul_rrc_message)(int ue_id, const uint8_t *sdu, sdu_size_t sdu_len, void *data))
{
UNUSED(ue_id);
UNUSED(data);
UNUSED(send_initial_ul_rrc_message);
return true;
}
int nr_rlc_module_init(nr_rlc_op_mode_t mode)
{
UNUSED(mode);
return 0;
}
MessageDef *itti_alloc_new_message(task_id_t origin_task_id, instance_t originInstance, MessagesIds message_id)
{
UNUSED(origin_task_id);
UNUSED(originInstance);
UNUSED(message_id);
return NULL;
}
int itti_send_msg_to_task(task_id_t task_id, instance_t instance, MessageDef *message)
{
UNUSED(task_id);
UNUSED(instance);
UNUSED(message);
return 0;
}
typedef uint32_t channel_t;
@@ -77,10 +111,23 @@ int8_t nr_mac_rrc_data_ind_ue(const module_id_t module_id,
const uint8_t *pduP,
const sdu_size_t pdu_len)
{
UNUSED(module_id);
UNUSED(CC_id);
UNUSED(gNB_index);
UNUSED(hfn);
UNUSED(frame);
UNUSED(slot);
UNUSED(rnti);
UNUSED(cellid);
UNUSED(arfcn);
UNUSED(channel);
UNUSED(pduP);
UNUSED(pdu_len);
return 0;
}
bool check_csi_report_consistency(const NR_CSI_MeasConfig_t *meas)
{
UNUSED(meas);
return true;
}
void nr_mac_rrc_meas_ind_ue(module_id_t module_id,
@@ -90,6 +137,12 @@ void nr_mac_rrc_meas_ind_ue(module_id_t module_id,
bool is_neighboring_cell,
int rsrp_dBm)
{
UNUSED(module_id);
UNUSED(gNB_index);
UNUSED(Nid_cell);
UNUSED(csi_meas);
UNUSED(is_neighboring_cell);
UNUSED(rsrp_dBm);
}
}
#include <cstdio>

View File

@@ -3,6 +3,7 @@
*/
#include "benchmark/benchmark.h"
extern "C" {
#include "common/platform_types.h"
#include "openair2/LAYER2/nr_rlc/nr_rlc_entity_am.h"
#include "openair2/LAYER2/nr_rlc/nr_rlc_entity.h"
#include "common/utils/LOG/log.h"
@@ -13,12 +14,21 @@ extern configmodule_interface_t *uniqCfg;
void deliver_sdu(void *deliver_sdu_data, nr_rlc_entity_t *entity, char *buf, int size)
{
UNUSED(deliver_sdu_data);
UNUSED(entity);
UNUSED(buf);
UNUSED(size);
}
void sdu_successful_delivery(void *sdu_successful_delivery_data, nr_rlc_entity_t *entity, int sdu_id)
{
UNUSED(sdu_successful_delivery_data);
UNUSED(entity);
UNUSED(sdu_id);
}
void max_retx_reached(void *max_retx_reached_data, nr_rlc_entity_t *entity)
{
UNUSED(max_retx_reached_data);
UNUSED(entity);
}
static void BM_nr_rlc_am_entity(benchmark::State &state)

View File

@@ -7,6 +7,7 @@
#include "../nr_rlc_entity_um.h"
#include "../nr_rlc_entity_tm.h"
#include "common/platform_types.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -113,6 +114,7 @@ int test[] = {
void deliver_sdu_gnb_am(void *deliver_sdu_data, nr_rlc_entity_t *_entity, char *buf, int size)
{
UNUSED(deliver_sdu_data);
nr_rlc_entity_am_t *entity = (nr_rlc_entity_am_t *)_entity;
printf("TEST: GNB: %"PRIu64": deliver SDU size %d [",
entity->t_current, size);
@@ -122,6 +124,7 @@ void deliver_sdu_gnb_am(void *deliver_sdu_data, nr_rlc_entity_t *_entity, char *
void deliver_sdu_gnb_um(void *deliver_sdu_data, nr_rlc_entity_t *_entity, char *buf, int size)
{
UNUSED(deliver_sdu_data);
nr_rlc_entity_um_t *entity = (nr_rlc_entity_um_t *)_entity;
printf("TEST: GNB: %"PRIu64": deliver SDU size %d [",
entity->t_current, size);
@@ -131,6 +134,7 @@ void deliver_sdu_gnb_um(void *deliver_sdu_data, nr_rlc_entity_t *_entity, char *
void deliver_sdu_gnb_tm(void *deliver_sdu_data, nr_rlc_entity_t *_entity, char *buf, int size)
{
UNUSED(deliver_sdu_data);
nr_rlc_entity_tm_t *entity = (nr_rlc_entity_tm_t *)_entity;
printf("TEST: GNB: %"PRIu64": deliver SDU size %d [",
entity->t_current, size);
@@ -141,6 +145,7 @@ void deliver_sdu_gnb_tm(void *deliver_sdu_data, nr_rlc_entity_t *_entity, char *
void successful_delivery_gnb(void *successful_delivery_data,
nr_rlc_entity_t *_entity, int sdu_id)
{
UNUSED(successful_delivery_data);
nr_rlc_entity_am_t *entity = (nr_rlc_entity_am_t *)_entity;
printf("TEST: GNB: %"PRIu64": SDU %d was successfully delivered.\n",
entity->t_current, sdu_id);
@@ -149,6 +154,7 @@ void successful_delivery_gnb(void *successful_delivery_data,
void max_retx_reached_gnb(void *max_retx_reached_data,
nr_rlc_entity_t *_entity)
{
UNUSED(max_retx_reached_data);
nr_rlc_entity_am_t *entity = (nr_rlc_entity_am_t *)_entity;
printf("TEST: GNB: %"PRIu64": max RETX reached! radio link failure!\n",
entity->t_current);
@@ -157,6 +163,7 @@ void max_retx_reached_gnb(void *max_retx_reached_data,
void deliver_sdu_ue_am(void *deliver_sdu_data, nr_rlc_entity_t *_entity, char *buf, int size)
{
UNUSED(deliver_sdu_data);
nr_rlc_entity_am_t *entity = (nr_rlc_entity_am_t *)_entity;
printf("TEST: UE: %"PRIu64": deliver SDU size %d [",
entity->t_current, size);
@@ -166,6 +173,7 @@ void deliver_sdu_ue_am(void *deliver_sdu_data, nr_rlc_entity_t *_entity, char *b
void deliver_sdu_ue_um(void *deliver_sdu_data, nr_rlc_entity_t *_entity, char *buf, int size)
{
UNUSED(deliver_sdu_data);
nr_rlc_entity_um_t *entity = (nr_rlc_entity_um_t *)_entity;
printf("TEST: UE: %"PRIu64": deliver SDU size %d [",
entity->t_current, size);
@@ -175,6 +183,7 @@ void deliver_sdu_ue_um(void *deliver_sdu_data, nr_rlc_entity_t *_entity, char *b
void deliver_sdu_ue_tm(void *deliver_sdu_data, nr_rlc_entity_t *_entity, char *buf, int size)
{
UNUSED(deliver_sdu_data);
nr_rlc_entity_tm_t *entity = (nr_rlc_entity_tm_t *)_entity;
printf("TEST: UE: %"PRIu64": deliver SDU size %d [",
entity->t_current, size);
@@ -185,6 +194,7 @@ void deliver_sdu_ue_tm(void *deliver_sdu_data, nr_rlc_entity_t *_entity, char *b
void successful_delivery_ue(void *successful_delivery_data,
nr_rlc_entity_t *_entity, int sdu_id)
{
UNUSED(successful_delivery_data);
nr_rlc_entity_am_t *entity = (nr_rlc_entity_am_t *)_entity;
printf("TEST: UE: %"PRIu64": SDU %d was successfully delivered.\n",
entity->t_current, sdu_id);
@@ -193,6 +203,7 @@ void successful_delivery_ue(void *successful_delivery_data,
void max_retx_reached_ue(void *max_retx_reached_data,
nr_rlc_entity_t *_entity)
{
UNUSED(max_retx_reached_data);
nr_rlc_entity_am_t *entity = (nr_rlc_entity_am_t *)_entity;
printf("TEST: UE: %"PRIu64", max RETX reached! radio link failure!\n",
entity->t_current);

View File

@@ -4,6 +4,7 @@
#include "gtest/gtest.h"
extern "C" {
#include "common/platform_types.h"
#include "openair2/LAYER2/nr_rlc/nr_rlc_entity_am.h"
#include "openair2/LAYER2/nr_rlc/nr_rlc_entity.h"
#include "common/utils/LOG/log.h"
@@ -16,6 +17,8 @@ int sdu_delivered_count = 0;
int sdu_acked_count = 0;
void deliver_sdu(void *deliver_sdu_data, nr_rlc_entity_t *entity, char *buf, int size)
{
UNUSED(deliver_sdu_data);
UNUSED(entity);
sdu_delivered_count++;
char payload[300];
ASSERT_LE(size, sizeof(payload));
@@ -25,12 +28,16 @@ void deliver_sdu(void *deliver_sdu_data, nr_rlc_entity_t *entity, char *buf, int
void sdu_successful_delivery(void *sdu_successful_delivery_data, nr_rlc_entity_t *entity, int sdu_id)
{
UNUSED(sdu_successful_delivery_data);
UNUSED(entity);
sdu_acked_count++;
std::cout << "SDU " << sdu_id << " acked" << std::endl;
}
void max_retx_reached(void *max_retx_reached_data, nr_rlc_entity_t *entity)
{
UNUSED(max_retx_reached_data);
UNUSED(entity);
}
TEST(nr_rlc_am_entity, test_init)

View File

@@ -15,12 +15,19 @@
#include "common/utils/LOG/log.h"
#include "common/5g_platform_types.h"
int nr_rlc_get_available_tx_space(int module_id, int rnti, int drb_id) { return 0; }
int nr_rlc_get_available_tx_space(int module_id, int rnti, int drb_id)
{
UNUSED(module_id);
UNUSED(rnti);
UNUSED(drb_id);
return 0;
}
softmodem_params_t *get_softmodem_params(void) { return NULL; }
configmodule_interface_t *uniqCfg = NULL;
void exit_function(const char *file, const char *function, const int line, const char *s, const int assert)
{
UNUSED(assert);
printf("detected error at %s:%d:%s: %s\n", file, line, function, s);
abort();
}

View File

@@ -50,6 +50,7 @@ softmodem_params_t *get_softmodem_params(void)
void exit_function(const char *file, const char *function, const int line, const char *s, const int assert)
{
UNUSED(assert);
printf("detected error at %s:%d:%s: %s\n", file, line, function, s);
abort();
}

View File

@@ -18,6 +18,7 @@ configmodule_interface_t *uniqCfg = NULL;
void exit_function(const char *file, const char *function, const int line, const char *s, const int assert)
{
UNUSED(assert);
printf("detected error at %s:%d:%s: %s\n", file, line, function, s);
abort();
}

View File

@@ -21,6 +21,7 @@ configmodule_interface_t *uniqCfg = NULL;
void exit_function(const char *file, const char *function, const int line, const char *s, const int assert)
{
UNUSED(assert);
printf("detected error at %s:%d:%s: %s\n", file, line, function, s);
abort();
}

View File

@@ -20,6 +20,7 @@
void exit_function(const char *file, const char *function, const int line, const char *s, const int assert)
{
UNUSED(assert);
printf("detected error at %s:%d:%s: %s\n", file, line, function, s);
abort();
}

View File

@@ -18,12 +18,15 @@ configmodule_interface_t *uniqCfg;
void exit_function(const char *file, const char *function, const int line, const char *s, const int assert)
{
UNUSED(assert);
LOG_E(GNB_APP, "error at %s:%d:%s: %s\n", file, line, function, s);
abort();
}
int nr_rlc_get_available_tx_space(const rnti_t rntiP, const logical_chan_id_t channel_idP)
{
UNUSED(rntiP);
UNUSED(channel_idP);
abort();
return 0;
}
@@ -144,6 +147,15 @@ static bool recv_basic_conn_qfi(protocol_ctxt_t *ctxt,
const bool rqi,
const int pdusession_id)
{
UNUSED(ctxt);
UNUSED(flag);
UNUSED(mui);
UNUSED(confirm);
UNUSED(modeP);
UNUSED(sourceL2Id);
UNUSED(destinationL2Id);
UNUSED(rqi);
UNUSED(pdusession_id);
EXPECT_EQ(ue_id, 1); // as defined in basic_conn_qfi
EXPECT_EQ(qfi, 1);
EXPECT_EQ(size, 3);
@@ -171,6 +183,14 @@ static bool recv_multi_qfi_same_pdu(protocol_ctxt_t *ctxt,
const bool rqi,
const int pdusession_id)
{
UNUSED(ctxt);
UNUSED(flag);
UNUSED(mui);
UNUSED(confirm);
UNUSED(modeP);
UNUSED(sourceL2Id);
UNUSED(destinationL2Id);
UNUSED(rqi);
EXPECT_EQ(ue_id, 7U);
EXPECT_EQ(pdusession_id, 9);
EXPECT_LT(recv_count_multi_qfi, expected_qfis_multi_qfi_count);
@@ -258,6 +278,13 @@ static bool recv_basic_conn(protocol_ctxt_t *ctxt,
const uint32_t *sourceL2Id,
const uint32_t *destinationL2Id)
{
UNUSED(srb_flagP);
UNUSED(rb_idP);
UNUSED(muiP);
UNUSED(confirmP);
UNUSED(modeP);
UNUSED(sourceL2Id);
UNUSED(destinationL2Id);
EXPECT_EQ(ctxt->rntiMaybeUEid, 12); // as defined in basic_conn
EXPECT_EQ(size, 3);
for (int i = 0; i < size; ++i)