Exemplo n.º 1
0
        public override Presentation getRealtimePresentation(Disposition d)
        {
            if (d is Failed)
            {
                return base.getRealtimePresentation(d);
            }

            VerificationResult vr = VerificationResult.fromXmlFile(this.getOutputFile());
            PresentationBuilder pr = new PresentationBuilder();
            pr.startLine();
            pr.color(
                vr.pass ? Presentation.GREEN : Presentation.RED,
                string.Format(
                    "{0} {1} {2,5:0.0}s",
                    ////getSource().getRelativePath(),
                this.getAbstractIdentifier(),
                    vr.pass ? "Success" : "Fail",
                    vr.cpuTime));
            pr.endLine();
            if (!vr.pass)
            {
                foreach (VerificationMessage msg in vr.getMessages())
                {
                    pr.pre(msg.Message);
                }
            }

            return pr.fix();
        }
Exemplo n.º 2
0
        public override Presentation getRealtimePresentation(Disposition d)
        {
            if (d is Failed)
            {
                return(base.getRealtimePresentation(d));
            }
            VerificationResult  vr = VerificationResult.fromXmlFile(getOutputFile().getFilesystemPath());
            PresentationBuilder pr = new PresentationBuilder();

            pr.startLine();
            pr.color(
                vr.pass ? Presentation.GREEN : Presentation.RED,
                String.Format("{0} {1} {2,5:0.0}s",
                              //-getSource().getRelativePath(),
                              this.getAbstractIdentifier(),
                              (vr.pass ? "Success" : "Fail"), vr.cpuTime));
            pr.endLine();
            if (!vr.pass)
            {
                foreach (VerificationMessage msg in vr.getMessages())
                {
                    pr.pre(msg.message);
                }
            }
            return(pr.fix());
        }
Exemplo n.º 3
0
        //- Called by tool when this is the top-level output, it has generated a Fresh
        //- result, and we want to print that result on the display.
        public virtual Presentation getPresentation()
        {
            PresentationBuilder pr = new PresentationBuilder();

            pr.line("Okay.");
            return(pr.fix());
        }
Exemplo n.º 4
0
        public void addBasicPresentation()
        {
            PresentationBuilder pr = new PresentationBuilder();

            int    any_failures   = this.parseFailures + this.verificationFailures + this.timeouts;
            string overall_status = any_failures > 0 ? "Fail" : "Success";

            pr.pre(_VERIFICATION_RESULT_PLACEHOLDER + "\n");
            pr.spacer();
            pr.startHeader();
            pr.color(any_failures == 0 ? Presentation.GREEN : Presentation.RED, "Overall status: " + overall_status);
            pr.endHeader();
            pr.line(
                string.Format(
                    "{0} parse failures, {1} verification failures, {2} timeouts",
                    this._parseFailures,
                    this._verificationFailures,
                    this._timeouts));
            pr.spacer();

            foreach (VerificationMessage message in this.messages)
            {
                pr.pre(message.Message);
            }

            Presentation pres = pr.fix();

            this.addXmlFiller(pres);
        }
Exemplo n.º 5
0
        //- Called by tool when we want a short (one-line)
        //- summary for showing in-progress results.
        public virtual Presentation getRealtimePresentation(Disposition d)
        {
            PresentationBuilder pr = new PresentationBuilder();

            pr.startLine();
            pr.color(
                d is Fresh ? Presentation.GREEN : Presentation.RED,
                ToString() + " " + d.ToString());
            pr.endLine();
            if (d is Failed)
            {
                //- This isn't a verification failure, a tool itself broke.
                //- Provide that report.
                foreach (string m in d.getMessages())
                {
                    pr.pre(Presentation.abbreviateLines(m));
                }
            }
            return(pr.fix());
        }
