@@ -61,22 +61,27 @@ trait GoVerifier extends StrictLogging {
6161 * Additionally statistics are collected with the StatsCollector reporter class
6262 */
6363 def verifyAllPackages (config : Config )(executor : GobraExecutionContext ): VerifierResult = {
64+ def addPlural (n : Int ): String = if (n != 1 ) " s" else " "
6465 val statsCollector = StatsCollector (config.reporter)
6566 var warningCount : Int = 0
6667 var allVerifierErrors : Vector [VerifierError ] = Vector ()
6768 var allTimeoutErrors : Vector [TimeoutError ] = Vector ()
69+ val isVerifyingMultiplePackages = config.packageInfoInputMap.size != 1
6870
6971 // write report to file on shutdown, this makes sure a report is produced even if a run is shutdown
7072 // by some signal.
7173 Runtime .getRuntime.addShutdownHook(new Thread () {
7274 override def run (): Unit = {
73- val statsFile = config.gobraDirectory.resolve(" stats.json" ).toFile
74- logger.info(" Writing report to " + statsFile.getPath)
75- val wroteFile = statsCollector.writeJsonReportToFile(statsFile)
76- if (! wroteFile) {
77- logger.error(s " Could not write to the file $statsFile. Check whether the permissions to the file allow writing to it. " )
75+ config.gobraDirectory match {
76+ case Some (path) =>
77+ val statsFile = path.resolve(" stats.json" ).toFile
78+ logger.info(" Writing report to " + statsFile.getPath)
79+ val wroteFile = statsCollector.writeJsonReportToFile(statsFile)
80+ if (! wroteFile) {
81+ logger.error(s " Could not write to the file $statsFile. Check whether the permissions to the file allow writing to it. " )
82+ }
83+ case _ =>
7884 }
79-
8085 // Report timeouts that were not previously reported
8186 statsCollector.getTimeoutErrorsForNonFinishedTasks.foreach(err => logger.error(err.formattedMessage))
8287 }
@@ -95,10 +100,12 @@ trait GoVerifier extends StrictLogging {
95100 warningCount += warnings.size
96101 warnings.foreach(w => logger.debug(w))
97102
103+ val suffix = if (isVerifyingMultiplePackages) s " in package $pkgId" else " "
98104 result match {
99- case VerifierResult .Success => logger.info(s " $name found no errors " )
105+ case VerifierResult .Success =>
106+ logger.info(s " $name found 0 errors $suffix. " )
100107 case VerifierResult .Failure (errors) =>
101- logger.error(s " $name has found ${errors.length} error(s) in package $pkgId " )
108+ logger.error(s " $name found ${errors.length} error ${addPlural(errors.length)}$suffix . " )
102109 if (config.noStreamErrors) {
103110 errors.foreach(err => logger.error(s " \t ${err.formattedMessage}" ))
104111 }
@@ -109,7 +116,7 @@ trait GoVerifier extends StrictLogging {
109116 Await .result(future, config.packageTimeout)
110117 } catch {
111118 case _ : TimeoutException =>
112- logger.error(s " The verification of package $pkgId got terminated after " + config.packageTimeout.toString )
119+ logger.error(s " The verification of package $pkgId timed out after ${ config.packageTimeout} . " )
113120 statsCollector.report(VerificationTaskFinishedMessage (pkgId))
114121 val errors = statsCollector.getTimeoutErrors(pkgId)
115122 errors.foreach(err => logger.error(err.formattedMessage))
@@ -119,24 +126,33 @@ trait GoVerifier extends StrictLogging {
119126
120127 // Print statistics for caching
121128 if (config.cacheFile.isDefined) {
122- logger.debug(s " Number of cacheable Viper member(s) : ${statsCollector.getNumberOfCacheableViperMembers}" )
123- logger.debug(s " Number of cached Viper member(s) : ${statsCollector.getNumberOfCachedViperMembers}" )
129+ logger.debug(s " Number of cacheable Viper members : ${statsCollector.getNumberOfCacheableViperMembers}" )
130+ logger.debug(s " Number of cached Viper members : ${statsCollector.getNumberOfCachedViperMembers}" )
124131 }
125132
126133 // Print general statistics
127- logger.debug(s " Gobra has found ${statsCollector.getNumberOfVerifiableMembers} methods and functions " )
128- logger.debug(s " ${statsCollector.getNumberOfSpecifiedMembers} have specification " )
129- logger.debug(s " ${statsCollector.getNumberOfSpecifiedMembersWithAssumptions} are assumed to be satisfied " )
134+ logger.debug(s " Gobra found ${statsCollector.getNumberOfVerifiableMembers} methods and functions. " )
135+ logger.debug{
136+ val specMem = statsCollector.getNumberOfSpecifiedMembers
137+ s " $specMem member ${addPlural(specMem)} are explicitly specified. "
138+ }
139+ logger.debug{
140+ val memAssum = statsCollector.getNumberOfSpecifiedMembersWithAssumptions
141+ val isOrAre = if (memAssum != 1 ) " are" else " is"
142+ s " $memAssum specified member ${addPlural(memAssum)} of the package under verification $isOrAre trusted or abstract. "
143+ }
130144
131145 // Print warnings
132146 if (warningCount > 0 ) {
133- logger.info (s " $name has found $warningCount warning(s) " )
147+ logger.debug (s " $name reported $warningCount warning ${addPlural(warningCount)} . " )
134148 }
135149
136150 // Print errors
137- logger.info(s " $name has found ${allVerifierErrors.size} error(s) " )
151+ if (isVerifyingMultiplePackages) {
152+ logger.info(s " $name found ${allVerifierErrors.size} error ${addPlural(allVerifierErrors.size)} across all verified packages. " )
153+ }
138154 if (allTimeoutErrors.nonEmpty) {
139- logger.info(s " The verification of ${allTimeoutErrors.size} members timed out " )
155+ logger.info(s " The verification of ${allTimeoutErrors.size} member ${addPlural(allTimeoutErrors.size)} timed out. " )
140156 }
141157
142158 val allErrors = allVerifierErrors ++ allTimeoutErrors
@@ -362,7 +378,7 @@ object GobraRunner extends GobraFrontend with StrictLogging {
362378 }
363379 } catch {
364380 case e : UglyErrorMessage =>
365- logger.error(s " ${verifier.name} has found 1 error(s) : " )
381+ logger.error(s " ${verifier.name} has found 1 error: " )
366382 logger.error(s " \t ${e.error.formattedMessage}" )
367383 exitCode = 1
368384 case e : LogicException =>
0 commit comments