[tests] Add timeout limits to some longer sgen tests
[mono.git] / mono / tests / sgen-domain-unload.cs
index 670f218b3fb9ef73cd58ee1fbe190205d39bc4b2..b2bfc5e153ea43ec73e6064f6f0e5aef032e6ad8 100644 (file)
@@ -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
+}