From: Juergen Gross Date: Thu, 4 Jul 2024 12:18:05 +0000 (+0200) Subject: tools/tests: let test-xenstore exit with non-0 status in case of error X-Git-Tag: RELEASE-4.17.5~29 X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=16bc1d8becdb5e998b5fc857e2b1ce01f174327d;p=xen.git tools/tests: let test-xenstore exit with non-0 status in case of error 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 Fixes: 3afc5e4a5b75 ("tools/tests: add xenstore testing framework") Signed-off-by: Juergen Gross master commit: 2d4ba205591ba64f31149ae31051678159ee9e11 master date: 2024-05-02 18:15:46 +0100 --- diff --git a/tools/tests/xenstore/test-xenstore.c b/tools/tests/xenstore/test-xenstore.c index 0e2a83ba5d..23fe3f0c28 100644 --- a/tools/tests/xenstore/test-xenstore.c +++ b/tools/tests/xenstore/test-xenstore.c @@ -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; } /*