make options test use build directory for temporary files rather than /tmp

This commit is contained in:
Vincent Sanders 2019-09-21 13:25:45 +01:00
parent 737a09d53e
commit 40aa44e4f5
2 changed files with 6 additions and 1 deletions

View File

@ -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)

View File

@ -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;
}