From c67775554f4ff295bac4605d9aa44a83b82eb4a7 Mon Sep 17 00:00:00 2001 From: Vlad Brezae Date: Fri, 31 Mar 2017 14:48:33 +0300 Subject: [PATCH] [sgen] Add oom testing suite --- mono/mini/TestHelpers.cs | 21 +++++++++++++++++++ mono/tests/Makefile.am | 10 +++++++++ .../sgen-oom-bridge-major-fragmentation.cs | 8 +++++++ mono/tests/sgen-oom-cementing-stress.cs | 8 +++++++ .../sgen-oom-new-threads-dont-join-stw-2.cs | 8 +++++++ 5 files changed, 55 insertions(+) create mode 100644 mono/tests/sgen-oom-bridge-major-fragmentation.cs create mode 100644 mono/tests/sgen-oom-cementing-stress.cs create mode 100644 mono/tests/sgen-oom-new-threads-dont-join-stw-2.cs diff --git a/mono/mini/TestHelpers.cs b/mono/mini/TestHelpers.cs index 01ed13532a1..26f8d1276d5 100644 --- a/mono/mini/TestHelpers.cs +++ b/mono/mini/TestHelpers.cs @@ -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; + } + } + } } diff --git a/mono/tests/Makefile.am b/mono/tests/Makefile.am index d5a4afca1ee..1628d7a1a38 100644 --- a/mono/tests/Makefile.am +++ b/mono/tests/Makefile.am @@ -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 index 00000000000..86719ee7930 --- /dev/null +++ b/mono/tests/sgen-oom-bridge-major-fragmentation.cs @@ -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 index 00000000000..3edc874f438 --- /dev/null +++ b/mono/tests/sgen-oom-cementing-stress.cs @@ -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 index 00000000000..b94e0705571 --- /dev/null +++ b/mono/tests/sgen-oom-new-threads-dont-join-stw-2.cs @@ -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"); + } +} -- 2.25.1