Exemplo n.º 6
0
        public void addBasicPresentation()
        {
            PresentationBuilder pr = new PresentationBuilder();

            int    any_failures   = parseFailures + verificationFailures + timeouts;
            string overall_status = any_failures > 0 ? "Fail" : "Success";

            pr.pre("Git info goes here.\n");
            pr.spacer();
            pr.startHeader();
            pr.color(any_failures == 0 ? Presentation.GREEN : Presentation.RED, "Overall status: " + overall_status);
            pr.endHeader();
            pr.line(String.Format("{0} parse failures, {1} verification failures, {2} timeouts",
                                  _parseFailures, _verificationFailures, _timeouts));
            pr.spacer();

            foreach (VerificationMessage message in messages)
            {
                pr.pre(message.message);
            }
            Presentation pres = pr.fix();

            addXmlFiller(pres);
        }
        public override IVerbWorker getWorker(WorkingDirectory workingDirectory)
        {
            // Read and aggregate all the input results.
            int parseFailures = 0;
            int verificationFailures = 0;
            int timeouts = 0;
            int filesWithParseFailures = 0;
            int filesWithVerificationFailures = 0;
            int filesWithTimeouts = 0;
            int passCount = 0;
            int failCount = 0;
            double cpuTime = 0;
            List<VerificationMessage> failMessages = new List<VerificationMessage>();
            List<VerificationResult> results = new List<VerificationResult>();

            // REVIEW: Why pull out the enumerator this way?
            IEnumerable<BuildObject> verificationResultsEnumerator = this.verificationResults;
            foreach (BuildObject verificationResult in verificationResultsEnumerator)
            {
                VerificationResult vr = VerificationResult.fromXmlFile(verificationResult);
                results.Add(vr);
                if (vr == null)
                {
                    return new VerbSyncWorker(
                        workingDirectory,
                        new Failed("Build system broke: missing VerificationResult for " + verificationResult));
                }

                if (vr.pass)
                {
                    passCount += 1;
                }
                else
                {
                    failCount += 1;
                    failMessages.AddRange(vr.getMessages());
                }

                parseFailures += vr.parseFailures;
                verificationFailures += vr.verificationFailures;
                timeouts += vr.timeouts;
                filesWithParseFailures += vr.parseFailures > 0 ? 1 : 0;
                filesWithVerificationFailures += vr.verificationFailures > 0 ? 1 : 0;
                filesWithTimeouts += vr.timeouts > 0 ? 1 : 0;
                ////Logger.WriteLine("Synthesizing cpuTime from " + verificationResult);
                cpuTime += vr.cpuTime;
            }

            bool allPass = failCount == 0;

            PresentationBuilder pr = new PresentationBuilder();

            int any_failures = parseFailures + verificationFailures + timeouts;
            string overall_status = any_failures > 0 ? "Fail" : "Success";

            pr.pre(VerificationResult._VERIFICATION_RESULT_PLACEHOLDER+"\n");
            pr.spacer();
            pr.startHeader();
            pr.color(this.colorByFailureCount(any_failures), "Overall status: " + overall_status);
            pr.endHeader();
            pr.line("Count of files with failures: " + failCount);
            pr.startBullet();
            pr.color(this.colorByFailureCount(filesWithParseFailures), "Files with parse failures: " + filesWithParseFailures.ToString());
            pr.endBullet();
            pr.startBullet();
            pr.color(this.colorByFailureCount(filesWithVerificationFailures), "Files with verification failures: " + filesWithVerificationFailures.ToString());
            pr.endBullet();
            pr.startBullet();
            pr.color(this.colorByFailureCount(filesWithTimeouts), "Files with timeouts: " + filesWithTimeouts.ToString());
            pr.endBullet();

            pr.spacer();
            pr.header(string.Format("Total processing time: {0:0.0}s {1}", cpuTime, new TimeSpan((long)(cpuTime * 10000000L))));
            int top_n = 10;
            pr.header(string.Format("Slowest {0} verifications:", top_n));

            results.Sort(this.ByCpuTimeDecreasing);
            foreach (VerificationResult slowResult in results.Take(top_n))
            {
                pr.startBullet();
                pr.color(
                    this.colorByFailureCount(slowResult.pass ? 0 : 1),
                    string.Format("{0,6:##0.0}s {1}", slowResult.cpuTime, slowResult.sourceLabel));
                pr.endBullet();
            }

            foreach (VerificationMessage message in failMessages)
            {
                pr.spacer();
                pr.header("Failure with " + message.SourceLabel);
                pr.pre(message.Message);
            }

            Presentation pres = pr.fix();

            VerificationResult outvr = new VerificationResult("summary", allPass, cpuTime, parseFailures, verificationFailures, timeouts, failMessages);
            outvr.addXmlFiller(pres);
            outvr.toXmlFile(workingDirectory.PathTo(this.outputObject));
            this.setWasRejectableFailure(!outvr.pass);
            return new VerbSyncWorker(workingDirectory, new Fresh());
        }
        public override IVerbWorker getWorker()
        {
            //- read and aggregate all the input results.
            int    parseFailures                 = 0;
            int    verificationFailures          = 0;
            int    timeouts                      = 0;
            int    filesWithParseFailures        = 0;
            int    filesWithVerificationFailures = 0;
            int    filesWithTimeouts             = 0;
            int    passCount                     = 0;
            int    failCount                     = 0;
            double cpuTime = 0;
            List <VerificationMessage> failMessages = new List <VerificationMessage>();
            List <VerificationResult>  results      = new List <VerificationResult>();

            IEnumerable <BuildObject> verificationResults = verification_results;

            foreach (BuildObject verificationResult in verificationResults)
            {
                VerificationResult vr = VerificationResult.fromXmlFile(verificationResult.getFilesystemPath());
                results.Add(vr);
                if (vr == null)
                {
                    return(new VerbSyncWorker(
                               new Failed("Build system broke: missing VerificationResult for " + verificationResult)));
                }
                if (vr.pass)
                {
                    passCount += 1;
                }
                else
                {
                    failCount += 1;
                    failMessages.AddRange(vr.getMessages());
                }
                parseFailures                 += vr.parseFailures;
                verificationFailures          += vr.verificationFailures;
                timeouts                      += vr.timeouts;
                filesWithParseFailures        += vr.parseFailures > 0 ? 1 : 0;
                filesWithVerificationFailures += vr.verificationFailures > 0 ? 1 : 0;
                filesWithTimeouts             += vr.timeouts > 0 ? 1 : 0;
                //-Logger.WriteLine("Synthesizing cpuTime from " + verificationResult);
                cpuTime += vr.cpuTime;
            }
            bool allPass = failCount == 0;

            PresentationBuilder pr = new PresentationBuilder();

            int    any_failures   = parseFailures + verificationFailures + timeouts;
            string overall_status = any_failures > 0 ? "Fail" : "Success";

            pr.pre("Git info goes here.\n");
            pr.spacer();
            pr.startHeader();
            pr.color(colorByFailureCount(any_failures), "Overall status: " + overall_status);
            pr.endHeader();
            pr.line("Count of files with failures: " + failCount);
            pr.startBullet();
            pr.color(colorByFailureCount(filesWithParseFailures), "Files with parse failures: " + filesWithParseFailures.ToString());
            pr.endBullet();
            pr.startBullet();
            pr.color(colorByFailureCount(filesWithVerificationFailures), "Files with verification failures: " + filesWithVerificationFailures.ToString());
            pr.endBullet();
            pr.startBullet();
            pr.color(colorByFailureCount(filesWithTimeouts), "Files with timeouts: " + filesWithTimeouts.ToString());
            pr.endBullet();

            pr.spacer();
            pr.header(String.Format("Total processing time: {0:0.0}s {1}", cpuTime, new TimeSpan((long)(cpuTime * 10000000L))));
            int top_n = 10;

            pr.header(String.Format("Slowest {0} verifications:", top_n));

            results.Sort(ByCpuTimeDecreasing);
            foreach (VerificationResult slowResult in results.Take(top_n))
            {
                pr.startBullet();
                pr.color(colorByFailureCount(slowResult.pass ? 0 : 1),
                         String.Format("{0,6:##0.0}s {1}", slowResult.cpuTime, slowResult.sourceLabel));
                pr.endBullet();
            }

            foreach (VerificationMessage message in failMessages)
            {
                pr.spacer();
                pr.header("Failure with " + message.sourceLabel);
                pr.pre(message.message);
            }
            Presentation pres = pr.fix();

            VerificationResult outvr = new VerificationResult("summary", allPass, cpuTime, parseFailures, verificationFailures, timeouts, failMessages);

            outvr.addXmlFiller(pres);
            outvr.toXmlFile(this.outputObject.getFilesystemPath());
            setWasVerificationTimeout(outvr.wasOnlyTimeouts());
            return(new VerbSyncWorker(new Fresh()));
        }
