diff mbox

[2/5] validation: renaming in odp_packet.c

Message ID 1435316981-22355-3-git-send-email-christophe.milard@linaro.org
State Superseded
Headers show

Commit Message

Christophe Milard June 26, 2015, 11:09 a.m. UTC
Renaming of things which may be, one day, exported in a lib.
This renaming is important, as it creates consistency between test
symbols, which is needed if things get eventually exported in the lib.
Also, tests are often created from other tests: Fixing the first exemples
will help geting future tests better.

Things that are candidate to be exported in the lib in the future
have been named as follows:
 -Tests, i.e. functions which are used in CUNIT testsuites are named:
    <Module>_test_*
 -Test arrays, i.e. arrays of CU_TestInfo, listing the test functions
  belonging to a suite, are called:
    <Module>_suite[_*]
  where the possible suffix can be used if many suites are declared.
 -CUNIT suite init and termination functions are called:
    <Module>_suite[_*]_init() and <Module>_suite[_*]_term()
  respectively.
 -Suite arrays, i.e. arrays of CU_SuiteInfo used in executables are called:
    <Module>_suites[_*]
  where the possible suffix identifies the executable using it, if many.
 -Main function(s), are called:
    <Module>_main[_*]
  where the possible suffix identifies the executable using it

Signed-off-by: Christophe Milard <christophe.milard@linaro.org>
---
 test/validation/odp_packet.c | 84 ++++++++++++++++++++++----------------------
 1 file changed, 42 insertions(+), 42 deletions(-)
diff mbox

Patch

diff --git a/test/validation/odp_packet.c b/test/validation/odp_packet.c
index a621747..e9a022c 100644
--- a/test/validation/odp_packet.c
+++ b/test/validation/odp_packet.c
@@ -34,7 +34,7 @@  static struct udata_struct {
 	"abcdefg",
 };
 
