summaryrefslogtreecommitdiff
path: root/source4/torture
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2010-07-06 15:25:54 +1000
committerMatthieu Patou <mat@samba.org>2010-10-11 13:46:21 +0000
commit58294ffdee2066e3e051b6cb914f2708e6114089 (patch)
tree98c6ec90c5f4f7a35b7c7d8aa42dcde6cfa1d73c /source4/torture
parent74ed86c4e3d997a283e1ac03237ece9397242d81 (diff)
downloadsamba-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/torture')
-rw-r--r--source4/torture/smbtorture.c16
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 {