summaryrefslogtreecommitdiff
path: root/source4
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2006-11-12 03:40:38 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 14:25:30 -0500
commit9d7856122e9ddd1b87ff68215669bff3c28bcafd (patch)
tree108bb4c2f5c69b53a55272356a622237187e1b75 /source4
parentcbbe5be832494fb69c7d0e9ea7df8d47805863e4 (diff)
downloadsamba-9d7856122e9ddd1b87ff68215669bff3c28bcafd.tar.gz
samba-9d7856122e9ddd1b87ff68215669bff3c28bcafd.tar.bz2
samba-9d7856122e9ddd1b87ff68215669bff3c28bcafd.zip
r19680: Allow specifying basedir for test data.
Create temporary directories in base directory. (This used to be commit f111feb1d2b82a9ec3a8b6fbcdbe297bf11edc42)
Diffstat (limited to 'source4')
-rwxr-xr-xsource4/script/tests/mktestsetup.sh1
-rw-r--r--source4/torture/smbtorture.c6
-rw-r--r--source4/torture/util.c5
3 files changed, 10 insertions, 2 deletions
diff --git a/source4/script/tests/mktestsetup.sh b/source4/script/tests/mktestsetup.sh
index fc68e83f81..d6102e9d43 100755
--- a/source4/script/tests/mktestsetup.sh
+++ b/source4/script/tests/mktestsetup.sh
@@ -110,6 +110,7 @@ cat >$CONFFILE<<EOF
notify:inotify = false
ldb:nosync = true
torture:subunitdir = $SRCDIR/bin/torture
+ torture:basedir = $TEST_DATA_PREFIX
system:anonymous = true
#We don't want to pass our self-tests if the PAC code is wrong
diff --git a/source4/torture/smbtorture.c b/source4/torture/smbtorture.c
index 2963e71366..5ec8a2d6c4 100644
--- a/source4/torture/smbtorture.c
+++ b/source4/torture/smbtorture.c
@@ -519,12 +519,13 @@ int main(int argc,char *argv[])
int shell = False;
static const char *ui_ops_name = "simple";
enum {OPT_LOADFILE=1000,OPT_UNCLIST,OPT_TIMELIMIT,OPT_DNS,
- OPT_DANGEROUS,OPT_SMB_PORTS,OPT_ASYNC,OPT_NUMPROGS};
+ OPT_DANGEROUS,OPT_SMB_PORTS,OPT_ASYNC,OPT_NUMPROGS, OPT_BASEDIR};
struct poptOption long_options[] = {
POPT_AUTOHELP
{"format", 0, POPT_ARG_STRING, &ui_ops_name, 0, "Output format (one of: simple, subunit, harness)", NULL },
{"smb-ports", 'p', POPT_ARG_STRING, NULL, OPT_SMB_PORTS, "SMB ports", NULL},
+ {"basedir", 0, POPT_ARG_STRING, NULL, OPT_BASEDIR, "base directory", "BSAEDIR" },
{"seed", 0, POPT_ARG_INT, &torture_seed, 0, "seed", NULL},
{"num-progs", 0, POPT_ARG_INT, NULL, OPT_NUMPROGS, "num progs", NULL},
{"num-ops", 0, POPT_ARG_INT, &torture_numops, 0, "num ops", NULL},
@@ -575,6 +576,9 @@ int main(int argc,char *argv[])
case OPT_NUMPROGS:
lp_set_cmdline("torture:nprocs", poptGetOptArg(pc));
break;
+ case OPT_BASEDIR:
+ lp_set_cmdline("torture:basedir", poptGetOptArg(pc));
+ break;
case OPT_DNS:
parse_dns(poptGetOptArg(pc));
break;
diff --git a/source4/torture/util.c b/source4/torture/util.c
index fd2423ab67..812ae7574d 100644
--- a/source4/torture/util.c
+++ b/source4/torture/util.c
@@ -31,7 +31,10 @@
_PUBLIC_ NTSTATUS torture_temp_dir(TALLOC_CTX *mem_ctx, const char *prefix,
char **tempdir)
{
- *tempdir = talloc_asprintf(mem_ctx, "torture.tmp-%s.XXXXXX", prefix);
+ const char *basedir = lp_parm_string(-1, "torture", "basedir");
+ if (basedir == NULL) basedir = ".";
+ *tempdir = talloc_asprintf(mem_ctx, "%s/torture.tmp-%s.XXXXXX",
+ basedir, prefix);
if (mkdtemp(*tempdir) == NULL)
return NT_STATUS_UNSUCCESSFUL;