]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
s4:torture: Add command line parameter --fullname
authorSachin Prabhu <sprabhu@redhat.com>
Fri, 3 Jul 2020 12:17:43 +0000 (14:17 +0200)
committerStefan Metzmacher <metze@samba.org>
Tue, 7 Jul 2020 10:30:40 +0000 (10:30 +0000)
This argument is used to print out the the full name which includes the
name of the test suite.

For example, the name in the output for the test smb2.read.dir is "dir".
By using the --fullname parameter, the name used will be
"smb2.read.dir".

The default continues to be to use the shortname.

Pair-Programmed-With: Stefan Metzmacher <metze@samba.org>

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

index beed88c0eb4f689bcb55100081eb14b9cb1837dd..88c38d254e99b41fc99a06f6980d5bf27c83f6bc 100644 (file)
@@ -38,6 +38,8 @@
 #include <readline/history.h>
 #endif
 
+static int use_fullname;
+
 static char *prefix_name(TALLOC_CTX *mem_ctx, const char *prefix, const char *name)
 {
        if (prefix == NULL)
@@ -87,7 +89,13 @@ static bool run_matching(struct torture_context *torture,
                if (gen_fnmatch(expr, name) == 0) {
                        *matched = true;
                        reload_charcnv(torture->lp_ctx);
+                       if (use_fullname == 1) {
+                               torture_subunit_prefix_reset(torture, prefix);
+                       }
                        ret &= torture_run_suite_restricted(torture, o, restricted);
+                       if (use_fullname == 1) {
+                               torture_subunit_prefix_reset(torture, NULL);
+                       }
                        /*
                         * torture_run_suite_restricted() already implements
                         * recursion, so we're done with this child suite.
@@ -102,7 +110,13 @@ static bool run_matching(struct torture_context *torture,
                if (gen_fnmatch(expr, tname) == 0) {
                        *matched = true;
                        reload_charcnv(torture->lp_ctx);
+                       if (use_fullname == 1) {
+                               torture_subunit_prefix_reset(torture, prefix);
+                       }
                        ret &= torture_run_tcase_restricted(torture, t, restricted);
+                       if (use_fullname == 1) {
+                               torture_subunit_prefix_reset(torture, NULL);
+                       }
                        /*
                         * torture_run_tcase_restricted() already implements
                         * recursion, so we're done for this tcase.
@@ -114,7 +128,15 @@ static bool run_matching(struct torture_context *torture,
                        if (gen_fnmatch(expr, pname) == 0) {
                                *matched = true;
                                reload_charcnv(torture->lp_ctx);
+                               if (use_fullname == 1) {
+                                       torture_subunit_prefix_reset(torture,
+                                                                    tname);
+                               }
                                ret &= torture_run_test_restricted(torture, t, p, restricted);
+                               if (use_fullname == 1) {
+                                       torture_subunit_prefix_reset(torture,
+                                                                    NULL);
+                               }
                        }
                }
        }
@@ -400,6 +422,8 @@ int main(int argc, const char *argv[])
 
        struct poptOption long_options[] = {
                POPT_AUTOHELP
+               {"fullname",    0, POPT_ARG_NONE, &use_fullname, 0,
+                "use full name for the test", NULL },
                {"format", 0, POPT_ARG_STRING, &ui_ops_name, 0, "Output format (one of: simple, subunit)", NULL },
                {"smb-ports",   'p', POPT_ARG_STRING, NULL,     OPT_SMB_PORTS,  "SMB ports",    NULL},
                {"basedir",       0, POPT_ARG_STRING, &basedir, 0, "base directory", "BASEDIR" },