diff mbox

test: Display implementation version

Message ID 1416601014-61601-1-git-send-email-mike.holmes@linaro.org
State Rejected
Headers show

Commit Message

Mike Holmes Nov. 21, 2014, 8:16 p.m. UTC
Ensure that when run each test suite displays the ODP API and
implementation strings immediately after the CUnit version string

Signed-off-by: Mike Holmes <mike.holmes@linaro.org>
---
 test/validation/odp_crypto.c | 11 +++++++++--
 test/validation/odp_init.c   |  5 +++--
 test/validation/odp_queue.c  |  7 +++++--
 3 files changed, 17 insertions(+), 6 deletions(-)

Comments

Mike Holmes Nov. 24, 2014, 4:14 p.m. UTC | #1
Ping

On 21 November 2014 15:16, Mike Holmes <mike.holmes@linaro.org> wrote:
> Ensure that when run each test suite displays the ODP API and
> implementation strings immediately after the CUnit version string
>
> Signed-off-by: Mike Holmes <mike.holmes@linaro.org>
> ---
>  test/validation/odp_crypto.c | 11 +++++++++--
>  test/validation/odp_init.c   |  5 +++--
>  test/validation/odp_queue.c  |  7 +++++--
>  3 files changed, 17 insertions(+), 6 deletions(-)
>
> diff --git a/test/validation/odp_crypto.c b/test/validation/odp_crypto.c
> index 985302a..dd3784f 100644
> --- a/test/validation/odp_crypto.c
> +++ b/test/validation/odp_crypto.c
> @@ -16,9 +16,16 @@
>  #define SHM_COMPL_POOL_SIZE    (128*1024)
>  #define SHM_COMPL_POOL_BUF_SIZE        128
>
> +static int init_suite(void)
> +{
> +       printf("\tODP version: %s\n", odp_version_api_str());
> +       printf("\tODP implementation: %s\n", odp_version_impl_str());
> +       return 0;
> +}
> +
>  CU_SuiteInfo suites[] = {
> -       { ODP_CRYPTO_SYNC_INP , NULL, NULL, NULL, NULL, test_array_sync },
> -       { ODP_CRYPTO_ASYNC_INP , NULL, NULL, NULL, NULL, test_array_async },
> +       {ODP_CRYPTO_SYNC_INP, init_suite, NULL, NULL, NULL, test_array_sync },
> +       {ODP_CRYPTO_ASYNC_INP, init_suite, NULL, NULL, NULL, test_array_async },
>         CU_SUITE_INFO_NULL,
>  };
>
> diff --git a/test/validation/odp_init.c b/test/validation/odp_init.c
> index 88e6235..538f30e 100644
> --- a/test/validation/odp_init.c
> +++ b/test/validation/odp_init.c
> @@ -20,9 +20,10 @@ static void test_odp_init_global(void)
>         CU_ASSERT(status == 0);
>  }
>
> -static int init(void)
> +static int init_suite(void)
>  {
>         printf("\tODP version: %s\n", odp_version_api_str());
> +       printf("\tODP implementation: %s\n", odp_version_impl_str());
>         return 0;
>  }
>
> @@ -38,7 +39,7 @@ int main(void)
>         if (CUE_SUCCESS != CU_initialize_registry())
>                 return CU_get_error();
>         /* add a suite to the registry */
> -       ptr_suite = CU_add_suite(__FILE__, init, finalise);
> +       ptr_suite = CU_add_suite(__FILE__, init_suite, finalise);
>         if (NULL == ptr_suite) {
>                 CU_cleanup_registry();
>                 return CU_get_error();
> diff --git a/test/validation/odp_queue.c b/test/validation/odp_queue.c
> index 4d233e0..bced19e 100644
> --- a/test/validation/odp_queue.c
> +++ b/test/validation/odp_queue.c
> @@ -105,8 +105,11 @@ static void test_odp_queue_sunnyday(void)
>         return;
>  }
>
> -static int init(void)
> +static int init_suite(void)
>  {
> +       printf("\tODP version: %s\n", odp_version_api_str());
> +       printf("\tODP implementation: %s\n", odp_version_impl_str());
> +
>         if (0 != odp_init_global(NULL, NULL)) {
>                 printf("odp_init_global fail.\n");
>                 return -1;
> @@ -138,7 +141,7 @@ int main(void)
>                 return CU_get_error();
>
>         /* add the tests to the queue suite */
> -       ptr_suite = CU_add_suite(__FILE__, init, finalize);
> +       ptr_suite = CU_add_suite(__FILE__, init_suite, finalize);
>         if (NULL == ptr_suite) {
>                 CU_cleanup_registry();
>                 return CU_get_error();
> --
> 2.1.0
>
Maxim Uvarov Nov. 24, 2014, 6:45 p.m. UTC | #2
On 11/21/2014 11:16 PM, Mike Holmes wrote:
> Ensure that when run each test suite displays the ODP API and
> implementation strings immediately after the CUnit version string
>
> Signed-off-by: Mike Holmes <mike.holmes@linaro.org>
> ---
>   test/validation/odp_crypto.c | 11 +++++++++--
>   test/validation/odp_init.c   |  5 +++--
>   test/validation/odp_queue.c  |  7 +++++--
>   3 files changed, 17 insertions(+), 6 deletions(-)
>
> diff --git a/test/validation/odp_crypto.c b/test/validation/odp_crypto.c
> index 985302a..dd3784f 100644
> --- a/test/validation/odp_crypto.c
> +++ b/test/validation/odp_crypto.c
> @@ -16,9 +16,16 @@
>   #define SHM_COMPL_POOL_SIZE	(128*1024)
>   #define SHM_COMPL_POOL_BUF_SIZE	128
>   
> +static int init_suite(void)
> +{
> +	printf("\tODP version: %s\n", odp_version_api_str());
> +	printf("\tODP implementation: %s\n", odp_version_impl_str());
Current output:

     ODP version: 0.3.0
     ODP implementation: 0

I think we need specify more clear. Like:
"ODP API version: 0.3.0"
"ODP Platform: linux-generic"
"ODP Implementation version: 0"
test date (optional).

I.e.
1) add platform name.
2) add words "version" and "API"  to printed message.

Maxim.


> +	return 0;
> +}
> +
>   CU_SuiteInfo suites[] = {
> -	{ ODP_CRYPTO_SYNC_INP , NULL, NULL, NULL, NULL, test_array_sync },
> -	{ ODP_CRYPTO_ASYNC_INP , NULL, NULL, NULL, NULL, test_array_async },
> +	{ODP_CRYPTO_SYNC_INP, init_suite, NULL, NULL, NULL, test_array_sync },
> +	{ODP_CRYPTO_ASYNC_INP, init_suite, NULL, NULL, NULL, test_array_async },
>   	CU_SUITE_INFO_NULL,
>   };
>   
> diff --git a/test/validation/odp_init.c b/test/validation/odp_init.c
> index 88e6235..538f30e 100644
> --- a/test/validation/odp_init.c
> +++ b/test/validation/odp_init.c
> @@ -20,9 +20,10 @@ static void test_odp_init_global(void)
>   	CU_ASSERT(status == 0);
>   }
>   
> -static int init(void)
> +static int init_suite(void)
>   {
>   	printf("\tODP version: %s\n", odp_version_api_str());
> +	printf("\tODP implementation: %s\n", odp_version_impl_str());
>   	return 0;
>   }
>   
> @@ -38,7 +39,7 @@ int main(void)
>   	if (CUE_SUCCESS != CU_initialize_registry())
>   		return CU_get_error();
>   	/* add a suite to the registry */
> -	ptr_suite = CU_add_suite(__FILE__, init, finalise);
> +	ptr_suite = CU_add_suite(__FILE__, init_suite, finalise);
>   	if (NULL == ptr_suite) {
>   		CU_cleanup_registry();
>   		return CU_get_error();
> diff --git a/test/validation/odp_queue.c b/test/validation/odp_queue.c
> index 4d233e0..bced19e 100644
> --- a/test/validation/odp_queue.c
> +++ b/test/validation/odp_queue.c
> @@ -105,8 +105,11 @@ static void test_odp_queue_sunnyday(void)
>   	return;
>   }
>   
> -static int init(void)
> +static int init_suite(void)
>   {
> +	printf("\tODP version: %s\n", odp_version_api_str());
> +	printf("\tODP implementation: %s\n", odp_version_impl_str());
> +
>   	if (0 != odp_init_global(NULL, NULL)) {
>   		printf("odp_init_global fail.\n");
>   		return -1;
> @@ -138,7 +141,7 @@ int main(void)
>   		return CU_get_error();
>   
>   	/* add the tests to the queue suite */
> -	ptr_suite = CU_add_suite(__FILE__, init, finalize);
> +	ptr_suite = CU_add_suite(__FILE__, init_suite, finalize);
>   	if (NULL == ptr_suite) {
>   		CU_cleanup_registry();
>   		return CU_get_error();
Mike Holmes Nov. 24, 2014, 7 p.m. UTC | #3
On 24 November 2014 13:45, Maxim Uvarov <maxim.uvarov@linaro.org> wrote:

> On 11/21/2014 11:16 PM, Mike Holmes wrote:
>
>> Ensure that when run each test suite displays the ODP API and
>> implementation strings immediately after the CUnit version string
>>
>> Signed-off-by: Mike Holmes <mike.holmes@linaro.org>
>> ---
>>   test/validation/odp_crypto.c | 11 +++++++++--
>>   test/validation/odp_init.c   |  5 +++--
>>   test/validation/odp_queue.c  |  7 +++++--
>>   3 files changed, 17 insertions(+), 6 deletions(-)
>>
>> diff --git a/test/validation/odp_crypto.c b/test/validation/odp_crypto.c
>> index 985302a..dd3784f 100644
>> --- a/test/validation/odp_crypto.c
>> +++ b/test/validation/odp_crypto.c
>> @@ -16,9 +16,16 @@
>>   #define SHM_COMPL_POOL_SIZE   (128*1024)
>>   #define SHM_COMPL_POOL_BUF_SIZE       128
>>   +static int init_suite(void)
>> +{
>> +       printf("\tODP version: %s\n", odp_version_api_str());
>> +       printf("\tODP implementation: %s\n", odp_version_impl_str());
>>
> Current output:
>
>     ODP version: 0.3.0
>     ODP implementation: 0
>
> I think we need specify more clear. Like:
> "ODP API version: 0.3.0"
> "ODP Platform: linux-generic"
> "ODP Implementation version: 0"
> test date (optional).
>
> I.e.
> 1) add platform name.
> 2) add words "version" and "API"  to printed message.
>
>
No problem, will fix


> Maxim.
>
>
>
>  +       return 0;
>> +}
>> +
>>   CU_SuiteInfo suites[] = {
>> -       { ODP_CRYPTO_SYNC_INP , NULL, NULL, NULL, NULL, test_array_sync },
>> -       { ODP_CRYPTO_ASYNC_INP , NULL, NULL, NULL, NULL, test_array_async
>> },
>> +       {ODP_CRYPTO_SYNC_INP, init_suite, NULL, NULL, NULL,
>> test_array_sync },
>> +       {ODP_CRYPTO_ASYNC_INP, init_suite, NULL, NULL, NULL,
>> test_array_async },
>>         CU_SUITE_INFO_NULL,
>>   };
>>   diff --git a/test/validation/odp_init.c b/test/validation/odp_init.c
>> index 88e6235..538f30e 100644
>> --- a/test/validation/odp_init.c
>> +++ b/test/validation/odp_init.c
>> @@ -20,9 +20,10 @@ static void test_odp_init_global(void)
>>         CU_ASSERT(status == 0);
>>   }
>>   -static int init(void)
>> +static int init_suite(void)
>>   {
>>         printf("\tODP version: %s\n", odp_version_api_str());
>> +       printf("\tODP implementation: %s\n", odp_version_impl_str());
>>         return 0;
>>   }
>>   @@ -38,7 +39,7 @@ int main(void)
>>         if (CUE_SUCCESS != CU_initialize_registry())
>>                 return CU_get_error();
>>         /* add a suite to the registry */
>> -       ptr_suite = CU_add_suite(__FILE__, init, finalise);
>> +       ptr_suite = CU_add_suite(__FILE__, init_suite, finalise);
>>         if (NULL == ptr_suite) {
>>                 CU_cleanup_registry();
>>                 return CU_get_error();
>> diff --git a/test/validation/odp_queue.c b/test/validation/odp_queue.c
>> index 4d233e0..bced19e 100644
>> --- a/test/validation/odp_queue.c
>> +++ b/test/validation/odp_queue.c
>> @@ -105,8 +105,11 @@ static void test_odp_queue_sunnyday(void)
>>         return;
>>   }
>>   -static int init(void)
>> +static int init_suite(void)
>>   {
>> +       printf("\tODP version: %s\n", odp_version_api_str());
>> +       printf("\tODP implementation: %s\n", odp_version_impl_str());
>> +
>>         if (0 != odp_init_global(NULL, NULL)) {
>>                 printf("odp_init_global fail.\n");
>>                 return -1;
>> @@ -138,7 +141,7 @@ int main(void)
>>                 return CU_get_error();
>>         /* add the tests to the queue suite */
>> -       ptr_suite = CU_add_suite(__FILE__, init, finalize);
>> +       ptr_suite = CU_add_suite(__FILE__, init_suite, finalize);
>>         if (NULL == ptr_suite) {
>>                 CU_cleanup_registry();
>>                 return CU_get_error();
>>
>
>
> _______________________________________________
> lng-odp mailing list
> lng-odp@lists.linaro.org
> http://lists.linaro.org/mailman/listinfo/lng-odp
>
Mike Holmes Nov. 24, 2014, 8:04 p.m. UTC | #4
I thought about this a little more, to add the "linux-generic" into
the test results is a problem.

The test suite should link with any library it is pointed at and the
library does not carry the information about which platform it is
built for inside itself, that is a ./configure attribute only.

I can add API to the output text without an issue,  but adding the
platform label to the odp library just for tests to display it is a
mistake I think.
Worse it would require a new public API or reliance on some hidden
symbol all platforms must export.

On 24 November 2014 14:00, Mike Holmes <mike.holmes@linaro.org> wrote:
>
>
> On 24 November 2014 13:45, Maxim Uvarov <maxim.uvarov@linaro.org> wrote:
>>
>> On 11/21/2014 11:16 PM, Mike Holmes wrote:
>>>
>>> Ensure that when run each test suite displays the ODP API and
>>> implementation strings immediately after the CUnit version string
>>>
>>> Signed-off-by: Mike Holmes <mike.holmes@linaro.org>
>>> ---
>>>   test/validation/odp_crypto.c | 11 +++++++++--
>>>   test/validation/odp_init.c   |  5 +++--
>>>   test/validation/odp_queue.c  |  7 +++++--
>>>   3 files changed, 17 insertions(+), 6 deletions(-)
>>>
>>> diff --git a/test/validation/odp_crypto.c b/test/validation/odp_crypto.c
>>> index 985302a..dd3784f 100644
>>> --- a/test/validation/odp_crypto.c
>>> +++ b/test/validation/odp_crypto.c
>>> @@ -16,9 +16,16 @@
>>>   #define SHM_COMPL_POOL_SIZE   (128*1024)
>>>   #define SHM_COMPL_POOL_BUF_SIZE       128
>>>   +static int init_suite(void)
>>> +{
>>> +       printf("\tODP version: %s\n", odp_version_api_str());
>>> +       printf("\tODP implementation: %s\n", odp_version_impl_str());
>>
>> Current output:
>>
>>     ODP version: 0.3.0
>>     ODP implementation: 0
>>
>> I think we need specify more clear. Like:
>> "ODP API version: 0.3.0"
>> "ODP Platform: linux-generic"
>> "ODP Implementation version: 0"
>> test date (optional).
>>
>> I.e.
>> 1) add platform name.
>> 2) add words "version" and "API"  to printed message.
>>
>
> No problem, will fix
>
>>
>> Maxim.
>>
>>
>>
>>> +       return 0;
>>> +}
>>> +
>>>   CU_SuiteInfo suites[] = {
>>> -       { ODP_CRYPTO_SYNC_INP , NULL, NULL, NULL, NULL, test_array_sync
>>> },
>>> -       { ODP_CRYPTO_ASYNC_INP , NULL, NULL, NULL, NULL, test_array_async
>>> },
>>> +       {ODP_CRYPTO_SYNC_INP, init_suite, NULL, NULL, NULL,
>>> test_array_sync },
>>> +       {ODP_CRYPTO_ASYNC_INP, init_suite, NULL, NULL, NULL,
>>> test_array_async },
>>>         CU_SUITE_INFO_NULL,
>>>   };
>>>   diff --git a/test/validation/odp_init.c b/test/validation/odp_init.c
>>> index 88e6235..538f30e 100644
>>> --- a/test/validation/odp_init.c
>>> +++ b/test/validation/odp_init.c
>>> @@ -20,9 +20,10 @@ static void test_odp_init_global(void)
>>>         CU_ASSERT(status == 0);
>>>   }
>>>   -static int init(void)
>>> +static int init_suite(void)
>>>   {
>>>         printf("\tODP version: %s\n", odp_version_api_str());
>>> +       printf("\tODP implementation: %s\n", odp_version_impl_str());
>>>         return 0;
>>>   }
>>>   @@ -38,7 +39,7 @@ int main(void)
>>>         if (CUE_SUCCESS != CU_initialize_registry())
>>>                 return CU_get_error();
>>>         /* add a suite to the registry */
>>> -       ptr_suite = CU_add_suite(__FILE__, init, finalise);
>>> +       ptr_suite = CU_add_suite(__FILE__, init_suite, finalise);
>>>         if (NULL == ptr_suite) {
>>>                 CU_cleanup_registry();
>>>                 return CU_get_error();
>>> diff --git a/test/validation/odp_queue.c b/test/validation/odp_queue.c
>>> index 4d233e0..bced19e 100644
>>> --- a/test/validation/odp_queue.c
>>> +++ b/test/validation/odp_queue.c
>>> @@ -105,8 +105,11 @@ static void test_odp_queue_sunnyday(void)
>>>         return;
>>>   }
>>>   -static int init(void)
>>> +static int init_suite(void)
>>>   {
>>> +       printf("\tODP version: %s\n", odp_version_api_str());
>>> +       printf("\tODP implementation: %s\n", odp_version_impl_str());
>>> +
>>>         if (0 != odp_init_global(NULL, NULL)) {
>>>                 printf("odp_init_global fail.\n");
>>>                 return -1;
>>> @@ -138,7 +141,7 @@ int main(void)
>>>                 return CU_get_error();
>>>         /* add the tests to the queue suite */
>>> -       ptr_suite = CU_add_suite(__FILE__, init, finalize);
>>> +       ptr_suite = CU_add_suite(__FILE__, init_suite, finalize);
>>>         if (NULL == ptr_suite) {
>>>                 CU_cleanup_registry();
>>>                 return CU_get_error();
>>
>>
>>
>> _______________________________________________
>> lng-odp mailing list
>> lng-odp@lists.linaro.org
>> http://lists.linaro.org/mailman/listinfo/lng-odp
>
>
>
>
> --
> Mike Holmes
> Linaro  Sr Technical Manager
> LNG - ODP
diff mbox

Patch

diff --git a/test/validation/odp_crypto.c b/test/validation/odp_crypto.c
index 985302a..dd3784f 100644
--- a/test/validation/odp_crypto.c
+++ b/test/validation/odp_crypto.c
@@ -16,9 +16,16 @@ 
 #define SHM_COMPL_POOL_SIZE	(128*1024)
 #define SHM_COMPL_POOL_BUF_SIZE	128
 
+static int init_suite(void)
+{
+	printf("\tODP version: %s\n", odp_version_api_str());
+	printf("\tODP implementation: %s\n", odp_version_impl_str());
+	return 0;
+}
+
 CU_SuiteInfo suites[] = {
-	{ ODP_CRYPTO_SYNC_INP , NULL, NULL, NULL, NULL, test_array_sync },
-	{ ODP_CRYPTO_ASYNC_INP , NULL, NULL, NULL, NULL, test_array_async },
+	{ODP_CRYPTO_SYNC_INP, init_suite, NULL, NULL, NULL, test_array_sync },
+	{ODP_CRYPTO_ASYNC_INP, init_suite, NULL, NULL, NULL, test_array_async },
 	CU_SUITE_INFO_NULL,
 };
 
diff --git a/test/validation/odp_init.c b/test/validation/odp_init.c
index 88e6235..538f30e 100644
--- a/test/validation/odp_init.c
+++ b/test/validation/odp_init.c
@@ -20,9 +20,10 @@  static void test_odp_init_global(void)
 	CU_ASSERT(status == 0);
 }
 
-static int init(void)
+static int init_suite(void)
 {
 	printf("\tODP version: %s\n", odp_version_api_str());
+	printf("\tODP implementation: %s\n", odp_version_impl_str());
 	return 0;
 }
 
@@ -38,7 +39,7 @@  int main(void)
 	if (CUE_SUCCESS != CU_initialize_registry())
 		return CU_get_error();
 	/* add a suite to the registry */
-	ptr_suite = CU_add_suite(__FILE__, init, finalise);
+	ptr_suite = CU_add_suite(__FILE__, init_suite, finalise);
 	if (NULL == ptr_suite) {
 		CU_cleanup_registry();
 		return CU_get_error();
diff --git a/test/validation/odp_queue.c b/test/validation/odp_queue.c
index 4d233e0..bced19e 100644
--- a/test/validation/odp_queue.c
+++ b/test/validation/odp_queue.c
@@ -105,8 +105,11 @@  static void test_odp_queue_sunnyday(void)
 	return;
 }
 
-static int init(void)
+static int init_suite(void)
 {
+	printf("\tODP version: %s\n", odp_version_api_str());
+	printf("\tODP implementation: %s\n", odp_version_impl_str());
+
 	if (0 != odp_init_global(NULL, NULL)) {
 		printf("odp_init_global fail.\n");
 		return -1;
@@ -138,7 +141,7 @@  int main(void)
 		return CU_get_error();
 
 	/* add the tests to the queue suite */
-	ptr_suite = CU_add_suite(__FILE__, init, finalize);
+	ptr_suite = CU_add_suite(__FILE__, init_suite, finalize);
 	if (NULL == ptr_suite) {
 		CU_cleanup_registry();
 		return CU_get_error();