summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2006-11-12 03:40:38 +0000
committerJelmer Vernooij <jelmer@samba.org>2006-11-12 03:40:38 +0000
commit25a124db97568ce5ae3563fbeb698ecd72bfcd40 (patch)
tree8e939e7c6239e4cd948336b68839b7428348688b
parent1dc366baa5316fbacf9f7c6af5e748bffb3efe33 (diff)
downloadsamba-25a124db97568ce5ae3563fbeb698ecd72bfcd40.tar.gz
samba-25a124db97568ce5ae3563fbeb698ecd72bfcd40.tar.xz
samba-25a124db97568ce5ae3563fbeb698ecd72bfcd40.zip
r19680: Allow specifying basedir for test data.
Create temporary directories in base directory.
-rwxr-xr-xsource/script/tests/mktestsetup.sh1
-rw-r--r--source/torture/smbtorture.c6
-rw-r--r--source/torture/util.c5
3 files changed, 10 insertions, 2 deletions
diff --git a/source/script/tests/mktestsetup.sh b/source/script/tests/mktestsetup.sh
index fc68e83f81d..d6102e9d434 100755
--- a/source/script/tests/mktestsetup.sh
+++ b/source/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/source/torture/smbtorture.c b/source/torture/smbtorture.c
index 2963e71366a..5ec8a2d6c4c 100644
--- a/source/torture/smbtorture.c
+++ b/source/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/source/torture/util.c b/source/torture/util.c
index fd2423ab676..812ae7574db 100644
--- a/source/torture/util.c
+++ b/source/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;