summaryrefslogtreecommitdiff
blob: ee0a4978fc60a0a073b10854c196de8bc3e7684b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
From 22f623622cc60571be9cccc323a1d17749683667 Mon Sep 17 00:00:00 2001
From: Juergen Gross <jgross@suse.com>
Date: Thu, 4 Jul 2024 14:07:12 +0200
Subject: [PATCH 38/56] 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 <andrew.cooper3@citrix.com>
Fixes: 3afc5e4a5b75 ("tools/tests: add xenstore testing framework")
Signed-off-by: Juergen Gross <jgross@suse.com>
master commit: 2d4ba205591ba64f31149ae31051678159ee9e11
master date: 2024-05-02 18:15:46 +0100
---
 tools/tests/xenstore/test-xenstore.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/tools/tests/xenstore/test-xenstore.c b/tools/tests/xenstore/test-xenstore.c
index 73a7011d21..7a9bd9afb3 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;
 }
 
 /*
-- 
2.45.2