Beispiel #1
0
}

static void thread_test_odp_thread_id(void)
{
	(void)odp_thread_id();
	CU_PASS();
}

static void thread_test_odp_thread_count(void)
{
	(void)odp_thread_count();
	CU_PASS();
}

static CU_TestInfo thread_suite[] = {
	_CU_TEST_INFO(thread_test_odp_cpu_id),
	_CU_TEST_INFO(thread_test_odp_thread_id),
	_CU_TEST_INFO(thread_test_odp_thread_count),
	CU_TEST_INFO_NULL,
};

static CU_SuiteInfo thread_suites[] = {
	{"thread", NULL, NULL, NULL, NULL, thread_suite},
	CU_SUITE_INFO_NULL,
};

int thread_main(void)
{
	return odp_cunit_run(thread_suites);
}
Beispiel #2
0
#include <odp.h>
#include <odp_cunit_common.h>
#include "random.h"

/* Helper macro for CU_TestInfo initialization */
#define _CU_TEST_INFO(test_func) {#test_func, test_func}

void random_test_get_size(void)
{
	int32_t ret;
	uint8_t buf[32];

	ret = odp_random_data(buf, sizeof(buf), false);
	CU_ASSERT(ret == sizeof(buf));
}

CU_TestInfo random_suite[] = {
	_CU_TEST_INFO(random_test_get_size),
	CU_TEST_INFO_NULL,
};

CU_SuiteInfo random_suites[] = {
	{"Random", NULL, NULL, NULL, NULL, random_suite},
	CU_SUITE_INFO_NULL,
};

int random_main(void)
{
	return odp_cunit_run(random_suites);
}
	if (TEST_PMR_SET)
		configure_pktio_pmr_match_set_cos();
}

void classification_test_pktio_test(void)
{
	/* Test Different CoS on the pktio interface */
	if (TEST_DEFAULT)
		test_pktio_default_cos();
	if (TEST_ERROR)
		test_pktio_error_cos();
	if (TEST_PMR_CHAIN)
		test_cls_pmr_chain();
	if (TEST_L2_QOS)
		test_cos_with_l2_priority();
	if (TEST_PMR)
		test_pmr_cos();
	if (TEST_PMR_SET)
		test_pktio_pmr_match_set_cos();
}

CU_TestInfo classification_suite[] = {
	_CU_TEST_INFO(classification_test_pmr_terms_avail),
	_CU_TEST_INFO(classification_test_pktio_set_skip),
	_CU_TEST_INFO(classification_test_pktio_set_headroom),
	_CU_TEST_INFO(classification_test_pmr_terms_cap),
	_CU_TEST_INFO(classification_test_pktio_configure),
	_CU_TEST_INFO(classification_test_pktio_test),
	CU_TEST_INFO_NULL,
};
	int i;

	retval = odp_pmr_match_set_destroy(ODP_PMR_SET_INVAL);
	CU_ASSERT(retval < 0);

	for (i = 0; i < PMR_SET_NUM; i++) {
		pmr_terms[i].term = ODP_PMR_TCP_DPORT;
		pmr_terms[i].val = &val;
		pmr_terms[i].mask = &mask;
		pmr_terms[i].val_sz = sizeof(val);
	}

	retval = odp_pmr_match_set_create(PMR_SET_NUM, pmr_terms, &pmr_set);
	CU_ASSERT(retval > 0);

	retval = odp_pmr_match_set_destroy(pmr_set);
	CU_ASSERT(retval == 0);
}

CU_TestInfo classification_suite_basic[] = {
	_CU_TEST_INFO(classification_test_create_cos),
	_CU_TEST_INFO(classification_test_destroy_cos),
	_CU_TEST_INFO(classification_test_create_pmr_match),
	_CU_TEST_INFO(classification_test_destroy_pmr),
	_CU_TEST_INFO(classification_test_cos_set_queue),
	_CU_TEST_INFO(classification_test_cos_set_drop),
	_CU_TEST_INFO(classification_test_pmr_match_set_create),
	_CU_TEST_INFO(classification_test_pmr_match_set_destroy),
	CU_TEST_INFO_NULL,
};