Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[p4Tools and p4Testgen] New exploration strategy for test generation #3566

Merged
merged 5 commits into from
Oct 19, 2022

Conversation

hannelita
Copy link
Contributor

New exploration strategy combining random exploration and max coverage.

[no-jira]

Copy link
Collaborator

@fruffy fruffy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some nits, can not comment too much on the core algorithm.

/// path.
using Callback = std::function<bool(const FinalState&)>;

using Branch = ExplorationStrategy::Branch;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Redeclaring these types is not needed iirc.

backends/p4tools/testgen/options.h Show resolved Hide resolved
@@ -84,11 +85,14 @@ int Testgen::mainImpl(const IR::P4Program* program) {
auto symExec = [&solver, &programInfo, seed]() -> ExplorationStrategy* {
std::string explorationStrategy = TestgenOptions::get().explorationStrategy;
if (explorationStrategy.compare("randomAccessStack") == 0) {
// If the user mistakenly specifies an invalid popLevel, we set it to 3.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we also emit a warning here? For all these cases where the user is mistaken.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh I was actually referring to the line below, which silently overrides the inputs.

@@ -97,6 +104,14 @@ int Testgen::mainImpl(const IR::P4Program* program) {
if (explorationStrategy.compare("maxCoverage") == 0) {
return new IncrementalMaxCoverageStack(solver, *programInfo, seed);
}
if (explorationStrategy.compare("randomAccessMaxCoverage") == 0) {
// If the user mistakenly sets and invalid saddlePoint, we set it to 5.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// If the user mistakenly sets and invalid saddlePoint, we set it to 5.
// If the user mistakenly sets an invalid saddlePoint, we set it to 5.

}

// If there's no element in bufferUnexploredBranches with the particular coverage
// we calculate, we'll insert a new key at bufferUnexploredBranches
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing dot, this time for real.

@fruffy fruffy merged commit 83e6aaf into p4lang:main Oct 19, 2022
@hannelita hannelita deleted the ht/toolsRandomExplMaxCov branch October 19, 2022 21:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants