예제 #1
0
파일: Host.cs 프로젝트: tupipa/vcc
        private static void VerifyFunctions(VccOptions commandLineOptions, string fileName, string baseName, FunctionVerifier fver)
        {
            double        beforeBoogie            = GetTime();
            int           numErrors               = 0;
            double        beforeMethods           = GetTime();
            bool          checkSpecificFunctions  = commandLineOptions.ExplicitTargetsGiven;
            List <string> foundFunctionSpecifiers = new List <string>();

            if (commandLineOptions.DumpBoogie)
            {
                fver.DumpInternalsToFile(baseName, true);
            }

            foreach (var func in fver.FunctionsToVerify())
            {
                if (checkSpecificFunctions)
                {
                    // check if this function has been requested either specifically or by prefix
                    bool checkThisFunction = false;
                    if (commandLineOptions.FunctionsWithExactName.Contains(func.Item2))
                    {
                        checkThisFunction = true;
                        foundFunctionSpecifiers.Add(func.Item2);
                    }
                    if (!checkThisFunction)
                    {
                        foreach (var fn in commandLineOptions.Functions)
                        {
                            var normalized = fn.Replace(':', '#');
                            if (func.Item2.StartsWith(normalized) &&
                                (normalized.Length == func.Item2.Length || func.Item2[normalized.Length] == '#'))
                            {
                                checkThisFunction = true;
                                foundFunctionSpecifiers.Add(fn);
                                break;
                            }
                        }
                    }
                    if (!checkThisFunction)
                    {
                        continue;
                    }
                }
                else if (commandLineOptions.IgnoreIncludes != null)
                {
                    bool fileFound = false;
                    if (commandLineOptions.IgnoreIncludes == "")
                    {
                        if (commandLineOptions.FileNames.Any(file => String.Equals(file, func.Item1, StringComparison.OrdinalIgnoreCase)))
                        {
                            fileFound = true;
                        }
                    }
                    else if (String.Equals(Path.GetFullPath(commandLineOptions.IgnoreIncludes), func.Item1, StringComparison.OrdinalIgnoreCase))
                    {
                        fileFound = true;
                    }

                    if (!fileFound)
                    {
                        continue;
                    }
                }

                var outcome = fver.Verify(func.Item2);
                //verificationErrorHandler.FlushErrors();

                if (commandLineOptions.DumpBoogie)
                {
                    fver.DumpInternalsToFile(baseName, false);
                }

                if (outcome == VerificationResult.Succeeded || outcome == VerificationResult.Skipped)
                {
                }
                else
                {
                    numErrors++;
                }
            }

            if (checkSpecificFunctions)
            {
                List <string> functionSpecifiers = new List <string>();
                functionSpecifiers.AddRange(commandLineOptions.Functions);
                functionSpecifiers.AddRange(commandLineOptions.FunctionsWithExactName);
                // some functions have not been encountered; warn about those
                foreach (var fn in functionSpecifiers)
                {
                    if (!foundFunctionSpecifiers.Contains(fn))
                    {
                        Logger.Instance.Error("'{0}' did not match any function.", fn);
                        errorCount++;
                    }
                }
            }

            fver.Close();
            double now = GetTime();

            var timerInfo =
                commandLineOptions.TimeStats ?
                new[] {
                Tuple.Create("total", now - startTime),
                Tuple.Create("compiler", beforeBoogie - startTime),
                Tuple.Create("boogie", beforeMethods - beforeBoogie),
                Tuple.Create("verification", now - beforeMethods)
            }
        : null;

            Logger.Instance.LogFileSummary(fileName, numErrors, timerInfo);
        }
예제 #2
0
파일: Host.cs 프로젝트: edgar-pek/VCDryad
        private static void VerifyFunctions(VccOptions commandLineOptions, string fileName, string baseName, FunctionVerifier fver)
        {
            double beforeBoogie = GetTime();
              int numErrors = 0;
              double beforeMethods = GetTime();
              bool checkSpecificFunctions = commandLineOptions.ExplicitTargetsGiven;
              List<string> foundFunctionSpecifiers = new List<string>();

              if (commandLineOptions.DumpBoogie)
              {
            fver.DumpInternalsToFile(baseName, true);
              }

              foreach (var func in fver.FunctionsToVerify())
              {

            if (checkSpecificFunctions)
            {
              // check if this function has been requested either specifically or by prefix
              bool checkThisFunction = false;
              if (commandLineOptions.FunctionsWithExactName.Contains(func.Item2))
              {
            checkThisFunction = true;
            foundFunctionSpecifiers.Add(func.Item2);
              }
              if (!checkThisFunction)
              {
            foreach (var fn in commandLineOptions.Functions)
            {
              var normalized = fn.Replace(':', '#');
              if (func.Item2.StartsWith(normalized) &&
                   (normalized.Length == func.Item2.Length || func.Item2[normalized.Length] == '#'))
              {
                checkThisFunction = true;
                foundFunctionSpecifiers.Add(fn);
                break;
              }
            }
              }
              if (!checkThisFunction) continue;
            }
            else if (commandLineOptions.IgnoreIncludes != null)
            {
              bool fileFound = false;
              if (commandLineOptions.IgnoreIncludes == "")
              {
            if (commandLineOptions.FileNames.Any(file => String.Equals(file, func.Item1, StringComparison.OrdinalIgnoreCase)))
            {
              fileFound = true;
            }
              } else if (String.Equals(Path.GetFullPath(commandLineOptions.IgnoreIncludes), func.Item1, StringComparison.OrdinalIgnoreCase))
              {
            fileFound = true;
              }

              if (!fileFound) continue;
            }

            var outcome = fver.Verify(func.Item2);
            //verificationErrorHandler.FlushErrors();

            if (commandLineOptions.DumpBoogie) {
              fver.DumpInternalsToFile(baseName, false);
            }

            if (outcome == VerificationResult.Succeeded || outcome == VerificationResult.Skipped) { } else { numErrors++; }
              }

              if (checkSpecificFunctions)
              {
            List<string> functionSpecifiers = new List<string>();
            functionSpecifiers.AddRange(commandLineOptions.Functions);
            functionSpecifiers.AddRange(commandLineOptions.FunctionsWithExactName);
            // some functions have not been encountered; warn about those
            foreach (var fn in functionSpecifiers)
            {
              if (!foundFunctionSpecifiers.Contains(fn))
              {
            Logger.Instance.Error("'{0}' did not match any function.", fn);
            errorCount++;
              }
            }
              }

              fver.Close();
              double now = GetTime();

              var timerInfo =
            commandLineOptions.TimeStats ?
              new[] {
            Tuple.Create("total", now - startTime),
            Tuple.Create("compiler", beforeBoogie - startTime),
            Tuple.Create("boogie", beforeMethods - beforeBoogie),
            Tuple.Create("verification", now - beforeMethods)
            }
            : null;

            Logger.Instance.LogFileSummary(fileName, numErrors, timerInfo);
        }