From da1ffebcb02e9072991463335aea4ec22fe93cfd Mon Sep 17 00:00:00 2001 From: Andrew Noyes Date: Wed, 3 Aug 2022 17:14:33 -0700 Subject: [PATCH] Improve test harness logging when there are no trace files (#7785) * Log OldBinary even if there are no trace files DeterminismCheck and OldBinary attributes don't actually depend on information in the ProgramStart event, so we can add them unconditionally. * Add JoshuaSeed attribute to Test element in test harness * Add NoTraceFilesFound event in test harness There's already something similar: NoTraceFileGenerated. It appears that the original author only wants to log that if the process exited 0 though. I'm not sure what the reason for that is so I think it's safer to add a new event. This will make it more clear if say an old binary is corrupt. --- contrib/TestHarness/Program.cs | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/contrib/TestHarness/Program.cs b/contrib/TestHarness/Program.cs index 9bd3d6df18..a31a6d6382 100644 --- a/contrib/TestHarness/Program.cs +++ b/contrib/TestHarness/Program.cs @@ -788,6 +788,13 @@ namespace SummarizeTest string firstRetryableError = ""; int stderrSeverity = (int)Magnesium.Severity.SevError; + xout.Add(new XAttribute("DeterminismCheck", expectedUnseed != -1 ? "1" : "0")); + xout.Add(new XAttribute("OldBinary", Path.GetFileName(oldBinaryName))); + + if (traceFiles.Length == 0) { + xout.Add(new XElement("NoTraceFilesFound")); + } + Dictionary, Magnesium.Severity> severityMap = new Dictionary, Magnesium.Severity>(); var codeCoverage = new Dictionary, bool>(); @@ -824,9 +831,7 @@ namespace SummarizeTest new XAttribute("RandomSeed", ev.Details.RandomSeed), new XAttribute("SourceVersion", ev.Details.SourceVersion), new XAttribute("Time", ev.Details.ActualTime), - new XAttribute("BuggifyEnabled", ev.Details.BuggifyEnabled), - new XAttribute("DeterminismCheck", expectedUnseed != -1 ? "1" : "0"), - new XAttribute("OldBinary", Path.GetFileName(oldBinaryName))); + new XAttribute("BuggifyEnabled", ev.Details.BuggifyEnabled)); testBeginFound = true; if (ev.DDetails.ContainsKey("FaultInjectionEnabled")) xout.Add(new XAttribute("FaultInjectionEnabled", ev.Details.FaultInjectionEnabled)); @@ -959,6 +964,12 @@ namespace SummarizeTest xout.Add(new XElement(externalError, new XAttribute("Severity", (int)Magnesium.Severity.SevError))); } + string joshuaSeed = System.Environment.GetEnvironmentVariable("JOSHUA_SEED"); + + if (joshuaSeed != null) { + xout.Add(new XAttribute("JoshuaSeed", joshuaSeed)); + } + foreach(var kv in codeCoverage) { var element = new XElement("CodeCoverage", new XAttribute("File", kv.Key.Item1), new XAttribute("Line", kv.Key.Item2));