[sgen] Add oom testing suite
authorVlad Brezae <brezaevlad@gmail.com>
Fri, 31 Mar 2017 11:48:33 +0000 (14:48 +0300)
committerVlad Brezae <brezaevlad@gmail.com>
Tue, 4 Apr 2017 22:16:46 +0000 (01:16 +0300)
mono/mini/TestHelpers.cs
mono/tests/Makefile.am
mono/tests/sgen-oom-bridge-major-fragmentation.cs [new file with mode: 0644]
mono/tests/sgen-oom-cementing-stress.cs [new file with mode: 0644]
mono/tests/sgen-oom-new-threads-dont-join-stw-2.cs [new file with mode: 0644]

index 01ed13532a10f65d0289c64e66cee1b94d5214da..26f8d1276d5988c753e34f8afb3da0f7e03cc142 100644 (file)
@@ -1,5 +1,6 @@
 using System;
 using System.Threading;
+using System.Reflection;
 
 namespace MonoTests.Helpers {
 
@@ -25,5 +26,25 @@ namespace MonoTests.Helpers {
                        thr.Join ();
                }
        }
+
+       public static class OOMHelpers {
+               public static void RunTest (string test)
+               {
+                       Assembly asm = Assembly.Load (test);
+
+                       try {
+                               // Support both (void) and (string[]) signatures
+                               if (asm.EntryPoint.GetParameters ().Length == 1)
+                                       asm.EntryPoint.Invoke (null, new string[] { null });
+                               else
+                                       asm.EntryPoint.Invoke (null, null);
+                       } catch (TargetInvocationException e) {
+                               if (e.InnerException is OutOfMemoryException)
+                                       Console.WriteLine ("Catched oom");
+                               else
+                                       throw;
+                       }
+               }
+       }
 }
 
index d5a4afca1ee11607fa87035f0a10986740bebe3e..1628d7a1a38ad7f11fd713c082cff82ce1f144e4 100644 (file)
@@ -1507,6 +1507,16 @@ sgen-bridge3-tests-ms-tarjan-bridge: $(SGEN_BRIDGE3_TESTS) test-runner.exe
 sgen-bridge3-tests-ms-split-tarjan-bridge: $(SGEN_BRIDGE3_TESTS) test-runner.exe
        $(TOOLS_RUNTIME) $(TEST_RUNNER) --testsuite-name $@ --runtime-args "--gc=sgen --gc-debug=bridge=3Bridge --gc-params=major=marksweep,minor=split,bridge-implementation=tarjan" --timeout 900 $(SGEN_BRIDGE3_TESTS)
 
+SGEN_OOM_TESTS_SRC =   \
+       sgen-oom-cementing-stress.cs    \
+       sgen-oom-new-threads-dont-join-stw-2.cs \
+       sgen-oom-bridge-major-fragmentation.cs
+
+SGEN_OOM_TESTS=$(SGEN_OOM_TESTS_SRC:.cs=.exe)
+
+sgen-oom-tests: $(SGEN_OOM_TESTS) test-runner.exe sgen-cementing-stress.exe sgen-new-threads-dont-join-stw-2.exe sgen-bridge-major-fragmentation.exe
+       $(TOOLS_RUNTIME) $(TEST_RUNNER) $(TEST_RUNNER_ARGS) --testsuite-name $@ --runtime-args "--gc=sgen --gc-debug=max-valloc-size=50M,bridge=Bridge" --disabled "$(DISABLED_TESTS)" --timeout 900 $(SGEN_OOM_TESTS)
+
 
 AOT_CONFIGURATIONS=    \
        "|regular"      \
diff --git a/mono/tests/sgen-oom-bridge-major-fragmentation.cs b/mono/tests/sgen-oom-bridge-major-fragmentation.cs
new file mode 100644 (file)
index 0000000..86719ee
--- /dev/null
@@ -0,0 +1,8 @@
+using MonoTests.Helpers;
+
+public class Program {
+       public static void Main (string[] args)
+       {
+               OOMHelpers.RunTest ("sgen-bridge-major-fragmentation");
+       }
+}
diff --git a/mono/tests/sgen-oom-cementing-stress.cs b/mono/tests/sgen-oom-cementing-stress.cs
new file mode 100644 (file)
index 0000000..3edc874
--- /dev/null
@@ -0,0 +1,8 @@
+using MonoTests.Helpers;
+
+public class Program {
+       public static void Main (string[] args)
+       {
+               OOMHelpers.RunTest ("sgen-cementing-stress");
+       }
+}
diff --git a/mono/tests/sgen-oom-new-threads-dont-join-stw-2.cs b/mono/tests/sgen-oom-new-threads-dont-join-stw-2.cs
new file mode 100644 (file)
index 0000000..b94e070
--- /dev/null
@@ -0,0 +1,8 @@
+using MonoTests.Helpers;
+
+public class Program {
+       public static void Main (string[] args)
+       {
+               OOMHelpers.RunTest ("sgen-new-threads-dont-join-stw-2");
+       }
+}