[API-NEXT,v2,5/5] validation: add test for new per_CPU system APIs

Message ID 1435833923-28361-6-git-send-email-hongbo.zhang@freescale.com
State New
Headers show

Commit Message

hongbo.zhang@freescale.com July 2, 2015, 10:45 a.m.
From: Hongbo Zhang <hongbo.zhang@linaro.org>

This patch adds test for the newly introduced per-CPU system APIs:
odp_sys_cpu_model_str_amp()
odp_sys_cpu_hz_amp()
odp_sys_cpu_hz_current()

Signed-off-by: Hongbo Zhang <hongbo.zhang@linaro.org>
---
 test/validation/ver_abt_log_dbg/odp_system.c | 28 ++++++++++++++++++++++++++++
 1 file changed, 28 insertions(+)

Comments

Mike Holmes July 2, 2015, 7:08 p.m. | #1
On 2 July 2015 at 06:45, <hongbo.zhang@freescale.com> wrote:

> From: Hongbo Zhang <hongbo.zhang@linaro.org>
>
> This patch adds test for the newly introduced per-CPU system APIs:
> odp_sys_cpu_model_str_amp()
> odp_sys_cpu_hz_amp()
> odp_sys_cpu_hz_current()
>
> Signed-off-by: Hongbo Zhang <hongbo.zhang@linaro.org>
> ---
>  test/validation/ver_abt_log_dbg/odp_system.c | 28
> ++++++++++++++++++++++++++++
>  1 file changed, 28 insertions(+)
>
> diff --git a/test/validation/ver_abt_log_dbg/odp_system.c
> b/test/validation/ver_abt_log_dbg/odp_system.c
> index 5185a71..1e5205c 100644
> --- a/test/validation/ver_abt_log_dbg/odp_system.c
> +++ b/test/validation/ver_abt_log_dbg/odp_system.c
> @@ -57,6 +57,15 @@ static void test_odp_sys_cpu_model_str(void)
>         CU_ASSERT(strlen(model) < 127);
>  }
>
> +static void test_odp_sys_cpu_model_str_amp(void)
> +{
> +       char model[128];
> +
> +       snprintf(model, 128, "%s", odp_sys_cpu_model_str_amp(0));
> +       CU_ASSERT(strlen(model) > 0);
> +       CU_ASSERT(strlen(model) < 127);
> +}
> +
>  static void test_odp_sys_page_size(void)
>  {
>         uint64_t page;
> @@ -82,13 +91,32 @@ static void test_odp_sys_cpu_hz(void)
>         CU_ASSERT(0 < hz);
>  }
>
> +static void test_odp_sys_cpu_hz_amp(void)
> +{
> +       uint64_t hz;
> +
> +       hz = odp_sys_cpu_hz_amp(0);
>

This should iterate over all the available cores


> +       CU_ASSERT(0 < hz);
> +}
> +
> +static void test_odp_sys_cpu_hz_current(void)
> +{
> +       uint64_t hz;
> +
> +       hz = odp_sys_cpu_hz_current();
> +       CU_ASSERT(0 < hz);
> +}
> +

 CU_TestInfo test_odp_system[] = {
>         {"odp version",  test_odp_version_numbers},
>         {"odp_cpu_count",  test_odp_cpu_count},
>         {"odp_sys_cache_line_size",  test_odp_sys_cache_line_size},
>         {"odp_sys_cpu_model_str",  test_odp_sys_cpu_model_str},
> +       {"odp_sys_cpu_model_str_amp",  test_odp_sys_cpu_model_str_amp},
>         {"odp_sys_page_size",  test_odp_sys_page_size},
>         {"odp_sys_huge_page_size",  test_odp_sys_huge_page_size},
>         {"odp_sys_cpu_hz",  test_odp_sys_cpu_hz},
> +       {"odp_sys_cpu_hz_amp",  test_odp_sys_cpu_hz_amp},
> +       {"odp_sys_cpu_hz_current",  test_odp_sys_cpu_hz_current},
>         CU_TEST_INFO_NULL,
>  };
> --
> 1.9.1
>
> _______________________________________________
> lng-odp mailing list
> lng-odp@lists.linaro.org
> https://lists.linaro.org/mailman/listinfo/lng-odp
>
Hongbo Zhang July 3, 2015, 6:49 a.m. | #2
On 3 July 2015 at 03:08, Mike Holmes <mike.holmes@linaro.org> wrote:
>
>
> On 2 July 2015 at 06:45, <hongbo.zhang@freescale.com> wrote:
>>
>> From: Hongbo Zhang <hongbo.zhang@linaro.org>
>>
>> This patch adds test for the newly introduced per-CPU system APIs:
>> odp_sys_cpu_model_str_amp()
>> odp_sys_cpu_hz_amp()
>> odp_sys_cpu_hz_current()
>>
>> Signed-off-by: Hongbo Zhang <hongbo.zhang@linaro.org>
>> ---
>>  test/validation/ver_abt_log_dbg/odp_system.c | 28
>> ++++++++++++++++++++++++++++
>>  1 file changed, 28 insertions(+)
>>
>> diff --git a/test/validation/ver_abt_log_dbg/odp_system.c
>> b/test/validation/ver_abt_log_dbg/odp_system.c
>> index 5185a71..1e5205c 100644
>> --- a/test/validation/ver_abt_log_dbg/odp_system.c
>> +++ b/test/validation/ver_abt_log_dbg/odp_system.c
>> @@ -57,6 +57,15 @@ static void test_odp_sys_cpu_model_str(void)
>>         CU_ASSERT(strlen(model) < 127);
>>  }
>>
>> +static void test_odp_sys_cpu_model_str_amp(void)
>> +{
>> +       char model[128];
>> +
>> +       snprintf(model, 128, "%s", odp_sys_cpu_model_str_amp(0));
>> +       CU_ASSERT(strlen(model) > 0);
>> +       CU_ASSERT(strlen(model) < 127);
>> +}
>> +
>>  static void test_odp_sys_page_size(void)
>>  {
>>         uint64_t page;
>> @@ -82,13 +91,32 @@ static void test_odp_sys_cpu_hz(void)
>>         CU_ASSERT(0 < hz);
>>  }
>>
>> +static void test_odp_sys_cpu_hz_amp(void)
>> +{
>> +       uint64_t hz;
>> +
>> +       hz = odp_sys_cpu_hz_amp(0);
>
>
> This should iterate over all the available cores
>
If on real AMP platform, it is reasonable to iterate all cores, but we
don't know which platform this code is running, so if test on SMP
system, only cpu_hz[0] is filled, all the other cores return 0 Hz, it
is strange somehow.

>>
>> +       CU_ASSERT(0 < hz);
>> +}
>> +
>> +static void test_odp_sys_cpu_hz_current(void)
>> +{
>> +       uint64_t hz;
>> +
>> +       hz = odp_sys_cpu_hz_current();
>> +       CU_ASSERT(0 < hz);
>> +}
>> +
>>
>>  CU_TestInfo test_odp_system[] = {
>>         {"odp version",  test_odp_version_numbers},
>>         {"odp_cpu_count",  test_odp_cpu_count},
>>         {"odp_sys_cache_line_size",  test_odp_sys_cache_line_size},
>>         {"odp_sys_cpu_model_str",  test_odp_sys_cpu_model_str},
>> +       {"odp_sys_cpu_model_str_amp",  test_odp_sys_cpu_model_str_amp},
>>         {"odp_sys_page_size",  test_odp_sys_page_size},
>>         {"odp_sys_huge_page_size",  test_odp_sys_huge_page_size},
>>         {"odp_sys_cpu_hz",  test_odp_sys_cpu_hz},
>> +       {"odp_sys_cpu_hz_amp",  test_odp_sys_cpu_hz_amp},
>> +       {"odp_sys_cpu_hz_current",  test_odp_sys_cpu_hz_current},
>>         CU_TEST_INFO_NULL,
>>  };
>> --
>> 1.9.1
>>
>> _______________________________________________
>> lng-odp mailing list
>> lng-odp@lists.linaro.org
>> https://lists.linaro.org/mailman/listinfo/lng-odp
>
>
>
>
> --
> Mike Holmes
> Technical Manager - Linaro Networking Group
> Linaro.org │ Open source software for ARM SoCs
>
>
>
> _______________________________________________
> lng-odp mailing list
> lng-odp@lists.linaro.org
> https://lists.linaro.org/mailman/listinfo/lng-odp
>
Hongbo Zhang July 6, 2015, 6:44 a.m. | #3
On 3 July 2015 at 14:49, Hongbo Zhang <hongbo.zhang@linaro.org> wrote:
> On 3 July 2015 at 03:08, Mike Holmes <mike.holmes@linaro.org> wrote:
>>
>>
>> On 2 July 2015 at 06:45, <hongbo.zhang@freescale.com> wrote:
>>>
>>> From: Hongbo Zhang <hongbo.zhang@linaro.org>
>>>
>>> This patch adds test for the newly introduced per-CPU system APIs:
>>> odp_sys_cpu_model_str_amp()
>>> odp_sys_cpu_hz_amp()
>>> odp_sys_cpu_hz_current()
>>>
>>> Signed-off-by: Hongbo Zhang <hongbo.zhang@linaro.org>
>>> ---
>>>  test/validation/ver_abt_log_dbg/odp_system.c | 28
>>> ++++++++++++++++++++++++++++
>>>  1 file changed, 28 insertions(+)
>>>
>>> diff --git a/test/validation/ver_abt_log_dbg/odp_system.c
>>> b/test/validation/ver_abt_log_dbg/odp_system.c
>>> index 5185a71..1e5205c 100644
>>> --- a/test/validation/ver_abt_log_dbg/odp_system.c
>>> +++ b/test/validation/ver_abt_log_dbg/odp_system.c
>>> @@ -57,6 +57,15 @@ static void test_odp_sys_cpu_model_str(void)
>>>         CU_ASSERT(strlen(model) < 127);
>>>  }
>>>
>>> +static void test_odp_sys_cpu_model_str_amp(void)
>>> +{
>>> +       char model[128];
>>> +
>>> +       snprintf(model, 128, "%s", odp_sys_cpu_model_str_amp(0));
>>> +       CU_ASSERT(strlen(model) > 0);
>>> +       CU_ASSERT(strlen(model) < 127);
>>> +}
>>> +
>>>  static void test_odp_sys_page_size(void)
>>>  {
>>>         uint64_t page;
>>> @@ -82,13 +91,32 @@ static void test_odp_sys_cpu_hz(void)
>>>         CU_ASSERT(0 < hz);
>>>  }
>>>
>>> +static void test_odp_sys_cpu_hz_amp(void)
>>> +{
>>> +       uint64_t hz;
>>> +
>>> +       hz = odp_sys_cpu_hz_amp(0);
>>
>>
>> This should iterate over all the available cores
>>
> If on real AMP platform, it is reasonable to iterate all cores, but we
> don't know which platform this code is running, so if test on SMP
> system, only cpu_hz[0] is filled, all the other cores return 0 Hz, it
> is strange somehow.
>

While, think it again, if on AMP platform, if we only test core 0,
advantage of this now API won't show up, so will iterate all available
cores.

>>>
>>> +       CU_ASSERT(0 < hz);
>>> +}
>>> +
>>> +static void test_odp_sys_cpu_hz_current(void)
>>> +{
>>> +       uint64_t hz;
>>> +
>>> +       hz = odp_sys_cpu_hz_current();
>>> +       CU_ASSERT(0 < hz);
>>> +}
>>> +
>>>
>>>  CU_TestInfo test_odp_system[] = {
>>>         {"odp version",  test_odp_version_numbers},
>>>         {"odp_cpu_count",  test_odp_cpu_count},
>>>         {"odp_sys_cache_line_size",  test_odp_sys_cache_line_size},
>>>         {"odp_sys_cpu_model_str",  test_odp_sys_cpu_model_str},
>>> +       {"odp_sys_cpu_model_str_amp",  test_odp_sys_cpu_model_str_amp},
>>>         {"odp_sys_page_size",  test_odp_sys_page_size},
>>>         {"odp_sys_huge_page_size",  test_odp_sys_huge_page_size},
>>>         {"odp_sys_cpu_hz",  test_odp_sys_cpu_hz},
>>> +       {"odp_sys_cpu_hz_amp",  test_odp_sys_cpu_hz_amp},
>>> +       {"odp_sys_cpu_hz_current",  test_odp_sys_cpu_hz_current},
>>>         CU_TEST_INFO_NULL,
>>>  };
>>> --
>>> 1.9.1
>>>
>>> _______________________________________________
>>> lng-odp mailing list
>>> lng-odp@lists.linaro.org
>>> https://lists.linaro.org/mailman/listinfo/lng-odp
>>
>>
>>
>>
>> --
>> Mike Holmes
>> Technical Manager - Linaro Networking Group
>> Linaro.org │ Open source software for ARM SoCs
>>
>>
>>
>> _______________________________________________
>> lng-odp mailing list
>> lng-odp@lists.linaro.org
>> https://lists.linaro.org/mailman/listinfo/lng-odp
>>

