Skip to contentSkip to conversation

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

PATCH Superseded Kevin Stefanov 2 participants 2 messages Oct 13, 2021

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

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

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.

---
CC: Ian Jackson <[email protected]>
CC: Wei Liu <[email protected]>
CC: Juergen Gross <[email protected]>
CC: Julien Grall <[email protected]>
CC: Andrew Cooper <[email protected]>

---
 tools/tests/xenstore/test-xenstore.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)
tools/tests/xenstore/test-xenstore.c +7 -2
index d3574b3fa2..ec8c63a65d 100644
@@ -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);
Signature · 1 line
2.25.1
#1 lore raw
Quoted 22 lines · Kevin Stefanov

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.

---
CC: Ian Jackson <[email protected]>
CC: Wei Liu <[email protected]>
CC: Juergen Gross <[email protected]>
CC: Julien Grall <[email protected]>
CC: Andrew Cooper <[email protected]>

---
  tools/tests/xenstore/test-xenstore.c | 9 +++++++--
  1 file changed, 7 insertions(+), 2 deletions(-)
tools/tests/xenstore/test-xenstore.c +0 -0
index d3574b3fa2..ec8c63a65d 100644

tools/tests/xenstore/test-xenstore.c static int call_test(struct test *tst, int iters, bool no_clock) · line 115

Quoted 8 lines
tools/tests/xenstore/test-xenstore.c +3 -2
@@ -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.

tools/tests/xenstore/test-xenstore.c static int call_test(struct test *tst, int iters, bool no_clock) · line 116

Quoted 1 line
tools/tests/xenstore/test-xenstore.c +1 -0
+            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.

tools/tests/xenstore/test-xenstore.c static int call_test(struct test *tst, int iters, bool no_clock) · line 122

Quoted 7 lines
tools/tests/xenstore/test-xenstore.c +3 -0
+        else
+            printf("%-10s: failed (ret = %d, stage %s)\n", tst->name, ret, stage);
+    }
      else if ( !no_clock )
      {
          printf("%-10s:", tst->name);

Juergen