SMT-RAT  24.02
Toolbox for Strategic and Parallel Satisfiability-Modulo-Theories Solving
BenchmarkSet.cpp
Go to the documentation of this file.
1 #include "BenchmarkSet.h"
2 
3 #include <benchmax/logging.h>
5 
6 #include <algorithm>
7 #include <string>
8 
9 namespace benchmax {
10 
11 void BenchmarkSet::add_recursive(const std::filesystem::path& path) {
12  try {
13  // does p actually exist?
14  if(std::filesystem::exists(path))
15  {
16  if (std::filesystem::is_directory(path)) {
17  // If it is a directory, we add all the contents
18  BENCHMAX_LOG_TRACE("benchmax", path << " is a directory.");
19  for (auto it = std::filesystem::directory_iterator(path); it != std::filesystem::directory_iterator(); it++) {
20  add_recursive(*it);
21  }
22  } else if (std::filesystem::is_symlink(path)) {
23  // A symlink. Resolve symlink and call recursively.
24  auto r = std::filesystem::read_symlink(path);
25  BENCHMAX_LOG_DEBUG("benchmax", path << " is a symlink to " << r);
26  add_recursive(r);
27  } else {
28  // Not a directory, so (we assume?) it is a file.
29  mFilesList.push_back(std::filesystem::absolute(path));
30  }
31  }
32  else {
33  BENCHMAX_LOG_WARN("benchmax", path << " does not exist.");
34  }
35  } catch(const std::filesystem::filesystem_error& ex) {
36  BENCHMAX_LOG_ERROR("benchmax", "Filesystem error: " << ex.what());
37  }
38 }
39 
40 void BenchmarkSet::add_directory(const std::filesystem::path& dir) {
41  BENCHMAX_LOG_DEBUG("benchmax.benchmarks", "Adding benchmarks from " << dir);
42  add_recursive(dir);
43  std::sort(mFilesList.begin(), mFilesList.end());
44  BENCHMAX_LOG_DEBUG("benchmax.benchmarks", "Now we have " << mFilesList.size() << " benchmarks");
45 }
46 
47 }
#define BENCHMAX_LOG_DEBUG(channel, msg)
Log debug messages.
Definition: logging.h:55
#define BENCHMAX_LOG_WARN(channel, msg)
Log warnings.
Definition: logging.h:51
#define BENCHMAX_LOG_TRACE(channel, msg)
Log trace messages.
Definition: logging.h:57
#define BENCHMAX_LOG_ERROR(channel, msg)
Log errors.
Definition: logging.h:49
void add_directory(const std::filesystem::path &dir)
Recursively find all benchmarks from this directory.
void add_recursive(const std::filesystem::path &path)
Recursively add all benchmarks from this path.
std::vector< std::filesystem::path > mFilesList
List of files in this benchmark set.
Definition: BenchmarkSet.h:15
void sort(T *array, int size, LessThan lt)
Definition: Sort.h:67
CoveringResult< typename op::PropertiesSet > exists(cadcells::datastructures::Projections &proj, FE &f, cadcells::Assignment ass, const VariableQuantification &quantification, bool characterize_sat, bool characterize_unsat)
Definition: Algorithm.h:139