Hello all, On phk's suggestion, the new version of this patch has varnishtest using TMPDIR as the location for temporary vtc directories, or /tmp if TMPDIR is not set. No new CLI option or change to the Makefile necessary.
This patch also updates the docs (varnishtest.rst). Best, Geoff -- ** * * UPLEX - Nils Goroll Systemoptimierung Scheffelstraße 32 22301 Hamburg Tel +49 40 2880 5731 Mob +49 176 636 90917 Fax +49 40 42949753 http://uplex.de
From ed2319af5e6cb8fd1a48c8ca68074fb67f2f0f4f Mon Sep 17 00:00:00 2001 From: Geoff Simmons <[email protected]> Date: Tue, 1 Oct 2013 12:56:45 +0200 Subject: [PATCH] varnishtest uses TMPDIR for temp directories, or /tmp if not set. --- bin/varnishtest/vtc_main.c | 11 ++++++++--- doc/sphinx/reference/varnishtest.rst | 6 ++++-- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/bin/varnishtest/vtc_main.c b/bin/varnishtest/vtc_main.c index 04aba0d..751a915 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 *tmp; /********************************************************************** * 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 $TMPDIR/vtc.* if test fails"); + fprintf(stderr, FMT, "-L", "Always leave $TMPDIR/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", tmp, (int)getpid(), + (unsigned)random()); AZ(mkdir(tmpdir, 0711)); tp = VTAILQ_FIRST(&tst_head); @@ -332,6 +334,9 @@ main(int argc, char * const *argv) char *p; extmacro_def("varnishd", "varnishd"); /* Default to path lookup */ + tmp = strdup("/tmp"); + if (getenv("TMPDIR") != NULL) + tmp = strdup(getenv("TMPDIR")); setbuf(stdout, NULL); setbuf(stderr, NULL); diff --git a/doc/sphinx/reference/varnishtest.rst b/doc/sphinx/reference/varnishtest.rst index ff68337..30af487 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 $TMPDIR/vtc.* if test fails --L Always leave /tmp/vtc.* +-L Always leave $TMPDIR/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 not set in the environment, varnishtest creates temp +directories for each test in `/tmp`. SCRIPTS ======= -- 1.7.2.5
signature.asc
Description: OpenPGP digital signature
_______________________________________________ varnish-dev mailing list [email protected] https://www.varnish-cache.org/lists/mailman/listinfo/varnish-dev
