Relocate temporary script coverage files

So they don't clutter the top-level of unit test .tmp/ dir.
This commit is contained in:
Jon Siwek 2018-06-01 11:29:15 -05:00
parent f9e5777e6f
commit 55f14c2eb8
6 changed files with 21 additions and 8 deletions

View file

@ -1,4 +1,8 @@
2.5-619 | 2018-06-01 11:29:15 -0500
* Relocate temporary script coverage files (Corelight)
2.5-618 | 2018-06-01 10:03:24 -0500
* BIT-1635: fix `make doc` warnings (Corelight)

View file

@ -1 +1 @@
2.5-618
2.5-619

View file

@ -50,10 +50,18 @@ bool Brofiler::WriteStats()
char* bf = getenv("BRO_PROFILER_FILE");
if ( ! bf ) return false;
FILE* f;
const char* p = strstr(bf, ".XXXXXX");
SafeDirname dirname{bf};
if ( p && ! p[7] )
if ( ! ensure_intermediate_dirs(dirname.result.data()) )
{
reporter->Error("Failed to open BRO_PROFILER_FILE destination '%s' for writing", bf);
return false;
}
FILE* f;
const char* p = strstr(bf, "XXXXXX");
if ( p && ! p[6] )
{
mode_t old_umask = umask(S_IXUSR | S_IRWXO | S_IRWXG);
int fd = mkstemp(bf);

View file

@ -1,6 +1,7 @@
DIAG=diag.log
BTEST=../../aux/btest/btest
SCRIPT_COV=.tmp/script-coverage
all: cleanup btest-verbose coverage
@ -15,11 +16,11 @@ btest-brief:
@$(BTEST) -j -b -f $(DIAG)
coverage:
@../scripts/coverage-calc ".tmp/script-coverage*" coverage.log `pwd`/../../scripts
@../scripts/coverage-calc "$(SCRIPT_COV)/*" coverage.log `pwd`/../../scripts
cleanup:
@rm -f $(DIAG)
@rm -f .tmp/script-coverage*
@rm -rf $(SCRIPT_COV)*
distclean: cleanup
@rm -rf .btest.failed.dat \

View file

@ -22,6 +22,6 @@ DIST=%(testbase)s/../..
BUILD=%(testbase)s/../../build
TEST_DIFF_CANONIFIER=%(testbase)s/../scripts/diff-canonifier
TMPDIR=%(testbase)s/.tmp
BRO_PROFILER_FILE=%(testbase)s/.tmp/script-coverage.XXXXXX
BRO_PROFILER_FILE=%(testbase)s/.tmp/script-coverage/XXXXXX
BTEST_RST_FILTER=$SCRIPTS/rst-filter
BRO_DNS_FAKE=1

View file

@ -18,7 +18,7 @@ SCRIPTS=%(testbase)s/../scripts
SCRIPTS_LOCAL=%(testbase)s/scripts
DIST=%(testbase)s/../../..
BUILD=%(testbase)s/../../../build
BRO_PROFILER_FILE=%(testbase)s/.tmp/script-coverage.XXXXXX
BRO_PROFILER_FILE=%(testbase)s/.tmp/script-coverage/XXXXXX
BRO_DNS_FAKE=1
# For fedora 21 - they disable MD5 for certificate verification and need setting an environment variable to permit it.
OPENSSL_ENABLE_MD5_VERIFY=1