diff mbox

[v2] test: Display implementation version

Message ID 1416859890-59963-1-git-send-email-mike.holmes@linaro.org
State Accepted
Commit 4a64ecca19e44edc6f9ac1926dbc823fb6928ace
Headers show

Commit Message

Mike Holmes Nov. 24, 2014, 8:11 p.m. UTC
Signed-off-by: Mike Holmes <mike.holmes@linaro.org>
---
 test/validation/odp_crypto.c | 11 +++++++++--
 test/validation/odp_init.c   |  7 ++++---
 test/validation/odp_queue.c  |  7 +++++--
 3 files changed, 18 insertions(+), 7 deletions(-)

Comments

Maxim Uvarov Nov. 25, 2014, 11:58 a.m. UTC | #1
Ok, merged that version.

Maxim.

On 11/24/2014 11:11 PM, Mike Holmes wrote:
> Signed-off-by: Mike Holmes <mike.holmes@linaro.org>
> ---
>   test/validation/odp_crypto.c | 11 +++++++++--
>   test/validation/odp_init.c   |  7 ++++---
>   test/validation/odp_queue.c  |  7 +++++--
>   3 files changed, 18 insertions(+), 7 deletions(-)
>
> diff --git a/test/validation/odp_crypto.c b/test/validation/odp_crypto.c
> index 985302a..9342aca 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 API version: %s\n", odp_version_api_str());
> +	printf("\tODP implementation version: %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..aa7439d 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 API version: %s\n", odp_version_api_str());
> +	printf("\tODP implementation version: %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..09dba0e 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 API version: %s\n", odp_version_api_str());
> +	printf("\tODP implementation version: %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();
Taras Kondratiuk Nov. 25, 2014, 12:11 p.m. UTC | #2
On 11/24/2014 10:11 PM, Mike Holmes wrote:
> Signed-off-by: Mike Holmes <mike.holmes@linaro.org>
> ---
>   test/validation/odp_crypto.c | 11 +++++++++--
>   test/validation/odp_init.c   |  7 ++++---
>   test/validation/odp_queue.c  |  7 +++++--
>   3 files changed, 18 insertions(+), 7 deletions(-)
>
> diff --git a/test/validation/odp_crypto.c b/test/validation/odp_crypto.c
> index 985302a..9342aca 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 API version: %s\n", odp_version_api_str());
> +	printf("\tODP implementation version: %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..aa7439d 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 API version: %s\n", odp_version_api_str());
> +	printf("\tODP implementation version: %s\n", odp_version_impl_str());

Suite init function should perform necessary actions to prepare system 
for a suit execution. Printing ODP info has nothing to do with this.
Also this information is the same for all test suites, so normally it 
should be printed directly from main().
Mike Holmes Nov. 25, 2014, 1:34 p.m. UTC | #3
On 25 November 2014 at 07:11, Taras Kondratiuk <taras.kondratiuk@linaro.org>
wrote:

> On 11/24/2014 10:11 PM, Mike Holmes wrote:
>
>> Signed-off-by: Mike Holmes <mike.holmes@linaro.org>
>> ---
>>   test/validation/odp_crypto.c | 11 +++++++++--
>>   test/validation/odp_init.c   |  7 ++++---
>>   test/validation/odp_queue.c  |  7 +++++--
>>   3 files changed, 18 insertions(+), 7 deletions(-)
>>
>> diff --git a/test/validation/odp_crypto.c b/test/validation/odp_crypto.c
>> index 985302a..9342aca 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 API version: %s\n", odp_version_api_str());
>> +       printf("\tODP implementation version: %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..aa7439d 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 API version: %s\n", odp_version_api_str());
>> +       printf("\tODP implementation version: %s\n",
>> odp_version_impl_str());
>>
>
> Suite init function should perform necessary actions to prepare system for
> a suit execution. Printing ODP info has nothing to do with this.
> Also this information is the same for all test suites, so normally it
> should be printed directly from main().
>


When we merge this into a library to facilitate the arbitrary execution of
suites main will not necessarily be called. A suite might be called from
one of the interactive CUnit shells or GUI and main will not be present
except for the batch processing case.
Taras Kondratiuk Nov. 25, 2014, 1:55 p.m. UTC | #4
On 11/25/2014 03:34 PM, Mike Holmes wrote:
>
>
> On 25 November 2014 at 07:11, Taras Kondratiuk
> <taras.kondratiuk@linaro.org <mailto:taras.kondratiuk@linaro.org>> wrote:
>         diff --git a/test/validation/odp_init.c b/test/validation/odp_init.c
>         index 88e6235..aa7439d 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 API version: %s\n", odp_version_api_str());
>         +       printf("\tODP implementation version: %s\n",
>         odp_version_impl_str());
>
>
>     Suite init function should perform necessary actions to prepare
>     system for a suit execution. Printing ODP info has nothing to do
>     with this.
>     Also this information is the same for all test suites, so normally
>     it should be printed directly from main().
>
>
>
> When we merge this into a library to facilitate the arbitrary execution
> of suites main will not necessarily be called. A suite might be called
> from one of the interactive CUnit shells or GUI and main will not be
> present except for the batch processing case.

I'm not sure I get your point. main() will be called in any way.

Actually my comment is relevant especially for the interactive mode.
I'd expect to see this info printed on a start of interactive mode
(before any test started), but not on each invocation of a testsuite.
diff mbox

Patch

diff --git a/test/validation/odp_crypto.c b/test/validation/odp_crypto.c
index 985302a..9342aca 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 API version: %s\n", odp_version_api_str());
+	printf("\tODP implementation version: %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..aa7439d 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 API version: %s\n", odp_version_api_str());
+	printf("\tODP implementation version: %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..09dba0e 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 API version: %s\n", odp_version_api_str());
+	printf("\tODP implementation version: %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();