[master] 780d1ff varnishtest uses TMPDIR for temp vtc.* dirs if set, else /tmp
Geoff Simmons
geoff at varnish-cache.org
Tue Oct 1 16:57:55 CEST 2013
commit 780d1ff228469922501e4d9850fc3695a4f055d9
Author: Geoff Simmons <geoff at uplex.de>
Date: Tue Oct 1 16:56:01 2013 +0200
varnishtest uses TMPDIR for temp vtc.* dirs if set, else /tmp
diff --git a/bin/varnishtest/vtc_main.c b/bin/varnishtest/vtc_main.c
index 04aba0d..d168ec3 100644
--- a/bin/varnishtest/vtc_main.c
+++ b/bin/varnishtest/vtc_main.c
@@ -85,6 +85,7 @@ static int vtc_verbosity = 1; /* Verbosity Level */
static int vtc_good;
static int vtc_fail;
static int leave_temp;
+static char *tmppath;
/**********************************************************************
* Parse a -D option argument into a name/val pair, and insert
@@ -149,8 +150,8 @@ usage(void)
fprintf(stderr, FMT, "-i", "Find varnishd in build tree");
fprintf(stderr, FMT, "-j jobs", "Run this many tests in parallel");
fprintf(stderr, FMT, "-k", "Continue on test failure");
- fprintf(stderr, FMT, "-l", "Leave /tmp/vtc.* if test fails");
- fprintf(stderr, FMT, "-L", "Always leave /tmp/vtc.*");
+ fprintf(stderr, FMT, "-l", "Leave temporary vtc.* if test fails");
+ fprintf(stderr, FMT, "-L", "Always leave temporary vtc.*");
fprintf(stderr, FMT, "-n iterations", "Run tests this many times");
fprintf(stderr, FMT, "-q", "Quiet mode: report only failures");
fprintf(stderr, FMT, "-t duration", "Time tests out after this long");
@@ -268,7 +269,8 @@ start_test(void)
memset(jp->buf, 0, jp->bufsiz);
srandomdev();
- bprintf(tmpdir, "/tmp/vtc.%d.%08x", (int)getpid(), (unsigned)random());
+ bprintf(tmpdir, "%s/vtc.%d.%08x", tmppath, (int)getpid(),
+ (unsigned)random());
AZ(mkdir(tmpdir, 0711));
tp = VTAILQ_FIRST(&tst_head);
@@ -332,6 +334,10 @@ main(int argc, char * const *argv)
char *p;
extmacro_def("varnishd", "varnishd"); /* Default to path lookup */
+ if (getenv("TMPDIR") != NULL)
+ tmppath = strdup(getenv("TMPDIR"));
+ else
+ tmppath = strdup("/tmp");
setbuf(stdout, NULL);
setbuf(stderr, NULL);
diff --git a/doc/sphinx/reference/varnishtest.rst b/doc/sphinx/reference/varnishtest.rst
index ff68337..a0df5e2 100644
--- a/doc/sphinx/reference/varnishtest.rst
+++ b/doc/sphinx/reference/varnishtest.rst
@@ -39,9 +39,9 @@ The following options are available:
-k Continue on test failure
--l Leave /tmp/vtc.* if test fails
+-l Leave temporary vtc.* if test fails
--L Always leave /tmp/vtc.*
+-L Always leave temporary vtc.*
-n iterations Run tests this many times
@@ -60,6 +60,8 @@ Macro definitions that can be overridden.
varnishd Path to varnishd to use [varnishd]
+If `TMPDIR` is set in the environment, varnishtest creates temporary
+`vtc.*` directories for each test in `$TMPDIR`, otherwise in `/tmp`.
SCRIPTS
=======
More information about the varnish-commit
mailing list