コード例 #1
0
        private static bool Run(string[] args)
        {
            if (args.Length < 1)
            {
                return(Print(Usage));
            }

            var newArgs = args.Skip(1).ToArray();

            switch (args[0])
            {
            case "ins":
            case "insert":
                return(Inserter.Run(newArgs));

            case "res":
            case "restore":
                return(Restorer.Run(newArgs));

            case "cov":
            case "coverage":
                return(CoverageDisplay.Run(newArgs));

            case "dup":
            case "duplicate":
                return(DuplicationDetector.Run(newArgs));

            case "path":
                return(PathAnalyzer.Run(newArgs));

            case "loc":
            case "localize":
                return(BugLocalizer.Run(newArgs));

            case "klee":
                return(KleeBugLocalizer.Run(newArgs));

            case "line_insert":
            case "lins":
                return(LineInserter.Run(newArgs));

            case "klee_main":
            case "kmain":
                return(KleeMain.Run(newArgs));

            case "line_map":
            case "lmap":
                return(LineMapCreater.Run(newArgs));
            }
            return(Print(Usage));
        }
コード例 #2
0
        private static void Localize(
            DirectoryInfo rootDir, DirectoryInfo testDir,
            string metricsFilePath, DirectoryInfo csvDir,
            FileInfo passFile)
        {
            var formatter   = new BinaryFormatter();
            var covInfoFile = FileUtil.GetCoverageInfo(rootDir);
            var covInfo     = CoverageInfo.Read(covInfoFile, formatter);
            var testInfo    = AnalyzeKleeTestFiles(testDir);

            if (passFile != null)
            {
                AnalyzeTestResultCsv(passFile, testInfo);
            }
            else
            {
                AnalyzeTestResult(rootDir, testInfo);
            }

            //Line対応のMapのMapを作成、
            var lineDic     = new Dictionary <FileInfo, Dictionary <int, int> >();
            var mapFileInfo = new FileInfo(rootDir.FullName + "/" + OccfNames.LineMapping);

            if (mapFileInfo.Exists)
            {
                lineDic = MapDicCreater(mapFileInfo);
            }
            else
            {
                Console.WriteLine("\"" + OccfNames.LineMapping + "\" file is not found.");
            }

            var localizeStatements =
                BugLocalizer.LocalizeStatements(covInfo, testInfo, metricsFilePath)
                .ToList();

            BugLocalizer.ShowLocalizeStatements(localizeStatements, lineDic, metricsFilePath);

            if (csvDir != null)
            {
                BugLocalizer.LocalizeStatementsCsv(csvDir, localizeStatements, lineDic);
            }
        }