Re: Building on RH 8.0 using UML

[email protected] (Mike Stok)
Newsgroups perl.daily-build
Message-ID <[email protected]>
On Tue, 25 Mar 2003, Mike Stok wrote:

> On Tue, 25 Mar 2003, Robert Spier wrote:
> 
> > > So it looks like the alarm isn't killing the eval before the while 
> > > terminates.
> > 
> > Weird.
> > 
> > I wonder if this will happen in pure C code that does a similar busy
> > wait.  It may have to do with delayed signal delivery or such at the
> > UML level.
> 
> That sounds like a good avenuye of exploration; I'll look into it and 
> report back.

It *seems* that there is an interaction between lots of system calls in 
UML and a delay in the delivery of a SIGALRM.  See 
http://sourceforge.net/mailarchive/forum.php?thread_id=1880003&forum_id=3647 
for the discussion so far.

I will be smoketesting again from today using a patchlist containing a 
file with this patch to skip the first 2 alarm tests if I'm running under 
UML:

diff -ru perl.dist/t/op/alarm.t perl/t/op/alarm.t
--- perl.dist/t/op/alarm.t	2003-01-23 09:24:25.000000000 -0500
+++ perl/t/op/alarm.t	2003-03-27 09:53:21.000000000 -0500
@@ -16,21 +16,33 @@
 plan tests => 4;
 my $Perl = which_perl();
 
-my $start_time = time;
-eval {
-    local $SIG{ALRM} = sub { die "ALARM!\n" };
-    alarm 3;
-
-    # perlfunc recommends against using sleep in combination with alarm.
-    1 while (time - $start_time < 6);
-};
-alarm 0;
-my $diff = time - $start_time;
+my $usingUML;
 
-# alarm time might be one second less than you said.
-is( $@, "ALARM!\n",             'alarm w/$SIG{ALRM} vs inf loop' );
-ok( abs($diff - 3) <= 1,   "   right time" );
+if ($^O eq 'linux') {
+    local *FH;
+    if (open (FH, '/proc/cpuinfo')) {
+        $usingUML = grep /^model name\s*: UML/, <FH>;
+        close FH;
+    }
+}
 
+SKIP: {
+    skip "Running under UML", 2 if $usingUML;
+    my $start_time = time;
+    eval {
+        local $SIG{ALRM} = sub { die "ALARM!\n" };
+        alarm 3;
+
+        # perlfunc recommends against using sleep in combination with alarm.
+        1 while (time - $start_time < 6);
+    };
+    alarm 0;
+    my $diff = time - $start_time;
+
+    # alarm time might be one second less than you said.
+    is( $@, "ALARM!\n",             'alarm w/$SIG{ALRM} vs inf loop' );
+    ok( abs($diff - 3) <= 1,   "   right time" );
+}
 
 my $start_time = time;
 eval {

This will at least let me test everything exept alarm for 5.8.1 to be 
under rh8.

Would this generate meaningful test results?

Mike

-- 
[email protected]                    |           The "`Stok' disclaimers" apply.
http://www.stok.co.uk/~mike/       | GPG PGP Key      1024D/059913DA 
[email protected]                  | Fingerprint      0570 71CD 6790 7C28 3D60
http://www.exegenix.com/           |                  75D2 9EC4 C1C0 0599 13DA
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.