diff mbox

[v1] validation: queue: use CU_register_suites() for tests registration

Message ID 1417332681-23462-1-git-send-email-yan.songming@linaro.org
State New
Headers show

Commit Message

yan.songming Nov. 30, 2014, 7:31 a.m. UTC
Signed-off-by: Yan Songming <yan.songming@linaro.org>
---
 test/validation/odp_queue.c | 56 ++++++++++++++++++++++-----------------------
 1 file changed, 27 insertions(+), 29 deletions(-)

Comments

Taras Kondratiuk Dec. 1, 2014, 10:23 a.m. UTC | #1
I've addressed this in RFC:
http://lists.linaro.org/pipermail/lng-odp/2014-November/005627.html

I'd prefer to go with that series if you are ok with those changes?
yan.songming Dec. 1, 2014, 11:44 a.m. UTC | #2
It's OK, Thanks for  update this patch.



yan.songming@linaro.org
 
From: Taras Kondratiuk

Date: 2014-12-01 18:23
To: Yan Songming; lng-odp
Subject: Re: [lng-odp] [PATCH v1] validation: queue: use CU_register_suites() for tests registration
I've addressed this in RFC:
http://lists.linaro.org/pipermail/lng-odp/2014-November/005627.html
 
I'd prefer to go with that series if you are ok with those changes?
Maxim Uvarov Dec. 1, 2014, 11:58 a.m. UTC | #3
Taras, I think you need to send your patch without RFC.

Yan, please provide your reviewed-by to Taras patch series.

Thanks,
Maxim,


On 12/01/2014 02:44 PM, yan.songming@linaro.org wrote:
> It's OK, Thanks for  update this patch.
>
> ------------------------------------------------------------------------
> yan.songming@linaro.org
>
>     *From:* Taras Kondratiuk <mailto:taras.kondratiuk@linaro.org>
>     *Date:* 2014-12-01 18:23
>     *To:* Yan Songming <mailto:yan.songming@linaro.org>; lng-odp
>     <mailto:lng-odp@lists.linaro.org>
>     *Subject:* Re: [lng-odp] [PATCH v1] validation: queue: use
>     CU_register_suites() for tests registration
>     I've addressed this in RFC:
>     http://lists.linaro.org/pipermail/lng-odp/2014-November/005627.html
>     I'd prefer to go with that series if you are ok with those changes?
>
>
>
> _______________________________________________
> lng-odp mailing list
> lng-odp@lists.linaro.org
> http://lists.linaro.org/mailman/listinfo/lng-odp
Taras Kondratiuk Dec. 1, 2014, 12:07 p.m. UTC | #4
On 12/01/2014 01:58 PM, Maxim Uvarov wrote:
> Taras, I think you need to send your patch without RFC.
>
> Yan, please provide your reviewed-by to Taras patch series.

It is RFC, because depends in Yan's shm test patch in-flight.
I'll repost it after Yan's patch is merged.
yan.songming Dec. 1, 2014, 12:21 p.m. UTC | #5
> Yan, please provide your reviewed-by to Taras patch series.


So , Maybe i should  provide my reviewed-by when Taras repost.



yan.songming@linaro.org
 
From: Taras Kondratiuk

Date: 2014-12-01 20:07
To: Maxim Uvarov; yan.songming@linaro.org; lng-odp
Subject: Re: [lng-odp] [PATCH v1] validation: queue: use CU_register_suites() for tests registration
On 12/01/2014 01:58 PM, Maxim Uvarov wrote:
> Taras, I think you need to send your patch without RFC.

>

> Yan, please provide your reviewed-by to Taras patch series.

 
It is RFC, because depends in Yan's shm test patch in-flight.
I'll repost it after Yan's patch is merged.
diff mbox

Patch

diff --git a/test/validation/odp_queue.c b/test/validation/odp_queue.c
index 09dba0e..9431511 100644
--- a/test/validation/odp_queue.c
+++ b/test/validation/odp_queue.c
@@ -109,6 +109,22 @@  static int init_suite(void)
 {
 	printf("\tODP API version: %s\n", odp_version_api_str());
 	printf("\tODP implementation version: %s\n", odp_version_impl_str());
+	return 0;
+}
+
+CU_TestInfo test_odp_queue[] = {
+	{"test_odp_queue_sunnyday",  test_odp_queue_sunnyday},
+	CU_TEST_INFO_NULL,
+};
+
+CU_SuiteInfo suites[] = {
+	{"test_odp_queue", init_suite, NULL, NULL, NULL, test_odp_queue},
+	CU_SUITE_INFO_NULL,
+};
+
+int main(void)
+{
+	int ret;
 
 	if (0 != odp_init_global(NULL, NULL)) {
 		printf("odp_init_global fail.\n");
@@ -118,43 +134,25 @@  static int init_suite(void)
 		printf("odp_init_local fail.\n");
 		return -1;
 	}
+
 	if (0 != test_odp_buffer_pool_init()) {
 		printf("test_odp_buffer_pool_init fail.\n");
 		return -1;
 	}
-	return 0;
-}
 
-static int finalize(void)
-{
-	odp_term_local();
-	odp_term_global();
-	return 0;
-}
+	CU_set_error_action(CUEA_ABORT);
 
-int main(void)
-{
-	CU_pSuite ptr_suite = NULL;
+	CU_initialize_registry();
+	CU_register_suites(suites);
+	CU_basic_set_mode(CU_BRM_VERBOSE);
+	CU_basic_run_tests();
 
-	/* initialize the CUnit test registry */
-	if (CUE_SUCCESS != CU_initialize_registry())
-		return CU_get_error();
+	ret = CU_get_number_of_failure_records();
 
-	/* add the tests to the queue suite */
-	ptr_suite = CU_add_suite(__FILE__, init_suite, finalize);
-	if (NULL == ptr_suite) {
-		CU_cleanup_registry();
-		return CU_get_error();
-	}
+	CU_cleanup_registry();
 
-	if (NULL == CU_ADD_TEST(ptr_suite, test_odp_queue_sunnyday)) {
-		CU_cleanup_registry();
-		return CU_get_error();
-	}
+	odp_term_local();
+	odp_term_global();
 
-	/* Run all tests using the CUnit Basic interface */
-	CU_basic_set_mode(CU_BRM_VERBOSE);
-	CU_basic_run_tests();
-	CU_cleanup_registry();
-	return CU_get_error();
+	return ret;
 }