Patch

diff --git a/test/validation/ver_abt_log_dbg/odp_system.c b/test/validation/ver_abt_log_dbg/odp_system.c
index 5185a71..1e5205c 100644
--- a/test/validation/ver_abt_log_dbg/odp_system.c
+++ b/test/validation/ver_abt_log_dbg/odp_system.c
@@ -57,6 +57,15 @@  static void test_odp_sys_cpu_model_str(void)
 	CU_ASSERT(strlen(model) < 127);
 }
 
+static void test_odp_sys_cpu_model_str_amp(void)
+{
+	char model[128];
+
+	snprintf(model, 128, "%s", odp_sys_cpu_model_str_amp(0));
+	CU_ASSERT(strlen(model) > 0);
+	CU_ASSERT(strlen(model) < 127);
+}
+
 static void test_odp_sys_page_size(void)
 {
 	uint64_t page;
@@ -82,13 +91,32 @@  static void test_odp_sys_cpu_hz(void)
 	CU_ASSERT(0 < hz);
 }
 
+static void test_odp_sys_cpu_hz_amp(void)
+{
+	uint64_t hz;
+
+	hz = odp_sys_cpu_hz_amp(0);
+	CU_ASSERT(0 < hz);
+}
+
+static void test_odp_sys_cpu_hz_current(void)
+{
+	uint64_t hz;
+
+	hz = odp_sys_cpu_hz_current();
+	CU_ASSERT(0 < hz);
+}
+
 CU_TestInfo test_odp_system[] = {
 	{"odp version",  test_odp_version_numbers},
 	{"odp_cpu_count",  test_odp_cpu_count},
 	{"odp_sys_cache_line_size",  test_odp_sys_cache_line_size},
 	{"odp_sys_cpu_model_str",  test_odp_sys_cpu_model_str},
+	{"odp_sys_cpu_model_str_amp",  test_odp_sys_cpu_model_str_amp},
 	{"odp_sys_page_size",  test_odp_sys_page_size},
 	{"odp_sys_huge_page_size",  test_odp_sys_huge_page_size},
 	{"odp_sys_cpu_hz",  test_odp_sys_cpu_hz},
+	{"odp_sys_cpu_hz_amp",  test_odp_sys_cpu_hz_amp},
+	{"odp_sys_cpu_hz_current",  test_odp_sys_cpu_hz_current},
 	CU_TEST_INFO_NULL,
 };