bench: Avoid tmp files in pwd
This commit is contained in:
1 file changed
+3
-5
@@ -3,8 +3,8 @@
|
|||||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||||
|
|
||||||
#include <bench/bench.h>
|
#include <bench/bench.h>
|
||||||
|
|
||||||
#include <streams.h>
|
#include <streams.h>
|
||||||
|
#include <test/util/setup_common.h>
|
||||||
#include <util/fs.h>
|
#include <util/fs.h>
|
||||||
|
|
||||||
#include <cstddef>
|
#include <cstddef>
|
||||||
@@ -13,8 +13,8 @@
|
|||||||
|
|
||||||
static void FindByte(benchmark::Bench& bench)
|
static void FindByte(benchmark::Bench& bench)
|
||||||
{
|
{
|
||||||
// Setup
|
const auto testing_setup{MakeNoLogFileContext<const BasicTestingSetup>(ChainType::REGTEST)};
|
||||||
AutoFile file{fsbridge::fopen("streams_tmp", "w+b")};
|
AutoFile file{fsbridge::fopen(testing_setup->m_path_root / "streams_tmp", "w+b")};
|
||||||
const size_t file_size = 200;
|
const size_t file_size = 200;
|
||||||
uint8_t data[file_size] = {0};
|
uint8_t data[file_size] = {0};
|
||||||
data[file_size - 1] = 1;
|
data[file_size - 1] = 1;
|
||||||
@@ -27,9 +27,7 @@ static void FindByte(benchmark::Bench& bench)
|
|||||||
bf.FindByte(std::byte(1));
|
bf.FindByte(std::byte(1));
|
||||||
});
|
});
|
||||||
|
|
||||||
// Cleanup
|
|
||||||
assert(file.fclose() == 0);
|
assert(file.fclose() == 0);
|
||||||
fs::remove("streams_tmp");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
BENCHMARK(FindByte, benchmark::PriorityLevel::HIGH);
|
BENCHMARK(FindByte, benchmark::PriorityLevel::HIGH);
|
||||||
Reference in new issue
Block a user