1#ifndef CPROVER_GOTO_SYMEX_TEST_GEN_GUARD_H
2#define CPROVER_GOTO_SYMEX_TEST_GEN_GUARD_H
28 std::ifstream in(
path);
31 std::string first_line;
32 if (!std::getline(in, first_line))
50 const std::vector<std::filesystem::path> &paths,
51 const std::string &option_name)
53 for (
const auto &
path : paths)
56 if (!std::filesystem::exists(
path, ec))
65 "{} was not generated by ESBMC; refusing to overwrite it. Pass "
66 "{} <dir> to generate elsewhere.",
72 "cannot read {} to check whether it is safe to overwrite; refusing. "
73 "Pass {} <dir> to generate elsewhere.",
#define log_error(fmt,...)
Definition message.h:83
overwrite_verdict
Definition test_gen_guard.h:17
@ foreign
Definition test_gen_guard.h:19
@ safe
Definition test_gen_guard.h:18
@ unreadable
Definition test_gen_guard.h:20
overwrite_verdict classify_existing(const std::filesystem::path &path)
An empty file is safe: a run killed mid-write leaves exactly that, and refusing it would wedge genera...
Definition test_gen_guard.h:26
constexpr char ESBMC_GENERATED_MARKER[]
Shared no-clobber guard for the test-case generators (CTest, pytest, ...): every file they write carr...
Definition test_gen_guard.h:14
bool can_write_all(const std::vector< std::filesystem::path > &paths, const std::string &option_name)
Checked up-front for every target path rather than per-file: refusing halfway through would leave a h...
Definition test_gen_guard.h:49