Author: lupus
Date: 2007-07-13 06:00:30 -0400 (Fri, 13 Jul 2007)
New Revision: 81933

Modified:
   trunk/mono/mono/tests/test-driver
Log:
If a test doesn't finish in 2 minutes, consider it faulty.


Modified: trunk/mono/mono/tests/test-driver
===================================================================
--- trunk/mono/mono/tests/test-driver   2007-07-13 09:16:14 UTC (rev 81932)
+++ trunk/mono/mono/tests/test-driver   2007-07-13 10:00:30 UTC (rev 81933)
@@ -19,7 +19,27 @@
        }
 }
 
-my $res = system("$interpreter @ARGV $test 2>$stderr 1>$stdout");
+my $res;
+my $cpid = fork ();
+if (!defined ($cpid)) {
+       $res = system("$interpreter @ARGV $test 2>$stderr 1>$stdout");
+} elsif ($cpid == 0) {
+       exec ("$interpreter @ARGV $test 2>$stderr 1>$stdout") || die "Cannot 
exec: $!";
+} else {
+       # in the parent, setup the alarm
+       # test must complete in 2 minutes or it is considered buggy
+       my $timeout = 2*60;
+       alarm ($timeout);
+       $SIG{ALRM} = sub {
+               print "failed after $timeout seconds timeout.\n";
+               # process group kill
+               kill (-9, $cpid);
+               exit (3);
+       };
+       $res = wait ();
+       $SIG{ALRM} = sub {};
+       $res = $? >> 8;
+}
 
 if ($res) {
        printf ("failed $? (%d) signal (%d).\n", $? >> 8, $? & 127);

_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches

Reply via email to