From 40aa44e4f50dd35cbc11332b1c1865b3152afb2d Mon Sep 17 00:00:00 2001 From: Vincent Sanders Date: Sat, 21 Sep 2019 13:25:45 +0100 Subject: make options test use build directory for temporary files rather than /tmp --- test/Makefile | 1 + test/nsoption.c | 6 +++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/test/Makefile b/test/Makefile index e92ece75d..81482f6d1 100644 --- a/test/Makefile +++ b/test/Makefile @@ -143,6 +143,7 @@ BASE_TESTCFLAGS := -std=c99 -g \ -Dnsgtk \ -DNETSURF_BUILTIN_LOG_FILTER=\"level:WARNING\" \ -DNETSURF_BUILTIN_VERBOSE_FILTER=\"level:DEBUG\" \ + -DTESTROOT=\"$(TESTROOT)\" \ $(SAN_FLAGS) \ $(shell pkg-config --cflags libcurl libparserutils libwapcaplet libdom libnsutils libutf8proc) \ $(LIB_CFLAGS) diff --git a/test/nsoption.c b/test/nsoption.c index fe986790f..0159148f8 100644 --- a/test/nsoption.c +++ b/test/nsoption.c @@ -33,6 +33,10 @@ #include "utils/log.h" #include "utils/nsoption.h" +#ifndef TESTROOT +#define TESTROOT "/tmp" +#endif + const char *test_choices_path = "test/data/Choices"; const char *test_choices_short_path = "test/data/Choices-short"; const char *test_choices_all_path = "test/data/Choices-all"; @@ -51,7 +55,7 @@ static char *testnam(char *out) static char name[64]; int pid; pid=getpid(); - snprintf(name, 64, "/tmp/nsoptiontest%d%d", pid, count); + snprintf(name, 64, TESTROOT"/nsoptiontest%d%d", pid, count); count++; return name; } -- cgit v1.2.3