]> xenbits.xensource.com Git - xen.git/commitdiff
tools/tests: let test-xenstore exit with non-0 status in case of error
authorJuergen Gross <jgross@suse.com>
Thu, 2 May 2024 09:22:13 +0000 (11:22 +0200)
committerAndrew Cooper <andrew.cooper3@citrix.com>
Thu, 2 May 2024 17:15:46 +0000 (18:15 +0100)
In case a test is failing in test-xenstore, let the tool exit with an
exit status other than 0.

Fix a typo in an error message.

Reported-by: Andrew Cooper <andrew.cooper3@citrix.com>
Fixes: 3afc5e4a5b75 ("tools/tests: add xenstore testing framework")
Signed-off-by: Juergen Gross <jgross@suse.com>
tools/tests/xenstore/test-xenstore.c

index 73a7011d21f582a50d3766a93e516aebc4f4834d..7a9bd9afb3fa6baa183bc0864fddc9b63b7b29ac 100644 (file)
@@ -506,14 +506,14 @@ int main(int argc, char *argv[])
         stop = time(NULL) + randtime;
         srandom((unsigned int)stop);
 
-        while ( time(NULL) < stop )
+        while ( time(NULL) < stop && !ret )
         {
             t = random() % ARRAY_SIZE(tests);
             ret = call_test(tests + t, iters, true);
         }
     }
     else
-        for ( t = 0; t < ARRAY_SIZE(tests); t++ )
+        for ( t = 0; t < ARRAY_SIZE(tests) && !ret; t++ )
         {
             if ( !test || !strcmp(test, tests[t].name) )
                 ret = call_test(tests + t, iters, false);
@@ -525,10 +525,10 @@ int main(int argc, char *argv[])
     xs_close(xsh);
 
     if ( ta_loops )
-        printf("Exhaustive transaction retries (%d) occurrred %d times.\n",
+        printf("Exhaustive transaction retries (%d) occurred %d times.\n",
                MAX_TA_LOOPS, ta_loops);
 
-    return 0;
+    return ret ? 3 : 0;
 }
 
 /*