diff mbox

[3/5] validation: renaming in odp_classification.c

Message ID 1434973305-9684-4-git-send-email-christophe.milard@linaro.org
State Superseded
Headers show

Commit Message

Christophe Milard June 22, 2015, 11:41 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>
---
 .../classification/odp_classification_basic.c      | 34 +++++++++++-----------
 .../classification/odp_classification_tests.c      | 30 +++++++++----------
 .../classification/odp_classification_testsuites.h |  8 ++---
 test/validation/odp_classification.c               |  8 ++---
 4 files changed, 40 insertions(+), 40 deletions(-)
diff mbox

Patch

diff --git a/test/validation/classification/odp_classification_basic.c b/test/validation/classification/odp_classification_basic.c
index b327e35..99202ee 100644
--- a/test/validation/classification/odp_classification_basic.c
+++ b/test/validation/classification/odp_classification_basic.c
@@ -8,7 +8,7 @@ 
 
 #define PMR_SET_NUM	5
 
-static void classification_create_cos(void)
+static void classification_test_create_cos(void)
 {
 	odp_cos_t cos;
 	char name[ODP_COS_NAME_LEN];
@@ -19,7 +19,7 @@  static void classification_create_cos(void)
 	odp_cos_destroy(cos);
 }
 
-static void classification_destroy_cos(void)
+static void classification_test_destroy_cos(void)
 {
 	odp_cos_t cos;
 	char name[ODP_COS_NAME_LEN];
@@ -33,7 +33,7 @@  static void classification_destroy_cos(void)
 	CU_ASSERT(retval < 0);
 }
 
-static void classification_create_pmr_match(void)
+static void classification_test_create_pmr_match(void)
 {
 	odp_pmr_t pmr;
 	uint16_t val;
@@ -46,7 +46,7 @@  static void classification_create_pmr_match(void)
 	odp_pmr_destroy(pmr);
 }
 
-static void classification_destroy_pmr(void)
+static void classification_test_destroy_pmr(void)
 {
 	odp_pmr_t pmr;
 	uint16_t val;
@@ -62,7 +62,7 @@  static void classification_destroy_pmr(void)
 	CU_ASSERT(retval < 0);
 }
 
-static void classification_cos_set_queue(void)
+static void classification_test_cos_set_queue(void)
 {
 	int retval;
 	char cosname[ODP_COS_NAME_LEN];
@@ -87,7 +87,7 @@  static void classification_cos_set_queue(void)
 	odp_queue_destroy(queue_cos);
 }
 
-static void classification_cos_set_drop(void)
+static void classification_test_cos_set_drop(void)
 {
 	int retval;
 	char cosname[ODP_COS_NAME_LEN];
@@ -103,7 +103,7 @@  static void classification_cos_set_drop(void)
 	odp_cos_destroy(cos_drop);
 }
 
-static void classification_pmr_match_set_create(void)
+static void classification_test_pmr_match_set_create(void)
 {
 	odp_pmr_set_t pmr_set;
 	int retval;
@@ -127,7 +127,7 @@  static void classification_pmr_match_set_create(void)
 	CU_ASSERT(retval == 0);
 }
 
-static void classification_pmr_match_set_destroy(void)
+static void classification_test_pmr_match_set_destroy(void)
 {
 	odp_pmr_set_t pmr_set;
 	int retval;
@@ -153,14 +153,14 @@  static void classification_pmr_match_set_destroy(void)
 	CU_ASSERT(retval == 0);
 }
 
-CU_TestInfo classification_basic[] = {
-	_CU_TEST_INFO(classification_create_cos),
-	_CU_TEST_INFO(classification_destroy_cos),
-	_CU_TEST_INFO(classification_create_pmr_match),
-	_CU_TEST_INFO(classification_destroy_pmr),
-	_CU_TEST_INFO(classification_cos_set_queue),
-	_CU_TEST_INFO(classification_cos_set_drop),
-	_CU_TEST_INFO(classification_pmr_match_set_create),
-	_CU_TEST_INFO(classification_pmr_match_set_destroy),
+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,
 };
diff --git a/test/validation/classification/odp_classification_tests.c b/test/validation/classification/odp_classification_tests.c
index 9bc4c1d..502105e 100644
--- a/test/validation/classification/odp_classification_tests.c
+++ b/test/validation/classification/odp_classification_tests.c
@@ -267,7 +267,7 @@  odp_packet_t create_packet(bool vlan)
 	return pkt;
 }
 
