[PATCH] tools/tests: Make E2BIG non-fatal to xenstore unit test

Kevin Stefanov posted 1 patch 1 week, 2 days ago
tools/tests/xenstore/test-xenstore.c | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)

[PATCH] tools/tests: Make E2BIG non-fatal to xenstore unit test

Posted by Kevin Stefanov 1 week, 2 days ago
Xenstore's unit test fails on read and write of big numbers if
quota-maxsize is set to a lower number than those test cases use.

Output a special warning instead of a failure message in such cases
and make the error non-fatal to the unit test.

Signed-off-by: Kevin Stefanov <kevin.stefanov@citrix.com>
---
CC: Ian Jackson <iwj@xenproject.org>
CC: Wei Liu <wl@xen.org>
CC: Juergen Gross <jgross@suse.com>
CC: Julien Grall <julien@xen.org>
CC: Andrew Cooper <andrew.cooper3@citrix.com>
---
 tools/tests/xenstore/test-xenstore.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/tools/tests/xenstore/test-xenstore.c b/tools/tests/xenstore/test-xenstore.c
index d3574b3fa2..ec8c63a65d 100644
--- a/tools/tests/xenstore/test-xenstore.c
+++ b/tools/tests/xenstore/test-xenstore.c
@@ -110,8 +110,13 @@ static int call_test(struct test *tst, int iters, bool no_clock)
             break;
     }
 
-    if ( ret )
-        printf("%-10s: failed (ret = %d, stage %s)\n", tst->name, ret, stage);
+    /* Make E2BIG non-fatal to the test */
+    if ( ret ){
+	if( ret == 7 )
+            printf("%-10s: Not run - argument list too long\n", tst->name);
+        else      
+            printf("%-10s: failed (ret = %d, stage %s)\n", tst->name, ret, stage);
+    }
     else if ( !no_clock )
     {
         printf("%-10s:", tst->name);
-- 
2.25.1


Re: [PATCH] tools/tests: Make E2BIG non-fatal to xenstore unit test

Posted by Juergen Gross 1 week, 2 days ago
On 13.10.21 11:35, Kevin Stefanov wrote:
> Xenstore's unit test fails on read and write of big numbers if
> quota-maxsize is set to a lower number than those test cases use.
> 
> Output a special warning instead of a failure message in such cases
> and make the error non-fatal to the unit test.
> 
> Signed-off-by: Kevin Stefanov <kevin.stefanov@citrix.com>
> ---
> CC: Ian Jackson <iwj@xenproject.org>
> CC: Wei Liu <wl@xen.org>
> CC: Juergen Gross <jgross@suse.com>
> CC: Julien Grall <julien@xen.org>
> CC: Andrew Cooper <andrew.cooper3@citrix.com>
> ---
>   tools/tests/xenstore/test-xenstore.c | 9 +++++++--
>   1 file changed, 7 insertions(+), 2 deletions(-)
> 
> diff --git a/tools/tests/xenstore/test-xenstore.c b/tools/tests/xenstore/test-xenstore.c
> index d3574b3fa2..ec8c63a65d 100644
> --- a/tools/tests/xenstore/test-xenstore.c
> +++ b/tools/tests/xenstore/test-xenstore.c
> @@ -110,8 +110,13 @@ static int call_test(struct test *tst, int iters, bool no_clock)
>               break;
>       }
>   
> -    if ( ret )
> -        printf("%-10s: failed (ret = %d, stage %s)\n", tst->name, ret, stage);
> +    /* Make E2BIG non-fatal to the test */
> +    if ( ret ){
> +	if( ret == 7 )

Why not use E2BIG instead of the literal 7 here?

And please adhere to the coding style! There are some blanks missing and
the '{' wants to go into a separate line.

> +            printf("%-10s: Not run - argument list too long\n", tst->name);

Not setting ret to 0 here will result in Xenstore not being cleaned up
after the test.

> +        else
> +            printf("%-10s: failed (ret = %d, stage %s)\n", tst->name, ret, stage);
> +    }
>       else if ( !no_clock )
>       {
>           printf("%-10s:", tst->name);
> 


Juergen