-
Notifications
You must be signed in to change notification settings - Fork 35
Expand file tree
/
Copy pathOptions.cs
More file actions
90 lines (84 loc) · 3.54 KB
/
Options.cs
File metadata and controls
90 lines (84 loc) · 3.54 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
using System.IO;
using VSharp.Interpreter.IL;
namespace VSharp
{
/// <summary>
/// Symbolic virtual machine execution mode.
/// </summary>
public enum ExecutionMode
{
/// <summary>
/// Pure symbolic execution. Cannot cope with external dependencies in code.
/// </summary>
Symbolic,
/// <summary>
/// (Experimental) Concrete and symbolic execution combination. Allows to explore code with external dependencies by
/// instantiating concrete objects.
/// </summary>
Concolic
}
/// <summary>
///
/// </summary>
public enum SearchStrategy
{
DFS,
BFS,
ShortestDistance
}
/// <summary>
/// Parameters of the test generation run.
/// </summary>
/// <param name="OutputDirectory">Directory to place generated <c>*.vst</c> tests. If <c>null</c> or empty, process working directory is used.
/// <c>null</c> by default. </param>
/// <param name="SearchStrategy"></param>
/// <param name="ExecutionMode">Symbolic virtual machine execution mode. <see cref="F:ExecutionMode.Symbolic"/> by default.</param>
/// <param name="GuidedSearch"></param>
/// <param name="RecThreshold"></param>
/// <param name="Timeout">Timeout for code exploration in seconds. Negative value means infinite timeout (up to exhaustive coverage or user interruption).
/// -1 by default</param>
/// <param name="IsConstraintIndependenceEnabled">If true, constraint independence optimization is enabled: independent constraint sets are maintained
/// during symbolic execution. In general, improves execution time. <c>true</c> by default.</param>
/// <param name="IsSolverIncrementalityEnabled">If true, SMT solver works in incremental mode during symbolic execution. May improve execution
/// time in some cases. <c>false</c> by default.</param>
/// <param name="Visualize">If true, symbolic execution process animation is saved in <c>/visualize</c> subdirectory of the <see cref="OutputDirectory"/>.</param>
public readonly record struct CoverOptions(
DirectoryInfo OutputDirectory = null,
SearchStrategy SearchStrategy = SearchStrategy.DFS,
ExecutionMode ExecutionMode = ExecutionMode.Symbolic,
bool GuidedSearch = false,
uint RecThreshold = 0u,
int Timeout = -1,
bool IsConstraintIndependenceEnabled = true,
bool IsSolverIncrementalityEnabled = false,
bool Visualize = false
)
{
internal SiliOptions ToSiliOptions(coverageZone coverageZone)
{
var searchMode = SearchStrategy switch
{
SearchStrategy.DFS => Interpreter.IL.searchMode.DFSMode,
SearchStrategy.BFS => Interpreter.IL.searchMode.BFSMode,
SearchStrategy.ShortestDistance => Interpreter.IL.searchMode.ShortestDistanceBasedMode
};
if (GuidedSearch)
{
searchMode = searchMode.NewGuidedMode(searchMode);
}
var executionMode = ExecutionMode switch
{
ExecutionMode.Symbolic => Interpreter.IL.executionMode.SymbolicMode,
ExecutionMode.Concolic => Interpreter.IL.executionMode.ConcolicMode
};
return new SiliOptions(
explorationMode.NewTestCoverageMode(coverageZone, searchMode),
executionMode,
OutputDirectory,
RecThreshold,
Timeout,
Visualize
);
}
}
}