public override IVerbWorker getWorker(WorkingDirectory workingDirectory) { Disposition disposition = new Fresh(); if (this.verifyVerb != null) { VerificationResult verificationResult = VerificationResult.fromXmlFile(this.verifyVerb.getOutputs().Single()); if (!verificationResult.pass) { disposition = new Failed(); } } if (!(disposition is Failed)) { foreach (var o in this.buildVerb.getOutputs()) { if (o.getExtension() == ".exe") { File.Copy(workingDirectory.PathTo(o), workingDirectory.PathTo(this.exeOutput), overwrite: true); } else { var dest = this.RelocateBuildObjectToExeDirectory(o); File.Copy( workingDirectory.PathTo(o), workingDirectory.PathTo(dest), overwrite: true); } } } return(new VerbSyncWorker(workingDirectory, disposition)); }
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()); }
public override IVerbWorker getWorker() { if (verificationRequest.isComplete()) { VerificationResult vr = VerificationResult.fromXmlFile(batchSummaryVerb.getOutputFile().getRelativePath()); if (!vr.pass) { Util.Assert(false); //- Should never get here, since Ironclad app should fail before producing a verified exe return(new VerbSyncWorker(new Failed())); } } //- Copy the AppLoader binary and the bootloader into the same directory as the app's binary, so the pxe-loader can find them File.Copy(loaderVerb.getExe().getFilesystemPath(), loaderCopy.getFilesystemPath(), true); File.Copy(appVerb.getExe().getFilesystemPath(), appExecutableCopy.getFilesystemPath(), true); File.Copy(bootloader.getFilesystemPath(), bootloaderCopy.getFilesystemPath(), true); writeBootFile(); return(new VerbSyncWorker(new Fresh())); }
public override IVerbWorker getWorker() { if (verificationRequest.isComplete()) { //- If the verification succeeded, then we convert the untrusted exe into a trusted exe (via a copy) VerificationResult vr = VerificationResult.fromXmlFile(verifyResultsVerb.getOutputFile().getFilesystemPath()); if (!vr.pass) { return(new VerbSyncWorker(new Failed())); } File.Copy(srcObject.getFilesystemPath(), outputObject.getFilesystemPath(), true); //- True => Overwrite } else { UnverifiedSentinelVirtualContents contents = new UnverifiedSentinelVirtualContents(); BuildEngine.theEngine.getNuObjContents().storeVirtual(outputObject, new Fresh(), contents); } return(new VerbSyncWorker(new Fresh())); }
public override IVerbWorker getWorker(WorkingDirectory workingDirectory) { if (this.verificationRequest.isComplete()) { VerificationResult vr = VerificationResult.fromXmlFile(this.batchSummaryVerb.getOutputFile()); if (!vr.pass) { Util.Assert(false); // Should never get here, since Ironclad app should fail before producing a verified exe. return(new VerbSyncWorker(workingDirectory, new Failed())); } } // Copy the AppLoader binary and the bootloader into the same directory as the app's binary, so the pxe-loader can find them. // REVIEW: Not clear this is doing the right thing with shift to WorkingDirectory. File.Copy(workingDirectory.PathTo(this.loaderVerb.getExe()), workingDirectory.PathTo(this.loaderCopy), true); File.Copy(workingDirectory.PathTo(this.appVerb.getExe()), workingDirectory.PathTo(this.appExecutableCopy), true); File.Copy(workingDirectory.PathTo(this.bootloader), workingDirectory.PathTo(this.bootloaderCopy), true); this.writeBootFile(workingDirectory); return(new VerbSyncWorker(workingDirectory, new Fresh())); }
public override IVerbWorker getWorker(WorkingDirectory workingDirectory) { if (this.verificationRequest.isComplete()) { // If the verification succeeded, then we convert the untrusted exe into a trusted exe (via a copy). VerificationResult vr = VerificationResult.fromXmlFile(this.verifyResultsVerb.getOutputFile()); if (!vr.pass) { return(new VerbSyncWorker(workingDirectory, new Failed())); } File.Copy(workingDirectory.PathTo(this.srcObject), workingDirectory.PathTo(this.outputObject), true); // True => Overwrite } else { UnverifiedSentinelVirtualContents contents = new UnverifiedSentinelVirtualContents(); BuildEngine.theEngine.Repository.StoreVirtual(this.outputObject, new Fresh(), contents); } return(new VerbSyncWorker(workingDirectory, new Fresh())); }
public override Presentation getPresentation() { VerificationResult vr = VerificationResult.fromXmlFile(getOutputFile().getRelativePath()); return(vr.presentation); }
public override Presentation getPresentation() { VerificationResult vr = VerificationResult.fromXmlFile(this.outputObject.getFilesystemPath()); return(vr.presentation); }
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())); }
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())); }