]> git.ipfire.org Git - thirdparty/openembedded/openembedded-core-contrib.git/blob
ae7db0b7aa8532ad07ec947625b6079e2ef4f8c8
[thirdparty/openembedded/openembedded-core-contrib.git] /
1 From 36ebd92fa53c0097f1e2f9ec5aa5b5c6ec1b411d Mon Sep 17 00:00:00 2001
2 From: Thomas Perrot <thomas.perrot@bootlin.com>
3 Date: Wed, 29 Sep 2021 13:50:35 +0200
4 Subject: [PATCH] test: retriable tests are marked failed only when all
5 attempts have failed
6
7 Fixes: #1193
8
9 Upstream-status: Pending
10
11 Signed-off-by: Thomas Perrot <thomas.perrot@bootlin.com>
12 ---
13 test/tinytest.c | 13 ++++++-------
14 test/tinytest.h | 2 +-
15 2 files changed, 7 insertions(+), 8 deletions(-)
16
17 diff --git a/test/tinytest.c b/test/tinytest.c
18 index 85dfe74a720e..bf2882418eb6 100644
19 --- a/test/tinytest.c
20 +++ b/test/tinytest.c
21 @@ -310,7 +310,8 @@ testcase_run_forked_(const struct testgroup_t *group,
22
23 int
24 testcase_run_one(const struct testgroup_t *group,
25 - const struct testcase_t *testcase)
26 + const struct testcase_t *testcase,
27 + const int test_attempts)
28 {
29 enum outcome outcome;
30
31 @@ -348,7 +349,7 @@ testcase_run_one(const struct testgroup_t *group,
32 if (opt_verbosity>0 && !opt_forked)
33 puts("SKIPPED");
34 } else {
35 - if (!opt_forked)
36 + if (!opt_forked && (testcase->flags & TT_RETRIABLE) && !test_attempts)
37 printf("\n [%s FAILED]\n", testcase->name);
38 }
39
40 @@ -525,22 +526,20 @@ tinytest_main(int c, const char **v, struct testgroup_t *groups)
41 struct testgroup_t *group = &groups[i];
42 for (j = 0; group->cases[j].name; ++j) {
43 struct testcase_t *testcase = &group->cases[j];
44 - int test_attempts = 3;
45 + int test_attempts = (testcase->flags & TT_RETRIABLE) ? 3: 1;
46 int test_ret_err;
47
48 if (!(testcase->flags & TT_ENABLED_))
49 continue;
50
51 for (;;) {
52 - test_ret_err = testcase_run_one(group, testcase);
53 + test_ret_err = testcase_run_one(group, testcase, test_attempts);
54
55 if (test_ret_err == OK)
56 break;
57 - if (!(testcase->flags & TT_RETRIABLE))
58 + if (!--test_attempts)
59 break;
60 printf("\n [RETRYING %s (%i)]\n", testcase->name, test_attempts);
61 - if (!test_attempts--)
62 - break;
63 }
64
65 switch (test_ret_err) {
66 diff --git a/test/tinytest.h b/test/tinytest.h
67 index d321dd467542..c276b5339331 100644
68 --- a/test/tinytest.h
69 +++ b/test/tinytest.h
70 @@ -92,7 +92,7 @@ char *tinytest_format_hex_(const void *, unsigned long);
71 tinytest_set_flag_(groups, named, 1, TT_SKIP)
72
73 /** Run a single testcase in a single group. */
74 -int testcase_run_one(const struct testgroup_t *,const struct testcase_t *);
75 +int testcase_run_one(const struct testgroup_t *,const struct testcase_t *, const int test_attempts);
76
77 void tinytest_set_aliases(const struct testlist_alias_t *aliases);
78
79 --
80 2.31.1
81