Exemplo n.º 9
0
        public void addBasicPresentation()
        {
            PresentationBuilder pr = new PresentationBuilder();

            int any_failures = this.parseFailures + this.verificationFailures + this.timeouts;
            string overall_status = any_failures > 0 ? "Fail" : "Success";

            pr.pre(_VERIFICATION_RESULT_PLACEHOLDER+"\n");
            pr.spacer();
            pr.startHeader();
            pr.color(any_failures == 0 ? Presentation.GREEN : Presentation.RED, "Overall status: " + overall_status);
            pr.endHeader();
            pr.line(
                string.Format(
                    "{0} parse failures, {1} verification failures, {2} timeouts",
                    this._parseFailures,
                    this._verificationFailures,
                    this._timeouts));
            pr.spacer();

            foreach (VerificationMessage message in this.messages)
            {
                pr.pre(message.Message);
            }

            Presentation pres = pr.fix();
            this.addXmlFiller(pres);
        }
Exemplo n.º 10
0
        public override IVerbWorker getWorker(WorkingDirectory workingDirectory)
        {
            // Read and aggregate all the input results.
            int    parseFailures                 = 0;
            int    verificationFailures          = 0;
            int    timeouts                      = 0;
            int    filesWithParseFailures        = 0;
            int    filesWithVerificationFailures = 0;
            int    filesWithTimeouts             = 0;
            int    passCount                     = 0;
            int    failCount                     = 0;
            double cpuTime      = 0;
            string failedFiles  = "";
            string timeoutFiles = "";
            string parseFiles   = "";
            List <VerificationMessage> failMessages = new List <VerificationMessage>();
            List <VerificationResult>  results      = new List <VerificationResult>();

            // REVIEW: Why pull out the enumerator this way?
            IEnumerable <BuildObject> verificationResultsEnumerator = this.verificationResults;

            foreach (BuildObject verificationResult in verificationResultsEnumerator)
            {
                VerificationResult vr = VerificationResult.fromXmlFile(verificationResult);
                results.Add(vr);
                if (vr == null)
                {
                    return(new VerbSyncWorker(
                               workingDirectory,
                               new Failed("Build system broke: missing VerificationResult for " + verificationResult)));
                }

                if (vr.pass)
                {
                    passCount += 1;
                }
                else
                {
                    failCount += 1;
                    failMessages.AddRange(vr.getMessages());
                }

                parseFailures                 += vr.parseFailures;
                verificationFailures          += vr.verificationFailures;
                timeouts                      += vr.timeouts;
                filesWithParseFailures        += vr.parseFailures > 0 ? 1 : 0;
                filesWithVerificationFailures += vr.verificationFailures > 0 ? 1 : 0;
                filesWithTimeouts             += vr.timeouts > 0 ? 1 : 0;
                if (vr.verificationFailures > 0)
                {
                    failedFiles = failedFiles + vr.sourceLabel + "\n";
                }
                if (vr.timeouts > 0)
                {
                    timeoutFiles = timeoutFiles + vr.sourceLabel + "\n";
                }
                if (vr.parseFailures > 0)
                {
                    parseFiles = parseFiles + vr.sourceLabel + "\n";
                }
                ////Logger.WriteLine("Synthesizing cpuTime from " + verificationResult);
                cpuTime += vr.cpuTime;
            }

            bool allPass = failCount == 0;

            PresentationBuilder pr = new PresentationBuilder();

            int    any_failures   = parseFailures + verificationFailures + timeouts;
            string overall_status = any_failures > 0 ? "Fail" : "Success";

            pr.pre(VerificationResult._VERIFICATION_RESULT_PLACEHOLDER + "\n");
            pr.spacer();
            pr.startHeader();
            pr.color(this.colorByFailureCount(any_failures), "Overall status: " + overall_status);
            pr.endHeader();
            pr.line("Count of files with failures: " + failCount);
            pr.startBullet();
            pr.color(this.colorByFailureCount(filesWithParseFailures), "Files with parse failures: " + filesWithParseFailures.ToString());
            pr.endBullet();
            pr.startBullet();
            pr.color(this.colorByFailureCount(filesWithVerificationFailures), "Files with verification failures: " + filesWithVerificationFailures.ToString());
            pr.endBullet();
            pr.startBullet();
            pr.color(this.colorByFailureCount(filesWithVerificationFailures), "File Names with verification failures: " + failedFiles);
            pr.endBullet();
            pr.startBullet();
            pr.color(this.colorByFailureCount(filesWithTimeouts), "Files with timeouts: " + filesWithTimeouts.ToString());
            pr.endBullet();
            pr.startBullet();
            pr.color(this.colorByFailureCount(filesWithVerificationFailures), "File Names with timeout failures: " + timeoutFiles);
            pr.endBullet();
            pr.startBullet();
            pr.color(this.colorByFailureCount(filesWithParseFailures), "File Names with parse failures: " + parseFiles);
            pr.endBullet();

            pr.spacer();
            pr.header(string.Format("Total processing time: {0:0.0}s {1}", cpuTime, new TimeSpan((long)(cpuTime * 10000000L))));
            int top_n = 10;

            pr.header(string.Format("Slowest {0} verifications:", top_n));

            results.Sort(this.ByCpuTimeDecreasing);
            foreach (VerificationResult slowResult in results.Take(top_n))
            {
                pr.startBullet();
                pr.color(
                    this.colorByFailureCount(slowResult.pass ? 0 : 1),
                    string.Format("{0,6:##0.0}s {1}", slowResult.cpuTime, slowResult.sourceLabel));
                pr.endBullet();
            }

            foreach (VerificationMessage message in failMessages)
            {
                pr.spacer();
                pr.header("Failure with " + message.SourceLabel);
                pr.pre(message.Message);
            }

            Presentation pres = pr.fix();

            VerificationResult outvr = new VerificationResult("summary", allPass, cpuTime, parseFailures, verificationFailures, timeouts, failMessages);

            outvr.addXmlFiller(pres);
            outvr.toXmlFile(workingDirectory.PathTo(this.outputObject));
            this.setWasRejectableFailure(!outvr.pass);
            return(new VerbSyncWorker(workingDirectory, new Fresh()));
        }
Exemplo n.º 11
0
        // Called by tool when we want a short (one-line)
        // summary for showing in-progress results.
        public virtual Presentation getRealtimePresentation(Disposition d)
        {
            PresentationBuilder pr = new PresentationBuilder();
            pr.startLine();
            pr.color(
                d is Fresh ? Presentation.GREEN : Presentation.RED,
                this.ToString() + " " + d.ToString());
            pr.endLine();
            if (d is Failed)
            {
                // This isn't a verification failure, a tool itself broke.
                // Provide that report.
                foreach (string m in d.getMessages())
                {
                    pr.pre(Presentation.abbreviateLines(m));
                }
            }

            return pr.fix();
        }
Exemplo n.º 12
0
 // Called by tool when this is the top-level output, it has generated a Fresh
 // result, and we want to print that result on the display.
 public virtual Presentation getPresentation()
 {
     PresentationBuilder pr = new PresentationBuilder();
     pr.line("Okay.");
     return pr.fix();
 }