From: Vlad Brezae Date: Mon, 10 Apr 2017 12:50:39 +0000 (+0300) Subject: [tests] Add timeout limits to some longer sgen tests X-Git-Url: http://wien.tomnetworks.com/gitweb/?p=mono.git;a=commitdiff_plain;h=6fa916095465900a598dd09e4c92feb64b04d9cb [tests] Add timeout limits to some longer sgen tests --- diff --git a/mono/tests/sgen-cementing-stress.cs b/mono/tests/sgen-cementing-stress.cs index 33c0bfa5bef..b6c94260d8d 100644 --- a/mono/tests/sgen-cementing-stress.cs +++ b/mono/tests/sgen-cementing-stress.cs @@ -17,6 +17,8 @@ class PinList next = n; } + static int list_size = 0; + static PinList MakeList (int length) { PinList l = null; @@ -42,7 +44,7 @@ class PinList { for (int j = 0; j < 10; ++j) { - MakeList (1 << 19); + MakeList (list_size >> 5); AssignReferences (list, objs); } return null; @@ -64,10 +66,19 @@ class PinList public static void Main () { - PinList list = MakeList (1 << 24); - Console.WriteLine ("long list constructed"); - Benchmark (list, 10); - GC.Collect (1); - Benchmark (list, 100); + list_size = 1 << 15; + TestTimeout timeout = TestTimeout.Start(TimeSpan.FromSeconds(TestTimeout.IsStressTest ? 60 : 5)); + + for (int it1 = 1; it1 <= 10; it1++, list_size <<= 1) { + PinList list = MakeList (list_size); + Console.WriteLine ("long list constructed {0}", it1); + for (int it2 = 0; it2 < 5; it2++) { + Benchmark (list, 10 * it1); + GC.Collect (1); + + if (!timeout.HaveTimeLeft) + return; + } + } } } diff --git a/mono/tests/sgen-domain-unload.cs b/mono/tests/sgen-domain-unload.cs index 670f218b3fb..b2bfc5e153e 100644 --- a/mono/tests/sgen-domain-unload.cs +++ b/mono/tests/sgen-domain-unload.cs @@ -45,8 +45,9 @@ class Driver { } static void CrossDomainTest (string name, CrossAppDomainDelegate dele) { + TestTimeout timeout = TestTimeout.Start (TimeSpan.FromSeconds(TestTimeout.IsStressTest ? 60 : 5)); Console.WriteLine ("----Testing {0}----", name); - for (int i = 0; i < 20; ++i) { + for (int i = 0; timeout.HaveTimeLeft; ++i) { var ad = AppDomain.CreateDomain (string.Format ("domain-{0}-{1}", name, i)); ad.DoCallBack (dele); AppDomain.Unload (ad); @@ -56,4 +57,4 @@ class Driver { static void Main () { CrossDomainTest ("simple-heap-with-los", Driver.SimpleHeapWithLOS); } -} \ No newline at end of file +}