[prev in list] [next in list] [prev in thread] [next in thread] 

List:       perl-qa
Subject:    Re: Buffered parallel subtests
From:       Mark Morgan <makk384 () gmail ! com>
Date:       2009-06-29 21:22:38
Message-ID: f1a2bc2c0906291422m728811c5w1b9116d295fdca55 () mail ! gmail ! com
[Download RAW message or body]

Would a lock on STDOUT not achieve the same effect, 1/ without having
to introduce new syntax and 2/ while appearing more responsive to the
user?

You'd also still potentially get output conflated, as atomic write
size is a fixed size (I believe in the order of 2-4K on most systems,
looks to be 2K on my Mac, as per script below, anything higher than
2048 chars and I started getting overlapping data).

perl -le 'if (fork) { print "XS" . ("x" x 2045) while 1 } else { print
"YS" . ("y" x 2045) while 1 }'

Mark.

On Mon, Jun 29, 2009 at 8:39 PM, Ovid<publiustemp-perlqa3@yahoo.com> wrote:
>
> Hi all,
>
> I hope this idea makes sense.
>
> I was thinking about the issue of running subtests in parallel when I
> thought about the idea of a "buffered subtest".  Basically, it would
> work exactly like a normal subtest, but nothing would go to STDOUT or
> STDERR until the final line (the non-nested test summary line).  In
> other words:
>
>  use Test::More tests => 2;
>
>  buffered_subtest 'some subtest' = > sub {
>    plan tests => 2;
>    ok 1;
>    ok 1
>  };
>  ok 1;
>
> That might emit something like:
>
> 1..2
>    1..2
>    ok 1
>    ok 2
>  ok 1 - 'some subtest'
>  ok 2
>
> So
> if the 'some subtest' subtest didn't emit anything until
> that summary 'ok 1' line, can we safely run subtests in parallel
> without worrying about whether or not their output overlaps?
>
> Cheers,
> Ovid
> --
> Buy the book         - http://www.oreilly.com/catalog/perlhks/
> Tech blog            - http://use.perl.org/~Ovid/journal/
> Twitter              - http://twitter.com/OvidPerl
> Official Perl 6 Wiki - http://www.perlfoundation.org/perl6
>
>

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic