void BenchmarkSet::parseDirectory(const fs::path& dir) { try { // does p actually exist? if(fs::exists(dir)) { if (fs::is_directory(dir)) { // If it is a directory, we add all the contents BENCHMAX_LOG_DEBUG("benchmax", dir << " is a directory."); for (auto it = fs::directory_iterator(dir); it != fs::directory_iterator(); it++) { parseDirectory(*it); } } else if (fs::is_symlink(dir)) { // A symlink. Resolve symlink and call recursively. fs::path r = fs::read_symlink(dir); BENCHMAX_LOG_DEBUG("benchmax", dir << " is a symlink to " << r); parseDirectory(r); } else { // Not a directory, so (we assume?) it is a file. mFilesList.push_back(dir); } } else BENCHMAX_LOG_WARN("benchmax", dir << " does not exist."); } catch(const fs::filesystem_error& ex) { BENCHMAX_LOG_ERROR("benchmax", "Filesystem error: " << ex.what()); } }
/// Postprocess settings to compute common prefix. bool finalize_tool_settings(ToolSettings& s, const boost::program_options::variables_map&) { s.tools_common_prefix = common_prefix({ s.tools_generic, s.tools_smtrat, s.tools_smtrat_opb, s.tools_minisatp, s.tools_z3 }); BENCHMAX_LOG_DEBUG("benchmax.tools", "Common tool prefix is " << s.tools_common_prefix); return false; }
void createTools(const std::vector<std::filesystem::path>& arguments, Tools& tools) { std::regex r("([^ ]+) *(.*)"); for (const auto& arg: arguments) { std::smatch matches; if (std::regex_match(arg.native(), matches, r)) { fs::path path = std::filesystem::canonical(fs::path(matches[1])); if (!fs::is_regular_file(path)) { BENCHMAX_LOG_WARN("benchmax", "The tool " << path << " does not seem to be a file. We skip it."); continue; } const fs::perms executable = fs::perms::others_exec | fs::perms::group_exec | fs::perms::owner_exec; if ((fs::status(path).permissions() & executable) == fs::perms::none) { BENCHMAX_LOG_WARN("benchmax", "The tool " << path << " does not seem to be executable. We skip it."); continue; } BENCHMAX_LOG_DEBUG("benchmax.tools", "Adding tool " << path << " with arguments \"" << matches[2] << "\"."); tools.emplace_back(std::make_unique<T>(path, matches[2])); } } }