From: Sachin Prabhu Date: Fri, 3 Jul 2020 12:17:43 +0000 (+0200) Subject: s4:torture: Add command line parameter --fullname X-Git-Tag: samba-4.13.0rc1~63 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8902eb82d981e07812134285e199b47b22acd815;p=thirdparty%2Fsamba.git s4:torture: Add command line parameter --fullname 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 Signed-off-by: Sachin Prabhu Signed-off-by: Stefan Metzmacher Reviewed-by: Andreas Schneider --- diff --git a/source4/torture/smbtorture.c b/source4/torture/smbtorture.c index beed88c0eb4..88c38d254e9 100644 --- a/source4/torture/smbtorture.c +++ b/source4/torture/smbtorture.c @@ -38,6 +38,8 @@ #include #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" },