P4C
The P4 Compiler
Loading...
Searching...
No Matches
greedy_node_cov.h
1#ifndef BACKENDS_P4TOOLS_MODULES_TESTGEN_CORE_SYMBOLIC_EXECUTOR_GREEDY_NODE_COV_H_
2#define BACKENDS_P4TOOLS_MODULES_TESTGEN_CORE_SYMBOLIC_EXECUTOR_GREEDY_NODE_COV_H_
3
4#include <cstdint>
5#include <optional>
6#include <vector>
7
8#include "ir/solver.h"
9#include "midend/coverage.h"
10
11#include "backends/p4tools/modules/testgen/core/program_info.h"
12#include "backends/p4tools/modules/testgen/core/symbolic_executor/symbolic_executor.h"
13
14namespace P4::P4Tools::P4Testgen {
15
25 public:
29 void runImpl(const Callback &callBack, ExecutionStateReference state) override;
30
33
34 private:
38 uint64_t stepsWithoutTest = 0;
39
41 static const uint64_t MAX_STEPS_WITHOUT_TEST = 1000;
42
50 std::vector<Branch> potentialBranches;
51
53 // Each element on this vector represents a set of alternative choices that could have been
61 std::vector<Branch> unexploredBranches;
62
67 static std::optional<SymbolicExecutor::Branch> popPotentialBranch(
68 const P4::Coverage::CoverageSet &coverednodes,
69 std::vector<SymbolicExecutor::Branch> &candidateBranches);
70
77 [[nodiscard]] std::optional<ExecutionStateReference> pickSuccessor(StepResult successors);
78};
79
80} // namespace P4::P4Tools::P4Testgen
81
82#endif /* BACKENDS_P4TOOLS_MODULES_TESTGEN_CORE_SYMBOLIC_EXECUTOR_GREEDY_NODE_COV_H_ */
Provides a higher-level interface for an SMT solver.
Definition solver.h:24
Definition greedy_node_cov.h:24
void runImpl(const Callback &callBack, ExecutionStateReference state) override
Definition greedy_node_cov.cpp:81
GreedyNodeSelection(AbstractSolver &solver, const ProgramInfo &programInfo)
Constructor for this strategy, considering inheritance.
Definition greedy_node_cov.cpp:21
Stores target-specific information about a P4 program.
Definition core/program_info.h:21
Definition symbolic_executor.h:21
const ProgramInfo & programInfo
Target-specific information about the P4 program.
Definition symbolic_executor.h:62
AbstractSolver & solver
The SMT solver backing this executor.
Definition symbolic_executor.h:65
std::function< bool(const FinalState &)> Callback
Definition symbolic_executor.h:36
std::set< const IR::Node *, SourceIdCmp > CoverageSet
Definition coverage.h:39