Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlex Rønne Petersen <alexrp@xamarin.com>2017-07-20 03:23:17 +0300
committerAlex Rønne Petersen <alexrp@xamarin.com>2017-07-20 03:23:17 +0300
commitfff286cdfa20f8f886c86fa07c50e34499f8786a (patch)
treef03e5c3ceed2b1ced8db5c6d07928dfe1226c95c /acceptance-tests
parent82a7e5bb708200aa9ba8b982edd60eacedd3fd8b (diff)
[acceptance-tests] Don't mark msbiology as a failure if it OOMs on 32-bit.
This is known to happen on some platforms.
Diffstat (limited to 'acceptance-tests')
-rw-r--r--acceptance-tests/profiler-stress/runner.cs41
1 files changed, 33 insertions, 8 deletions
diff --git a/acceptance-tests/profiler-stress/runner.cs b/acceptance-tests/profiler-stress/runner.cs
index 2846c77cb49..bb03a946e74 100644
--- a/acceptance-tests/profiler-stress/runner.cs
+++ b/acceptance-tests/profiler-stress/runner.cs
@@ -38,8 +38,8 @@ namespace Mono.Profiling.Tests.Stress {
public ProcessStartInfo StartInfo { get; set; }
public Stopwatch Stopwatch { get; set; } = new Stopwatch ();
public int? ExitCode { get; set; }
- public StringBuilder StandardOutput { get; set; } = new StringBuilder ();
- public StringBuilder StandardError { get; set; } = new StringBuilder ();
+ public string StandardOutput { get; set; }
+ public string StandardError { get; set; }
}
static class Program {
@@ -59,10 +59,26 @@ namespace Mono.Profiling.Tests.Stress {
static readonly TimeSpan _timeout = TimeSpan.FromHours (10);
+ static readonly Dictionary<string, Action<TestResult>> _processors = new Dictionary<string, Action<TestResult>> () {
+ { "msbiology", Process32BitOutOfMemory },
+ };
+
static string FilterInvalidXmlChars (string text) {
return Regex.Replace (text, @"[^\x09\x0A\x0D\x20-\uD7FF\uE000-\uFFFD\u10000-\u10FFFF]", string.Empty);
}
+ static void Process32BitOutOfMemory (TestResult result)
+ {
+ if (Environment.Is64BitProcess)
+ return;
+
+ if (result.ExitCode == null || result.ExitCode == 0)
+ return;
+
+ if (result.StandardError.Contains ("OutOfMemoryException"))
+ result.ExitCode = 0;
+ }
+
static int Main ()
{
var depDir = Path.Combine ("..", "external", "benchmarker");
@@ -131,14 +147,17 @@ namespace Mono.Profiling.Tests.Stress {
using (var proc = new Process ()) {
proc.StartInfo = info;
+ var stdout = new StringBuilder ();
+ var stderr = new StringBuilder ();
+
proc.OutputDataReceived += (sender, args) => {
if (args.Data != null)
- result.StandardOutput.AppendLine (args.Data);
+ stdout.AppendLine (args.Data);
};
proc.ErrorDataReceived += (sender, args) => {
if (args.Data != null)
- result.StandardError.AppendLine (args.Data);
+ stderr.AppendLine (args.Data);
};
result.Stopwatch.Start ();
@@ -161,6 +180,9 @@ namespace Mono.Profiling.Tests.Stress {
result.ExitCode = proc.ExitCode;
result.Stopwatch.Stop ();
+
+ result.StandardOutput = stdout.ToString ();
+ result.StandardError = stderr.ToString ();
}
var resultStr = result.ExitCode == null ? "timed out" : $"exited with code: {result.ExitCode}";
@@ -174,15 +196,18 @@ namespace Mono.Profiling.Tests.Stress {
Console.WriteLine ("===== stdout =====");
Console.ResetColor ();
- Console.WriteLine (result.StandardOutput.ToString ());
+ Console.WriteLine (result.StandardOutput);
Console.ForegroundColor = ConsoleColor.Red;
Console.WriteLine ("===== stderr =====");
Console.ResetColor ();
- Console.WriteLine (result.StandardError.ToString ());
+ Console.WriteLine (result.StandardError);
}
+ if (_processors.TryGetValue (bench.Name, out var processor))
+ processor (result);
+
results.Add (result);
}
@@ -260,11 +285,11 @@ namespace Mono.Profiling.Tests.Stress {
writer.WriteStartElement ("failure");
writer.WriteStartElement ("message");
- writer.WriteCData (FilterInvalidXmlChars (result.StandardOutput.ToString ()));
+ writer.WriteCData (FilterInvalidXmlChars (result.StandardOutput));
writer.WriteEndElement ();
writer.WriteStartElement ("stack-trace");
- writer.WriteCData (FilterInvalidXmlChars (result.StandardError.ToString ()));
+ writer.WriteCData (FilterInvalidXmlChars (result.StandardError));
writer.WriteEndElement ();
writer.WriteEndElement ();