-int classification_tests_init(void)
+int classification_suite_init(void)
 {
 	odp_pool_t pool;
 	odp_pool_param_t param;
@@ -323,7 +323,7 @@  int classification_tests_init(void)
 	return 0;
 }
 
-int classification_tests_finalize(void)
+int classification_suite_term(void)
 {
 	int i;
 	int retcode = 0;
@@ -564,7 +564,7 @@  void test_pktio_error_cos(void)
 	odp_packet_free(pkt);
 }
 
-static void classification_pktio_set_skip(void)
+static void classification_test_pktio_set_skip(void)
 {
 	int retval;
 	size_t offset = 5;
@@ -581,7 +581,7 @@  static void classification_pktio_set_skip(void)
 	CU_ASSERT(retval == 0);
 }
 
-static void classification_pktio_set_headroom(void)
+static void classification_test_pktio_set_headroom(void)
 {
 	size_t headroom;
 	int retval;
@@ -793,7 +793,7 @@  void test_pktio_pmr_match_set_cos(void)
 	odp_packet_free(pkt);
 }
 
-static void classification_pmr_terms_avail(void)
+static void classification_test_pmr_terms_avail(void)
 {
 	int retval;
 	/* Since this API called at the start of the suite the return value
@@ -802,7 +802,7 @@  static void classification_pmr_terms_avail(void)
 	CU_ASSERT(retval > 0);
 }
 
-static void classification_pmr_terms_cap(void)
+static void classification_test_pmr_terms_cap(void)
 {
 	unsigned long long retval;
 	/* Need to check different values for different platforms */
@@ -810,7 +810,7 @@  static void classification_pmr_terms_cap(void)
 	CU_ASSERT(retval | (1 << ODP_PMR_IPPROTO));
 }
 
-static void classification_pktio_configure(void)
+static void classification_test_pktio_configure(void)
 {
 	/* Configure the Different CoS for the pktio interface */
 	if (TEST_DEFAULT)
@@ -827,7 +827,7 @@  static void classification_pktio_configure(void)
 		configure_pktio_pmr_match_set_cos();
 }
 
-static void classification_pktio_test(void)
+static void classification_test_pktio_test(void)
 {
 	/* Test Different CoS on the pktio interface */
 	if (TEST_DEFAULT)
@@ -844,12 +844,12 @@  static void classification_pktio_test(void)
 		test_pktio_pmr_match_set_cos();
 }
 
-CU_TestInfo classification_tests[] = {
-	_CU_TEST_INFO(classification_pmr_terms_avail),
-	_CU_TEST_INFO(classification_pktio_set_skip),
-	_CU_TEST_INFO(classification_pktio_set_headroom),
-	_CU_TEST_INFO(classification_pmr_terms_cap),
-	_CU_TEST_INFO(classification_pktio_configure),
-	_CU_TEST_INFO(classification_pktio_test),
+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,
 };
diff --git a/test/validation/classification/odp_classification_testsuites.h b/test/validation/classification/odp_classification_testsuites.h
index c4c9ecd..f603f30 100644
--- a/test/validation/classification/odp_classification_testsuites.h
+++ b/test/validation/classification/odp_classification_testsuites.h
@@ -14,11 +14,11 @@ 
 /* Helper macro for CU_TestInfo initialization */
 #define _CU_TEST_INFO(test_func) {#test_func, test_func}
 
-extern CU_TestInfo classification_tests[];
-extern CU_TestInfo classification_basic[];
+extern CU_TestInfo classification_suite[];
+extern CU_TestInfo classification_suite_basic[];
 
-int classification_tests_init(void);
-int classification_tests_finalize(void);
+int classification_suite_init(void);
+int classification_suite_term(void);
 
 odp_packet_t create_packet(bool vlan);
 void configure_pktio_default_cos(void);
diff --git a/test/validation/odp_classification.c b/test/validation/odp_classification.c
index 31c885d..69cdd4b 100644
--- a/test/validation/odp_classification.c
+++ b/test/validation/odp_classification.c
@@ -10,12 +10,12 @@ 
 
 static CU_SuiteInfo classification_suites[] = {
 	{ .pName = "classification basic",
-			.pTests = classification_basic,
+			.pTests = classification_suite_basic,
 	},
 	{ .pName = "classification tests",
-			.pTests = classification_tests,
-			.pInitFunc = classification_tests_init,
-			.pCleanupFunc = classification_tests_finalize,
+			.pTests = classification_suite,
+			.pInitFunc = classification_suite_init,
+			.pCleanupFunc = classification_suite_term,
 	},
 	CU_SUITE_INFO_NULL,
 };