@@ -70,7 +70,6 @@ void configure_default_cos(odp_pktio_t pktio, odp_cos_t *cos,
*cos = default_cos;
*queue = default_queue;
*pool = default_pool;
- return;
}
int classification_suite_pmr_term(void)
@@ -53,6 +53,10 @@ static void alg_test(odp_crypto_op_t op,
odp_event_t event;
odp_crypto_compl_t compl_event;
odp_crypto_op_result_t result;
+ odp_crypto_session_params_t ses_params;
+ odp_crypto_op_params_t op_params;
+ uint8_t *data_addr;
+ int data_off;
rc = odp_crypto_capability(&capability);
CU_ASSERT(!rc);
@@ -100,7 +104,6 @@ static void alg_test(odp_crypto_op_t op,
CU_ASSERT(!rc);
/* Create a crypto session */
- odp_crypto_session_params_t ses_params;
memset(&ses_params, 0, sizeof(ses_params));
ses_params.op = op;
ses_params.auth_cipher_text = false;
@@ -123,12 +126,11 @@ static void alg_test(odp_crypto_op_t op,
odp_packet_t pkt = odp_packet_alloc(suite_context.pool,
plaintext_len + digest_len);
CU_ASSERT(pkt != ODP_PACKET_INVALID);
- uint8_t *data_addr = odp_packet_data(pkt);
+ data_addr = odp_packet_data(pkt);
memcpy(data_addr, plaintext, plaintext_len);
- int data_off = 0;
+ data_off = 0;
/* Prepare input/output params */
- odp_crypto_op_params_t op_params;
memset(&op_params, 0, sizeof(op_params));
op_params.session = session;
op_params.pkt = pkt;
@@ -199,10 +201,10 @@ void crypto_test_enc_alg_3des_cbc(void)
odp_crypto_key_t cipher_key = { .data = NULL, .length = 0 },
auth_key = { .data = NULL, .length = 0 };
odp_crypto_iv_t iv;
- unsigned int test_vec_num = (sizeof(tdes_cbc_reference_length)/
+ unsigned int test_vec_num = (sizeof(tdes_cbc_reference_length) /
sizeof(tdes_cbc_reference_length[0]));
-
unsigned int i;
+
for (i = 0; i < test_vec_num; i++) {
cipher_key.data = tdes_cbc_reference_key[i];
cipher_key.length = sizeof(tdes_cbc_reference_key[i]);
@@ -232,10 +234,10 @@ void crypto_test_enc_alg_3des_cbc_ovr_iv(void)
odp_crypto_key_t cipher_key = { .data = NULL, .length = 0 },
auth_key = { .data = NULL, .length = 0 };
odp_crypto_iv_t iv = { .data = NULL, .length = TDES_CBC_IV_LEN };
- unsigned int test_vec_num = (sizeof(tdes_cbc_reference_length)/
+ unsigned int test_vec_num = (sizeof(tdes_cbc_reference_length) /
sizeof(tdes_cbc_reference_length[0]));
-
unsigned int i;
+
for (i = 0; i < test_vec_num; i++) {
cipher_key.data = tdes_cbc_reference_key[i];
cipher_key.length = sizeof(tdes_cbc_reference_key[i]);
@@ -255,7 +257,6 @@ void crypto_test_enc_alg_3des_cbc_ovr_iv(void)
}
}
-
/* This test verifies the correctness of decode (ciphertext -> plaintext)
* operation for 3DES_CBC algorithm. IV for the operation is the session IV
* In addition the test verifies if the implementation can use the
@@ -266,10 +267,10 @@ void crypto_test_dec_alg_3des_cbc(void)
odp_crypto_key_t cipher_key = { .data = NULL, .length = 0 },
auth_key = { .data = NULL, .length = 0 };
odp_crypto_iv_t iv = { .data = NULL, .length = 0 };
- unsigned int test_vec_num = (sizeof(tdes_cbc_reference_length)/
+ unsigned int test_vec_num = (sizeof(tdes_cbc_reference_length) /
sizeof(tdes_cbc_reference_length[0]));
-
unsigned int i;
+
for (i = 0; i < test_vec_num; i++) {
cipher_key.data = tdes_cbc_reference_key[i];
cipher_key.length = sizeof(tdes_cbc_reference_key[i]);
@@ -301,10 +302,10 @@ void crypto_test_dec_alg_3des_cbc_ovr_iv(void)
odp_crypto_key_t cipher_key = { .data = NULL, .length = 0 },
auth_key = { .data = NULL, .length = 0 };
odp_crypto_iv_t iv = { .data = NULL, .length = TDES_CBC_IV_LEN };
- unsigned int test_vec_num = (sizeof(tdes_cbc_reference_length)/
+ unsigned int test_vec_num = (sizeof(tdes_cbc_reference_length) /
sizeof(tdes_cbc_reference_length[0]));
-
unsigned int i;
+
for (i = 0; i < test_vec_num; i++) {
cipher_key.data = tdes_cbc_reference_key[i];
cipher_key.length = sizeof(tdes_cbc_reference_key[i]);
@@ -607,7 +608,6 @@ void crypto_test_dec_alg_aes128_cbc_ovr_iv(void)
}
}
-
/* This test verifies the correctness of HMAC_MD5 digest operation.
* The output check length is truncated to 12 bytes (96 bits) as
* returned by the crypto operation API call.
@@ -621,10 +621,10 @@ void crypto_test_alg_hmac_md5(void)
auth_key = { .data = NULL, .length = 0 };
odp_crypto_iv_t iv = { .data = NULL, .length = 0 };
- unsigned int test_vec_num = (sizeof(hmac_md5_reference_length)/
+ unsigned int test_vec_num = (sizeof(hmac_md5_reference_length) /
sizeof(hmac_md5_reference_length[0]));
-
unsigned int i;
+
for (i = 0; i < test_vec_num; i++) {
auth_key.data = hmac_md5_reference_key[i];
auth_key.length = sizeof(hmac_md5_reference_key[i]);
@@ -266,7 +266,7 @@ aes128_gcm_reference_ciphertext[][AES128_GCM_MAX_DATA_LEN] = {
static uint8_t hmac_md5_reference_key[][HMAC_MD5_KEY_LEN] = {
{ 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b,
- 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b } ,
+ 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b },
/* "Jefe" */
{ 0x4a, 0x65, 0x66, 0x65 },
@@ -51,5 +51,4 @@ int hash_main(int argc, char *argv[])
ret = odp_cunit_run();
return ret;
-
}
@@ -1547,7 +1547,6 @@ void pktio_test_start_stop(void)
/* Test Rx on a stopped interface. Only works if there are 2 */
if (num_ifaces > 1) {
-
alloc = create_packets(tx_pkt, pkt_seq, 1000, pktio[0],
pktio[1]);
@@ -1591,7 +1590,6 @@ void pktio_test_start_stop(void)
}
}
-
if (num_ifaces > 1)
pktio_in = pktio[1];
else
@@ -148,6 +148,7 @@ void queue_test_param(void)
int nr_deq_entries = 0;
int max_iteration = CONFIG_MAX_ITERATION;
odp_queue_param_t qparams;
+ odp_buffer_t enbuf;
/* Schedule type queue */
odp_queue_param_init(&qparams);
@@ -197,7 +198,7 @@ void queue_test_param(void)
}
for (i = 0; i < MAX_BUFFER_QUEUE; i++) {
- odp_buffer_t buf = odp_buffer_alloc(msg_pool);
+ buf = odp_buffer_alloc(msg_pool);
enev[i] = odp_buffer_to_event(buf);
}
@@ -223,7 +224,7 @@ void queue_test_param(void)
} while (nr_deq_entries < MAX_BUFFER_QUEUE);
for (i = 0; i < MAX_BUFFER_QUEUE; i++) {
- odp_buffer_t enbuf = odp_buffer_from_event(enev[i]);
+ enbuf = odp_buffer_from_event(enev[i]);
CU_ASSERT(enev[i] == deev[i]);
odp_buffer_free(enbuf);
}
@@ -283,7 +284,7 @@ void queue_test_info(void)
CU_ASSERT(info.param.sched.group == odp_queue_sched_group(q_order));
ret = odp_queue_lock_count(q_order);
CU_ASSERT(ret >= 0);
- lock_count = (unsigned) ret;
+ lock_count = (unsigned)ret;
CU_ASSERT(info.param.sched.lock_count == lock_count);
CU_ASSERT(odp_queue_destroy(q_plain) == 0);
@@ -676,6 +676,9 @@ static int schedule_common_(void *arg)
odp_pool_t pool;
int locked;
int num;
+ odp_event_t ev;
+ odp_buffer_t buf, buf_cpy;
+ odp_queue_t from;
globals = args->globals;
sync = args->sync;
@@ -687,9 +690,7 @@ static int schedule_common_(void *arg)
odp_barrier_wait(&globals->barrier);
while (1) {
- odp_event_t ev;
- odp_buffer_t buf, buf_cpy;
- odp_queue_t from = ODP_QUEUE_INVALID;
+ from = ODP_QUEUE_INVALID;
num = 0;
odp_ticketlock_lock(&globals->lock);
@@ -902,6 +903,8 @@ static void fill_queues(thread_args_t *args)
test_globals_t *globals;
char name[32];
int ret;
+ odp_buffer_t buf;
+ odp_event_t ev;
globals = args->globals;
sync = args->sync;
@@ -937,8 +940,6 @@ static void fill_queues(thread_args_t *args)
CU_ASSERT_FATAL(queue != ODP_QUEUE_INVALID);
for (k = 0; k < args->num_bufs; k++) {
- odp_buffer_t buf;
- odp_event_t ev;
buf = odp_buffer_alloc(pool);
CU_ASSERT_FATAL(buf != ODP_BUFFER_INVALID);
ev = odp_buffer_to_event(buf);
@@ -1332,6 +1333,7 @@ static int create_queues(void)
odp_buffer_t queue_ctx_buf;
queue_context *qctx, *pqctx;
uint32_t ndx;
+ odp_queue_param_t p;
if (odp_queue_capability(&capa) < 0) {
printf("Queue capability query failed\n");
@@ -1359,7 +1361,6 @@ static int create_queues(void)
}
for (i = 0; i < prios; i++) {
- odp_queue_param_t p;
odp_queue_param_init(&p);
p.type = ODP_QUEUE_TYPE_SCHED;
p.sched.prio = i;
@@ -251,7 +251,8 @@ static void handle_tmo(odp_event_t ev, bool stale, uint64_t prev_tick)
CU_FAIL("Wrong status (stale) for fresh timeout");
/* Fresh timeout => local timer must have matching tick */
if (ttp && ttp->tick != tick) {
- LOG_DBG("Wrong tick: expected %" PRIu64 " actual %" PRIu64 "\n",
+ LOG_DBG("Wrong tick: expected %" PRIu64
+ " actual %" PRIu64 "\n",
ttp->tick, tick);
CU_FAIL("odp_timeout_tick() wrong tick");
}
@@ -259,7 +260,8 @@ static void handle_tmo(odp_event_t ev, bool stale, uint64_t prev_tick)
if (tick > odp_timer_current_tick(tp))
CU_FAIL("Timeout delivered early");
if (tick < prev_tick) {
- LOG_DBG("Too late tick: %" PRIu64 " prev_tick %" PRIu64"\n",
+ LOG_DBG("Too late tick: %" PRIu64
+ " prev_tick %" PRIu64"\n",
tick, prev_tick);
/* We don't report late timeouts using CU_FAIL */
odp_atomic_inc_u32(&ndelivtoolate);
@@ -281,12 +283,26 @@ static int worker_entrypoint(void *arg TEST_UNUSED)
uint32_t i, allocated;
unsigned seed = thr;
int rc;
+ odp_queue_t queue;
+ struct test_timer *tt;
+ uint32_t nset;
+ uint64_t tck;
+ uint32_t nrcv;
+ uint32_t nreset;
+ uint32_t ncancel;
+ uint32_t ntoolate;
+ uint32_t ms;
+ uint64_t prev_tick;
+ odp_event_t ev;
+ struct timespec ts;
+ uint32_t nstale;
+ odp_timer_set_t timer_rc;
- odp_queue_t queue = odp_queue_create("timer_queue", NULL);
+ queue = odp_queue_create("timer_queue", NULL);
if (queue == ODP_QUEUE_INVALID)
CU_FAIL_FATAL("Queue create failed");
- struct test_timer *tt = malloc(sizeof(struct test_timer) * NTIMERS);
+ tt = malloc(sizeof(struct test_timer) * NTIMERS);
if (!tt)
CU_FAIL_FATAL("malloc failed");
@@ -316,15 +332,13 @@ static int worker_entrypoint(void *arg TEST_UNUSED)
odp_barrier_wait(&test_barrier);
/* Initial set all timers with a random expiration time */
- uint32_t nset = 0;
+ nset = 0;
for (i = 0; i < allocated; i++) {
- uint64_t tck = odp_timer_current_tick(tp) + 1 +
- odp_timer_ns_to_tick(tp,
- (rand_r(&seed) % RANGE_MS)
- * 1000000ULL);
- odp_timer_set_t rc;
- rc = odp_timer_set_abs(tt[i].tim, tck, &tt[i].ev);
- if (rc != ODP_TIMER_SUCCESS) {
+ tck = odp_timer_current_tick(tp) + 1 +
+ odp_timer_ns_to_tick(tp, (rand_r(&seed) % RANGE_MS)
+ * 1000000ULL);
+ timer_rc = odp_timer_set_abs(tt[i].tim, tck, &tt[i].ev);
+ if (timer_rc != ODP_TIMER_SUCCESS) {
CU_FAIL("Failed to set timer");
} else {
tt[i].tick = tck;
@@ -333,15 +347,13 @@ static int worker_entrypoint(void *arg TEST_UNUSED)
}
/* Step through wall time, 1ms at a time and check for expired timers */
- uint32_t nrcv = 0;
- uint32_t nreset = 0;
- uint32_t ncancel = 0;
- uint32_t ntoolate = 0;
- uint32_t ms;
- uint64_t prev_tick = odp_timer_current_tick(tp);
+ nrcv = 0;
+ nreset = 0;
+ ncancel = 0;
+ ntoolate = 0;
+ prev_tick = odp_timer_current_tick(tp);
for (ms = 0; ms < 7 * RANGE_MS / 10 && allocated > 0; ms++) {
- odp_event_t ev;
while ((ev = odp_queue_deq(queue)) != ODP_EVENT_INVALID) {
/* Subtract one from prev_tick to allow for timeouts
* to be delivered a tick late */
@@ -388,7 +400,6 @@ static int worker_entrypoint(void *arg TEST_UNUSED)
tt[i].tick = cur_tick + tck;
}
}
- struct timespec ts;
ts.tv_sec = 0;
ts.tv_nsec = 1000000; /* 1ms */
if (nanosleep(&ts, NULL) < 0)
@@ -396,7 +407,7 @@ static int worker_entrypoint(void *arg TEST_UNUSED)
}
/* Cancel and free all timers */
- uint32_t nstale = 0;
+ nstale = 0;
for (i = 0; i < allocated; i++) {
(void)odp_timer_cancel(tt[i].tim, &tt[i].ev);
tt[i].tick = TICK_INVALID;
@@ -412,22 +423,22 @@ static int worker_entrypoint(void *arg TEST_UNUSED)
LOG_DBG("Thread %u: %" PRIu32 " timers reset/cancelled too late\n",
thr, ntoolate);
LOG_DBG("Thread %u: %" PRIu32 " timeouts received\n", thr, nrcv);
- LOG_DBG("Thread %u: %" PRIu32 " stale timeout(s) after odp_timer_free()\n",
+ LOG_DBG("Thread %u: %" PRIu32
+ " stale timeout(s) after odp_timer_free()\n",
thr, nstale);
/* Delay some more to ensure timeouts for expired timers can be
* received. Can not use busy loop here to make background timer
* thread finish their work. */
- struct timespec ts;
ts.tv_sec = 0;
ts.tv_nsec = (3 * RANGE_MS / 10 + 50) * ODP_TIME_MSEC_IN_NS;
if (nanosleep(&ts, NULL) < 0)
CU_FAIL_FATAL("nanosleep failed");
while (nstale != 0) {
- odp_event_t ev = odp_queue_deq(queue);
+ ev = odp_queue_deq(queue);
if (ev != ODP_EVENT_INVALID) {
- handle_tmo(ev, true, 0/*Dont' care for stale tmo's*/);
+ handle_tmo(ev, true, 0/*Don't care for stale tmo's*/);
nstale--;
} else {
CU_FAIL("Failed to receive stale timeout");
@@ -441,7 +452,7 @@ static int worker_entrypoint(void *arg TEST_UNUSED)
}
/* Check if there any more (unexpected) events */
- odp_event_t ev = odp_queue_deq(queue);
+ ev = odp_queue_deq(queue);
if (ev != ODP_EVENT_INVALID)
CU_FAIL("Unexpected event received");
@@ -464,6 +475,11 @@ void timer_test_odp_timer_all(void)
odp_pool_param_t params;
odp_timer_pool_param_t tparam;
odp_cpumask_t unused;
+ odp_timer_pool_info_t tpinfo;
+ uint64_t tick;
+ uint64_t ns;
+ uint64_t t2;
+ pthrd_arg thrdarg;
/* Reserve at least one core for running other processes so the timer
* test hopefully can run undisturbed and thus get better timing
@@ -505,7 +521,6 @@ void timer_test_odp_timer_all(void)
/* Start all created timer pools */
odp_timer_pool_start();
- odp_timer_pool_info_t tpinfo;
if (odp_timer_pool_info(tp, &tpinfo) != 0)
CU_FAIL("odp_timer_pool_info");
CU_ASSERT(strcmp(tpinfo.name, NAME) == 0);
@@ -519,10 +534,9 @@ void timer_test_odp_timer_all(void)
LOG_DBG("Tmo range: %u ms (%" PRIu64 " ticks)\n", RANGE_MS,
odp_timer_ns_to_tick(tp, 1000000ULL * RANGE_MS));
- uint64_t tick;
for (tick = 0; tick < 1000000000000ULL; tick += 1000000ULL) {
- uint64_t ns = odp_timer_tick_to_ns(tp, tick);
- uint64_t t2 = odp_timer_ns_to_tick(tp, ns);
+ ns = odp_timer_tick_to_ns(tp, tick);
+ t2 = odp_timer_ns_to_tick(tp, ns);
if (tick != t2)
CU_FAIL("Invalid conversion tick->ns->tick");
}
@@ -537,7 +551,6 @@ void timer_test_odp_timer_all(void)
odp_atomic_init_u32(&timers_allocated, 0);
/* Create and start worker threads */
- pthrd_arg thrdarg;
thrdarg.testcase = 0;
thrdarg.numthrds = num_workers;
odp_cunit_thread_create(worker_entrypoint, &thrdarg);
To reduce the number of issues picked up by check-odp when moving the files in next patch Signed-off-by: Christophe Milard <christophe.milard@linaro.org> --- .../classification/odp_classification_test_pmr.c | 1 - test/validation/crypto/odp_crypto_test_inp.c | 32 ++++----- test/validation/crypto/test_vectors.h | 2 +- test/validation/hash/hash.c | 1 - test/validation/pktio/pktio.c | 2 - test/validation/queue/queue.c | 7 +- test/validation/scheduler/scheduler.c | 13 ++-- test/validation/timer/timer.c | 75 +++++++++++++--------- 8 files changed, 72 insertions(+), 61 deletions(-) -- 2.7.4