-
Notifications
You must be signed in to change notification settings - Fork 123
Expand file tree
/
Copy pathImplementationRunResult.cs
More file actions
109 lines (87 loc) · 3.7 KB
/
ImplementationRunResult.cs
File metadata and controls
109 lines (87 loc) · 3.7 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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using VC;
using VCGeneration;
namespace Microsoft.Boogie;
public sealed class ImplementationRunResult
{
private readonly Implementation implementation;
public readonly string ProgramId;
public string MessageIfVerifies => (implementation as ICarriesAttributes).FindStringAttribute("msg_if_verifies");
public string Checksum => implementation.Checksum;
public string DependenciesChecksum => implementation.DependencyChecksum;
public ISet<byte[]> AssertionChecksums => implementation.AssertionChecksums;
public DateTime Start { get; set; }
public DateTime End { get; set; }
/// <summary>
/// Gets or sets the elapsed time, excluding SMT solver setup costs.
/// (This is narrower than <c>Start - End</c>.)
/// <c>Start</c> and <c>End</c> are kept because we need them in XML reports.
/// </summary>
public TimeSpan Elapsed { get; set; }
public int ResourceCount { get; set; }
public int ProofObligationCount => ProofObligationCountAfter - ProofObligationCountBefore;
public int ProofObligationCountBefore { get; set; }
public int ProofObligationCountAfter { get; set; }
public VcOutcome VcOutcome { get; set; }
public List<Counterexample> Errors = new();
public List<VerificationRunResult> RunResults;
public ErrorInformation ErrorBeforeVerification { get; set; }
public ImplementationRunResult(Implementation implementation, string programId = null)
{
this.implementation = implementation;
ProgramId = programId;
}
public ErrorInformation GetOutcomeError(ExecutionEngineOptions options) {
return ExecutionEngine.GetOutcomeError(options, VcOutcome, implementation.VerboseName, implementation.tok, MessageIfVerifies,
TextWriter.Null, implementation.GetTimeLimit(options), Errors);
}
public String GetOutput(OutputPrinter printer,
ExecutionEngine engine,
PipelineStatistics stats, ErrorReporterDelegate er) {
var result = new StringWriter();
if (ErrorBeforeVerification != null) {
printer.WriteErrorInformation(ErrorBeforeVerification, result);
}
engine.ProcessOutcome(printer, VcOutcome, Errors, TimeIndication(engine.Options), stats,
result, implementation.GetTimeLimit(engine.Options), er, implementation.VerboseName, implementation.tok,
MessageIfVerifies);
engine.ProcessErrors(printer, Errors, VcOutcome, result, er, implementation);
return result.ToString();
}
public void ProcessXml(ExecutionEngine engine) {
if (engine.Options.XmlSink == null) {
return;
}
lock (engine.Options.XmlSink) {
engine.Options.XmlSink.WriteStartMethod(implementation.VerboseName, Start);
foreach (var vcResult in RunResults.OrderBy(s => (vcNum: s.VcNum, iteration: s.Iteration))) {
engine.Options.XmlSink.WriteSplit(vcResult.VcNum, vcResult.Iteration, vcResult.Asserts, vcResult.StartTime,
vcResult.Outcome.ToString().ToLowerInvariant(), vcResult.RunTime, vcResult.ResourceCount, vcResult.CheckInputs.TotalSize);
}
engine.Options.XmlSink.WriteEndMethod(VcOutcome.ToString().ToLowerInvariant(),
End, Elapsed,
ResourceCount);
}
}
private string TimeIndication(ExecutionEngineOptions options)
{
var result = "";
if (options.Trace)
{
result = string.Format(" [{0:F3} s, solver resource count: {1}, {2} proof obligation{3}] ",
Elapsed.TotalSeconds,
ResourceCount,
ProofObligationCount,
ProofObligationCount == 1 ? "" : "s");
}
else if (options.TraceProofObligations)
{
result = string.Format(" [{0} proof obligation{1}] ", ProofObligationCount,
ProofObligationCount == 1 ? "" : "s");
}
return result;
}
}