s3:torture/vfstest add memreport option
authorChristian Ambach <ambi@samba.org>
Fri, 16 Nov 2012 21:58:06 +0000 (22:58 +0100)
committerAndrew Bartlett <abartlet@samba.org>
Mon, 4 Feb 2013 11:19:30 +0000 (12:19 +0100)
this will run a talloc_report_full on the talloc stackframe after each command

Signed-off-by: Christian Ambach <ambi@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
source3/torture/vfstest.c

index de7e732e5829afa56d73a3c4758e0073f189dc3f..439e186c90d24505638065237cd98197c149fe79 100644 (file)
@@ -42,6 +42,9 @@ static struct cmd_list {
        struct cmd_set *cmd_set;
 } *cmd_list;
 
        struct cmd_set *cmd_set;
 } *cmd_list;
 
+/* shall we do talloc_report after each command? */
+static int memreports = 0;
+
 /****************************************************************************
 handle completion of commands for readline
 ****************************************************************************/
 /****************************************************************************
 handle completion of commands for readline
 ****************************************************************************/
@@ -324,6 +327,9 @@ static NTSTATUS do_cmd(struct vfs_state *vfs, struct cmd_set *cmd_entry, char *c
                SAFE_FREE(argv);
        }
 
                SAFE_FREE(argv);
        }
 
+       if (memreports != 0) {
+               talloc_report_full(mem_ctx, stdout);
+       }
        TALLOC_FREE(mem_ctx);
        return result;
 }
        TALLOC_FREE(mem_ctx);
        return result;
 }
@@ -464,6 +470,8 @@ int main(int argc, char *argv[])
                POPT_AUTOHELP
                {"file",        'f', POPT_ARG_STRING,   &filename, 0, },
                {"command",     'c', POPT_ARG_STRING,   &cmdstr, 0, "Execute specified list of commands" },
                POPT_AUTOHELP
                {"file",        'f', POPT_ARG_STRING,   &filename, 0, },
                {"command",     'c', POPT_ARG_STRING,   &cmdstr, 0, "Execute specified list of commands" },
+               {"memreport",   'm', POPT_ARG_INT,      &memreports, 0,
+                "Report memory left on talloc stackframe after each command" },
                POPT_COMMON_SAMBA
                POPT_TABLEEND
        };
                POPT_COMMON_SAMBA
                POPT_TABLEEND
        };