-
Notifications
You must be signed in to change notification settings - Fork 262
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
[Test Generation] Deprecate support for old command line interface #4385
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,6 +4,8 @@ | |
using System.CommandLine.Invocation; | ||
using System.Linq; | ||
using DafnyCore; | ||
using Microsoft.Boogie; | ||
|
||
// Copyright by the contributors to the Dafny Project | ||
// SPDX-License-Identifier: MIT | ||
|
||
|
@@ -23,7 +25,7 @@ public class GenerateTestsCommand : ICommandSpec { | |
BoogieOptionBag.SolverResourceLimit, | ||
BoogieOptionBag.VerificationTimeLimit, | ||
PrintBpl, | ||
DisablePrune | ||
ForcePrune | ||
}.Concat(ICommandSpec.ConsoleOutputOptions). | ||
Concat(ICommandSpec.ResolverOptions); | ||
|
||
|
@@ -57,23 +59,25 @@ public Command Create() { | |
} | ||
|
||
public void PostProcess(DafnyOptions dafnyOptions, Options options, InvocationContext context) { | ||
// IMPORTANT: Before adding new default options, make sure they are | ||
// appropriately copied over in the CopyForProcedure method above | ||
var mode = context.ParseResult.GetValueForArgument(modeArgument) switch { | ||
Mode.Path => TestGenerationOptions.Modes.Path, | ||
Mode.Block => TestGenerationOptions.Modes.Block, | ||
_ => throw new ArgumentOutOfRangeException() | ||
}; | ||
PostProcess(dafnyOptions, options, context, mode); | ||
} | ||
|
||
internal static void PostProcess(DafnyOptions dafnyOptions, Options options, InvocationContext context, TestGenerationOptions.Modes mode) { | ||
dafnyOptions.CompilerName = "cs"; | ||
dafnyOptions.Compile = true; | ||
dafnyOptions.RunAfterCompile = false; | ||
dafnyOptions.ForceCompile = false; | ||
dafnyOptions.DeprecationNoise = 0; | ||
dafnyOptions.ForbidNondeterminism = true; | ||
dafnyOptions.DefiniteAssignmentLevel = 2; | ||
dafnyOptions.TypeEncodingMethod = CoreOptions.TypeEncoding.Predicates; | ||
dafnyOptions.Set(DafnyConsolePrinter.ShowSnippets, false); | ||
|
||
var mode = context.ParseResult.GetValueForArgument(modeArgument); | ||
dafnyOptions.TestGenOptions.Mode = mode switch { | ||
Mode.Path => TestGenerationOptions.Modes.Path, | ||
Mode.Block => TestGenerationOptions.Modes.Block, | ||
_ => throw new ArgumentOutOfRangeException() | ||
}; | ||
dafnyOptions.TestGenOptions.Mode = mode; | ||
} | ||
|
||
public static readonly Option<uint> SequenceLengthLimit = new("--length-limit", | ||
|
@@ -86,8 +90,8 @@ public void PostProcess(DafnyOptions dafnyOptions, Options options, InvocationCo | |
"Print the Boogie code used during test generation.") { | ||
ArgumentHelpName = "filename" | ||
}; | ||
public static readonly Option<bool> DisablePrune = new("--no-prune", | ||
"Disable axiom pruning that Dafny uses to speed up verification.") { | ||
public static readonly Option<bool> ForcePrune = new("--force-prune", | ||
"Enable axiom pruning that Dafny uses to speed up verification. This may negatively affect the quality of tests.") { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do you have a summary of why pruning negatively affects tests? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It used to be the case that Boogie would not print the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ah, I'm glad that fix might help! |
||
}; | ||
static GenerateTestsCommand() { | ||
DafnyOptions.RegisterLegacyBinding(LoopUnroll, (options, value) => { | ||
|
@@ -99,15 +103,15 @@ static GenerateTestsCommand() { | |
DafnyOptions.RegisterLegacyBinding(PrintBpl, (options, value) => { | ||
options.TestGenOptions.PrintBpl = value; | ||
}); | ||
DafnyOptions.RegisterLegacyBinding(DisablePrune, (options, value) => { | ||
options.TestGenOptions.DisablePrune = value; | ||
DafnyOptions.RegisterLegacyBinding(ForcePrune, (options, value) => { | ||
options.TestGenOptions.ForcePrune = value; | ||
}); | ||
|
||
DooFile.RegisterNoChecksNeeded( | ||
LoopUnroll, | ||
SequenceLengthLimit, | ||
PrintBpl, | ||
DisablePrune | ||
ForcePrune | ||
); | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Old command line interface for test generation is no longer supported, all calls should use dafny generate-tests |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I hope it's possible eventually to use the same encoding as verification does, but this seems fine for now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I will hope to revert this change. The one test failing on Windows with the arguments encoding is still a mystery to me as I wasn't able to reproduce it with Boogie alone... But I will try to dig deeper into that.