Mercurial > hg
view contrib/fuzz/fuzzutil.h @ 48307:ab2dfc993b5c stable
tests: run the whole hg-core/path_auditor test in a clean temp dir
This makes the whole test happen in a clean temporary directory in
`$TMPDIR/$random`, and simplifies the test a bit by eliminating unnecessarily
dynamic path elements computations.
Before this patch, the first part of the test was happening in `/tmp` itself.
This allowed coincidentally named files placed in that directory to impact the
outcome of the test. Additionally, this made the second part of the test fail
on systems on which `$TMPDIR != /tmp`, because the inspected directory was
different from the one in which the mock files were being written. This fully
fixes the issue only partially solved in db2bc9e667a1.
Differential Revision: https://phab.mercurial-scm.org/D11738
author | pacien <pacien.trangirard@pacien.net> |
---|---|
date | Tue, 09 Nov 2021 02:00:25 +0100 |
parents | 6f5c352f41b6 |
children |
line wrap: on
line source
#ifndef CONTRIB_FUZZ_FUZZUTIL_H #define CONTRIB_FUZZ_FUZZUTIL_H #include <iostream> #include <memory> #include <stdint.h> /* Try and use std::optional, but failing that assume we'll have a * workable https://abseil.io/ install on the include path to get * their backport of std::optional. */ #ifdef __has_include #if __has_include(<optional>) && __cplusplus >= 201703L #include <optional> #define CONTRIB_FUZZ_HAVE_STD_OPTIONAL #endif #endif #ifdef CONTRIB_FUZZ_HAVE_STD_OPTIONAL namespace contrib { using std::nullopt; using std::optional; } /* namespace contrib */ #else #include "third_party/absl/types/optional.h" namespace contrib { using absl::nullopt; using absl::optional; } /* namespace contrib */ #endif /* set DEBUG to 1 for a few debugging prints, or 2 for a lot */ #define DEBUG 0 #define LOG(level) \ if (level <= DEBUG) \ std::cout #endif /* CONTRIB_FUZZ_FUZZUTIL_H */