From a4a6c03bf8448923525a4997e4a7a3bd1f29c70f Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Fri, 3 Jul 2020 15:37:25 +0200 Subject: [PATCH] lib/torture: add back links to the parent objects This makes would allow the full name of a test to be constructed if needed in future. Signed-off-by: Stefan Metzmacher Reviewed-by: Andreas Schneider --- lib/torture/torture.c | 3 +++ lib/torture/torture.h | 4 ++++ 2 files changed, 7 insertions(+) diff --git a/lib/torture/torture.c b/lib/torture/torture.c index 51ec99828dc..d808b788481 100644 --- a/lib/torture/torture.c +++ b/lib/torture/torture.c @@ -297,6 +297,7 @@ bool torture_suite_init_tcase(struct torture_suite *suite, tcase->tests = NULL; DLIST_ADD_END(suite->testcases, tcase); + tcase->suite = suite; return true; } @@ -623,6 +624,7 @@ struct torture_tcase *torture_suite_add_simple_tcase_const( test->dangerous = false; DLIST_ADD_END(tcase->tests, test); + test->tcase = tcase; return tcase; } @@ -671,6 +673,7 @@ bool torture_suite_add_suite(struct torture_suite *suite, return false; DLIST_ADD_END(suite->children, child); + child->parent = suite; /* FIXME: Check for duplicates and return false if the * added suite already exists as a child */ diff --git a/lib/torture/torture.h b/lib/torture/torture.h index a6f829f1ff0..3f1f19a29b0 100644 --- a/lib/torture/torture.h +++ b/lib/torture/torture.h @@ -143,6 +143,8 @@ struct torture_test { /** Use data for this test */ const void *data; + + struct torture_tcase *tcase; }; /* @@ -157,6 +159,7 @@ struct torture_tcase { void *data; struct torture_test *tests; struct torture_tcase *prev, *next; + const struct torture_suite *suite; }; struct torture_suite @@ -165,6 +168,7 @@ struct torture_suite const char *description; struct torture_tcase *testcases; struct torture_suite *children; + const struct torture_suite *parent; /* Pointers to siblings of this torture suite */ struct torture_suite *prev, *next; -- 2.11.4.GIT