private void ParseLeaks(string log) { // Leaks in Private Bytes var leakPattern = new Regex(@"!!! (\S+) LEAKED ([0-9.]+) bytes", RegexOptions.Compiled); for (var match = leakPattern.Match(log); match.Success; match = match.NextMatch()) { var leak = _leaks.Append("leak"); leak["name"] = match.Groups[1].Value; leak["bytes"] = match.Groups[2].Value; } // Leaks in Process and Managed Heaps var leakTypePattern = new Regex(@"!!! (\S+) LEAKED ([0-9.]+) ([^ ]*) bytes", RegexOptions.Compiled); for (var match = leakTypePattern.Match(log); match.Success; match = match.NextMatch()) { var leak = _leaks.Append("leak"); leak["name"] = match.Groups[1].Value; leak["bytes"] = match.Groups[2].Value; leak["type"] = match.Groups[3].Value; } // Handle leaks var leakHandlesPattern = new Regex(@"!!! (\S+) HANDLE-LEAKED ([.0-9]+) (\S+)", RegexOptions.Compiled); for (var match = leakHandlesPattern.Match(log); match.Success; match = match.NextMatch()) { var leak = _leaks.Append("leak"); leak["name"] = match.Groups[1].Value; leak["handles"] = match.Groups[2].Value; leak["type"] = match.Groups[3].Value; } }
public Nightly() { _nightly = new Xml("nightly"); _failures = _nightly.Append("failures"); _leaks = _nightly.Append("leaks"); // Locate relevant directories. var nightlyDir = GetNightlyDir(); _logDir = Path.Combine(nightlyDir, "Logs"); // First guess at working directory _skylineTesterDir = Path.Combine(nightlyDir, "SkylineTesterForNightly"); // Default duration. _duration = TimeSpan.FromHours(9); }
private void ParseFailures(string log) { var startFailure = new Regex(@"\r\n!!! (\S+) FAILED\r\n", RegexOptions.Compiled); var endFailure = new Regex(@"\r\n!!!\r\n", RegexOptions.Compiled); var failureTest = new Regex(@"\r\n\[(\d\d:\d\d)\] +(\d+).(\d+) +(\S+)\s+\(+(\S+)\)", RegexOptions.Compiled | RegexOptions.RightToLeft); for (var startMatch = startFailure.Match(log); startMatch.Success; startMatch = startMatch.NextMatch()) { var name = startMatch.Groups[1].Value; var endMatch = endFailure.Match(log, startMatch.Index); var failureTestMatch = failureTest.Match(log, startMatch.Index); var timestamp = failureTestMatch.Groups[1].Value; var passId = failureTestMatch.Groups[2].Value; var testId = failureTestMatch.Groups[3].Value; var language = failureTestMatch.Groups[5].Value; if (string.IsNullOrEmpty(passId) || string.IsNullOrEmpty(testId)) { continue; } var failureDescription = log.Substring(startMatch.Index + startMatch.Length, endMatch.Index - startMatch.Index - startMatch.Length); var failure = _failures.Append("failure"); failure["name"] = name; failure["timestamp"] = timestamp; failure["pass"] = passId; failure["test"] = testId; failure["language"] = language; failure.Set(Environment.NewLine + failureDescription + Environment.NewLine); } }
private int ParseTests(string log, bool storeXml = true) { var startTest = new Regex(@"\r\n\[(\d\d:\d\d)\] +(\d+).(\d+) +(\S+) +\((\w\w)\) ", RegexOptions.Compiled); string lastPass = null; int testCount = 0; for (var startMatch = startTest.Match(log); startMatch.Success; startMatch = startMatch.NextMatch()) { var lineProperties = new TestLogLineProperties(startMatch, log); if (!lineProperties.IsEnded) { continue; } if (lastPass != lineProperties.PassId) { lastPass = lineProperties.PassId; if (storeXml) { _pass = _nightly.Append("pass"); _pass["id"] = lineProperties.PassId; } } if (storeXml) { var test = _pass.Append("test"); test["id"] = lineProperties.TestId; test["name"] = lineProperties.Name; test["language"] = lineProperties.Language; test["timestamp"] = lineProperties.Timestamp; test["duration"] = lineProperties.Duration; test["managed"] = lineProperties.Managed; if (!string.IsNullOrEmpty(lineProperties.Heaps)) { test["committed"] = lineProperties.Heaps; } test["total"] = lineProperties.Total; if (!string.IsNullOrEmpty(lineProperties.UserGdiHandles)) { test["user_gdi"] = lineProperties.UserGdiHandles; } if (!string.IsNullOrEmpty(lineProperties.TotalHandles)) { test["handles"] = lineProperties.TotalHandles; } } testCount++; } return(testCount); }
private void ParseLeaks(string log) { var leakPattern = new Regex(@"!!! (\S+) LEAKED (\d+) bytes", RegexOptions.Compiled); for (var match = leakPattern.Match(log); match.Success; match = match.NextMatch()) { var leak = _leaks.Append("leak"); leak["name"] = match.Groups[1].Value; leak["bytes"] = match.Groups[2].Value; } var leakHandlesPattern = new Regex(@"!!! (\S+) HANDLE-LEAKED ([.0-9]+) (\S+)", RegexOptions.Compiled); for (var match = leakHandlesPattern.Match(log); match.Success; match = match.NextMatch()) { var leak = _leaks.Append("leak"); leak["name"] = match.Groups[1].Value; leak["handles"] = match.Groups[2].Value; leak["type"] = match.Groups[3].Value; } }
private int ParseTests(string log, bool storeXml = true) { var startTest = new Regex(@"\r\n\[(\d\d:\d\d)\] +(\d+).(\d+) +(\S+) +\((\w\w)\) ", RegexOptions.Compiled); var endTest = new Regex(@" \d+ failures, ([\.\d]+)/([\.\d]+) MB, (\d+) sec\.\r\n", RegexOptions.Compiled); string lastPass = null; int testCount = 0; for (var startMatch = startTest.Match(log); startMatch.Success; startMatch = startMatch.NextMatch()) { var timestamp = startMatch.Groups[1].Value; var passId = startMatch.Groups[2].Value; var testId = startMatch.Groups[3].Value; var name = startMatch.Groups[4].Value; var language = startMatch.Groups[5].Value; var endMatch = endTest.Match(log, startMatch.Index); var managed = endMatch.Groups[1].Value; var total = endMatch.Groups[2].Value; var duration = endMatch.Groups[3].Value; if (string.IsNullOrEmpty(managed) || string.IsNullOrEmpty(total) || string.IsNullOrEmpty(duration)) { continue; } if (lastPass != passId) { lastPass = passId; if (storeXml) { _pass = _nightly.Append("pass"); _pass["id"] = passId; } } if (storeXml) { var test = _pass.Append("test"); test["id"] = testId; test["name"] = name; test["language"] = language; test["timestamp"] = timestamp; test["duration"] = duration; test["managed"] = managed; test["total"] = total; } testCount++; } return(testCount); }
public Nightly(RunMode runMode, string decorateSrcDirName = null) { _runMode = runMode; _nightly = new Xml("nightly"); _failures = _nightly.Append("failures"); _leaks = _nightly.Append("leaks"); // Locate relevant directories. var nightlyDir = GetNightlyDir(); _logDir = Path.Combine(nightlyDir, "Logs"); // Clean up after any old screengrab directories var logDirScreengrabs = Path.Combine(_logDir, "NightlyScreengrabs"); if (Directory.Exists(logDirScreengrabs)) { Directory.Delete(logDirScreengrabs, true); } // First guess at working directory - distinguish between run types for machines that do double duty _skylineTesterDir = Path.Combine(nightlyDir, "SkylineTesterForNightly_" + runMode + (decorateSrcDirName ?? string.Empty)); // Default duration. _duration = TimeSpan.FromHours(DEFAULT_DURATION_HOURS); }