]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
s4:torture: avoid multiple recursions into the test lists
authorStefan Metzmacher <metze@samba.org>
Fri, 3 Jul 2020 13:58:38 +0000 (15:58 +0200)
committerStefan Metzmacher <metze@samba.org>
Tue, 7 Jul 2020 10:30:40 +0000 (10:30 +0000)
torture_run_suite_restricted() and torture_run_tcase_restricted()
already handle recursion. If we call them from smbtorture
we should avoid our own recursion.

Without this passing 'smb2.multichannel.*' results in running
tests more than once.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
source4/torture/smbtorture.c

index f0da30727d9d53bc556b16dc72ab182213b0a4ff..beed88c0eb4f689bcb55100081eb14b9cb1837dd 100644 (file)
@@ -87,10 +87,12 @@ static bool run_matching(struct torture_context *torture,
                if (gen_fnmatch(expr, name) == 0) {
                        *matched = true;
                        reload_charcnv(torture->lp_ctx);
-                       if (restricted != NULL)
-                               ret &= torture_run_suite_restricted(torture, o, restricted);
-                       else
-                               ret &= torture_run_suite(torture, o);
+                       ret &= torture_run_suite_restricted(torture, o, restricted);
+                       /*
+                        * torture_run_suite_restricted() already implements
+                        * recursion, so we're done with this child suite.
+                        */
+                       continue;
                }
                ret &= run_matching(torture, name, expr, restricted, o, matched);
        }
@@ -101,6 +103,11 @@ static bool run_matching(struct torture_context *torture,
                        *matched = true;
                        reload_charcnv(torture->lp_ctx);
                        ret &= torture_run_tcase_restricted(torture, t, restricted);
+                       /*
+                        * torture_run_tcase_restricted() already implements
+                        * recursion, so we're done for this tcase.
+                        */
+                       continue;
                }
                for (p = t->tests; p; p = p->next) {
                        char *pname = prefix_name(torture, tname, p->name);