コード例 #1
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);
        }
コード例 #2
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);
        }
コード例 #3
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;
            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());
        }
コード例 #4
0
        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()));
        }
コード例 #5
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);
        }
コード例 #6
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()));
        }