diff options
author | Andrew Bartlett <abartlet@samba.org> | 2010-07-06 15:25:54 +1000 |
---|---|---|
committer | Matthieu Patou <mat@samba.org> | 2010-10-11 13:46:21 +0000 |
commit | 58294ffdee2066e3e051b6cb914f2708e6114089 (patch) | |
tree | 98c6ec90c5f4f7a35b7c7d8aa42dcde6cfa1d73c /source4 | |
parent | 74ed86c4e3d997a283e1ac03237ece9397242d81 (diff) | |
download | samba-58294ffdee2066e3e051b6cb914f2708e6114089.tar.gz samba-58294ffdee2066e3e051b6cb914f2708e6114089.tar.bz2 samba-58294ffdee2066e3e051b6cb914f2708e6114089.zip |
s4:smbtorture Create a new random output directory each time, and delete it
This ensures we don't delete an exiting directory.
Andrew Bartlett
Signed-off-by: Matthieu Patou <mat@matws.net>
Diffstat (limited to 'source4')
-rw-r--r-- | source4/torture/smbtorture.c | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/source4/torture/smbtorture.c b/source4/torture/smbtorture.c index 8989bdf8d2..36b8c0f377 100644 --- a/source4/torture/smbtorture.c +++ b/source4/torture/smbtorture.c @@ -404,6 +404,7 @@ int main(int argc,char *argv[]) int shell = false; static const char *ui_ops_name = "subunit"; const char *basedir = NULL; + char *outputdir; const char *extra_module = NULL; static int list_tests = 0; int num_extra_users = 0; @@ -626,14 +627,22 @@ int main(int argc,char *argv[]) fprintf(stderr, "Please specify an absolute path to --basedir\n"); return 1; } - torture->outputdir = basedir; + outputdir = talloc_asprintf(torture, "%s/smbtortureXXXXXX", basedir); } else { char *pwd = talloc_size(torture, PATH_MAX); if (!getcwd(pwd, PATH_MAX)) { fprintf(stderr, "Unable to determine current working directory\n"); return 1; } - torture->outputdir = pwd; + outputdir = talloc_asprintf(torture, "%s/smbtortureXXXXXX", pwd); + } + if (!outputdir) { + fprintf(stderr, "Could not allocate per-run output dir\n"); + return 1; + } + torture->outputdir = mkdtemp(outputdir); + if (!torture->outputdir) { + perror("Failed to make temp output dir"); } torture->lp_ctx = cmdline_lp_ctx; @@ -670,6 +679,9 @@ int main(int argc,char *argv[]) } } + /* Now delete the temp dir we created */ + torture_deltree_outputdir(torture); + if (torture->results->returncode && correct) { return(0); } else { |