-static int packet_testsuite_init(void)
+static int packet_suite_init(void)
 {
 	odp_pool_param_t params = {
 		.pkt = {
@@ -67,7 +67,7 @@  static int packet_testsuite_init(void)
 	return 0;
 }
 
-static int packet_testsuite_finalize(void)
+static int packet_suite_term(void)
 {
 	odp_packet_free(test_packet);
 	if (odp_pool_destroy(packet_pool) != 0)
@@ -75,7 +75,7 @@  static int packet_testsuite_finalize(void)
 	return 0;
 }
 
-static void packet_alloc_free(void)
+static void packet_test_alloc_free(void)
 {
 	odp_pool_t pool;
 	odp_packet_t packet;
@@ -114,7 +114,7 @@  static void packet_alloc_free(void)
 	CU_ASSERT(odp_pool_destroy(pool) == 0);
 }
 
-static void packet_alloc_segmented(void)
+static void packet_test_alloc_segmented(void)
 {
 	odp_packet_t pkt;
 	const uint32_t len = ODP_CONFIG_PACKET_BUF_LEN_MAX -
@@ -127,7 +127,7 @@  static void packet_alloc_segmented(void)
 	odp_packet_free(pkt);
 }
 
-static void packet_event_conversion(void)
+static void packet_test_event_conversion(void)
 {
 	odp_packet_t pkt = test_packet;
 	odp_packet_t tmp_pkt;
@@ -142,7 +142,7 @@  static void packet_event_conversion(void)
 	/** @todo: Need an API to compare packets */
 }
 
-static void packet_basic_metadata(void)
+static void packet_test_basic_metadata(void)
 {
 	odp_packet_t pkt = test_packet;
 	CU_ASSERT(odp_packet_head(pkt) != NULL);
@@ -153,7 +153,7 @@  static void packet_basic_metadata(void)
 	CU_ASSERT(odp_packet_input(pkt) == ODP_PKTIO_INVALID);
 }
 
-static void packet_length(void)
+static void packet_test_length(void)
 {
 	odp_packet_t pkt = test_packet;
 	uint32_t buf_len, headroom, tailroom;
@@ -172,13 +172,13 @@  static void packet_length(void)
 	CU_ASSERT(buf_len >= packet_len + headroom + tailroom);
 }
 
-static void packet_debug(void)
+static void packet_test_debug(void)
 {
 	CU_ASSERT(odp_packet_is_valid(test_packet) == 1);
 	odp_packet_print(test_packet);
 }
 
-static void packet_context(void)
+static void packet_test_context(void)
 {
 	odp_packet_t pkt = test_packet;
 	char ptr_test_value = 2;
@@ -200,7 +200,7 @@  static void packet_context(void)
 	odp_packet_reset(pkt, packet_len);
 }
 
-static void packet_layer_offsets(void)
+static void packet_test_layer_offsets(void)
 {
 	odp_packet_t pkt = test_packet;
 	uint8_t *l2_addr, *l3_addr, *l4_addr;
@@ -274,7 +274,7 @@  static void _verify_headroom_shift(odp_packet_t packet,
 	CU_ASSERT(data == data_orig - shift);
 }
 
-static void packet_headroom(void)
+static void packet_test_headroom(void)
 {
 	odp_packet_t pkt = test_packet;
 	uint32_t room;
@@ -345,7 +345,7 @@  static void _verify_tailroom_shift(odp_packet_t pkt,
 	}
 }
 
-static void packet_tailroom(void)
+static void packet_test_tailroom(void)
 {
 	odp_packet_t pkt = test_packet;
 	odp_packet_seg_t segment;
@@ -372,7 +372,7 @@  static void packet_tailroom(void)
 	_verify_tailroom_shift(pkt, 0);
 }
 
-static void packet_segments(void)
+static void packet_test_segments(void)
 {
 	int num_segs, seg_index;
 	uint32_t data_len, buf_len;
@@ -429,7 +429,7 @@  static void packet_segments(void)
 		CU_ASSERT(seg == ODP_PACKET_SEG_INVALID);
 }
 
-static void packet_segment_last(void)
+static void packet_test_segment_last(void)
 {
 	odp_packet_t pkt = test_packet;
 	odp_packet_seg_t seg;
@@ -449,7 +449,7 @@  do { \
 	CU_ASSERT(odp_packet_has_##flag(packet) != 0);    \
 } while (0)
 
-static void packet_in_flags(void)
+static void packet_test_in_flags(void)
 {
 	odp_packet_t pkt = test_packet;
 
@@ -472,7 +472,7 @@  static void packet_in_flags(void)
 	TEST_INFLAG(pkt, icmp);
 }
 
-static void packet_error_flags(void)
+static void packet_test_error_flags(void)
 {
 	odp_packet_t pkt = test_packet;
 	int err;
@@ -494,7 +494,7 @@  struct packet_metadata {
 	uint64_t usr_u64;
 };
 
-static void packet_add_rem_data(void)
+static void packet_test_add_rem_data(void)
 {
 	odp_packet_t pkt, new_pkt;
 	uint32_t pkt_len, offset, add_len;
@@ -604,7 +604,7 @@  static void _packet_compare_data(odp_packet_t pkt1, odp_packet_t pkt2)
 	}
 }
 
-static void packet_copy(void)
+static void packet_test_copy(void)
 {
 	odp_packet_t pkt = test_packet;
 	odp_packet_t pkt_copy;
@@ -623,7 +623,7 @@  static void packet_copy(void)
 	odp_packet_free(pkt_copy);
 }
 
-static void packet_copydata(void)
+static void packet_test_copydata(void)
 {
 	odp_packet_t pkt = test_packet;
 	uint32_t pkt_len = odp_packet_len(pkt);
@@ -654,7 +654,7 @@  static void packet_copydata(void)
 	free(data_buf);
 }
 
-static void packet_offset(void)
+static void packet_test_offset(void)
 {
 	odp_packet_t pkt = test_packet;
 	uint32_t seg_len, full_seg_len;
@@ -700,33 +700,33 @@  static void packet_offset(void)
 	CU_ASSERT(ptr != NULL);
 }
 
-static CU_TestInfo packet_tests[] = {
-	_CU_TEST_INFO(packet_alloc_free),
-	_CU_TEST_INFO(packet_alloc_segmented),
-	_CU_TEST_INFO(packet_basic_metadata),
-	_CU_TEST_INFO(packet_debug),
-	_CU_TEST_INFO(packet_length),
-	_CU_TEST_INFO(packet_headroom),
-	_CU_TEST_INFO(packet_tailroom),
-	_CU_TEST_INFO(packet_context),
-	_CU_TEST_INFO(packet_event_conversion),
-	_CU_TEST_INFO(packet_layer_offsets),
-	_CU_TEST_INFO(packet_segments),
-	_CU_TEST_INFO(packet_segment_last),
-	_CU_TEST_INFO(packet_in_flags),
-	_CU_TEST_INFO(packet_error_flags),
-	_CU_TEST_INFO(packet_add_rem_data),
-	_CU_TEST_INFO(packet_copy),
-	_CU_TEST_INFO(packet_copydata),
-	_CU_TEST_INFO(packet_offset),
+static CU_TestInfo packet_suite[] = {
+	_CU_TEST_INFO(packet_test_alloc_free),
+	_CU_TEST_INFO(packet_test_alloc_segmented),
+	_CU_TEST_INFO(packet_test_basic_metadata),
+	_CU_TEST_INFO(packet_test_debug),
+	_CU_TEST_INFO(packet_test_length),
+	_CU_TEST_INFO(packet_test_headroom),
+	_CU_TEST_INFO(packet_test_tailroom),
+	_CU_TEST_INFO(packet_test_context),
+	_CU_TEST_INFO(packet_test_event_conversion),
+	_CU_TEST_INFO(packet_test_layer_offsets),
+	_CU_TEST_INFO(packet_test_segments),
+	_CU_TEST_INFO(packet_test_segment_last),
+	_CU_TEST_INFO(packet_test_in_flags),
+	_CU_TEST_INFO(packet_test_error_flags),
+	_CU_TEST_INFO(packet_test_add_rem_data),
+	_CU_TEST_INFO(packet_test_copy),
+	_CU_TEST_INFO(packet_test_copydata),
+	_CU_TEST_INFO(packet_test_offset),
 	CU_TEST_INFO_NULL,
 };
 
 static CU_SuiteInfo packet_suites[] = {
 	{ .pName = "packet tests",
-			.pTests = packet_tests,
-			.pInitFunc = packet_testsuite_init,
-			.pCleanupFunc = packet_testsuite_finalize,
+			.pTests = packet_suite,
+			.pInitFunc = packet_suite_init,
+			.pCleanupFunc = packet_suite_term,
 	},
 	CU_SUITE_INFO_NULL,
 };