Skip to content

Commit

Permalink
Merge branch 'zoffix-post-release'
Browse files Browse the repository at this point in the history
  • Loading branch information
zoffixznet committed Dec 20, 2017
2 parents cfaa5d1 + 8398c47 commit ad0069b
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 4 deletions.
16 changes: 14 additions & 2 deletions S17-promise/nonblocking-await.t
@@ -1,7 +1,7 @@
use v6.d.PREVIEW;
use Test;

plan 27;
plan 28;

# Limit scheduler to just 4 real threads, so we'll clearly be needing the
# non-blocking await support for these to pass.
Expand Down Expand Up @@ -168,7 +168,7 @@ PROCESS::<$SCHEDULER> := ThreadPoolScheduler.new(max_threads => 4);
CATCH {
default {
ok .does(X::Await::Died),
'Exception from awaiting many things, where on dies, does X::Await::Died';
'Exception from awaiting many things, where one dies, does X::Await::Died';
like .gist, /'golly!'/,
'Exception contains original exception message';
like .gist, /'death-bar'/,
Expand Down Expand Up @@ -271,3 +271,15 @@ PROCESS::<$SCHEDULER> := ThreadPoolScheduler.new(max_threads => 4);
is @foo.elems, 4, "slips awaited over get flattened out";
}
}

{ # https://github.com/rakudo/rakudo/issues/1323
# Await must be called in sink context here to trigger the covered bug.
# Gymnastics with atomic ints are just to reduce test runtime; the point
# of the test is that await awaits in this case for all Promises to
# complete instead of just returning immediately.
# (same test exists in 6.c tests on purpose; to cover Rakudo impl)
my atomicint $x;
sub p { start { sleep .3; $x++ } }
await (((p(), (p(), (p(),))), (p(), p(), p())), (p(), p(), p()));
is-deeply $x, 9, '&await awaits in sink context, with nested iterables';
}
14 changes: 13 additions & 1 deletion S17-promise/start.t
@@ -1,7 +1,7 @@
use v6;
use Test;

plan 59;
plan 60;

throws-like { await }, Exception, "a bare await should not work";

Expand Down Expand Up @@ -248,3 +248,15 @@ lives-ok {
});
nok $wrong, 'No data races on closure interpolation in strings';
}

{ # https://github.com/rakudo/rakudo/issues/1323
# Await must be called in sink context here to trigger the covered bug.
# Gymnastics with atomic ints are just to reduce test runtime; the point
# of the test is that await awaits in this case for all Promises to
# complete instead of just returning immediately.
# (same test exists in 6.d tests on purpose; to cover Rakudo impl)
my atomicint $x;
sub p { start { sleep .3; $x++ } }
await (((p(), (p(), (p(),))), (p(), p(), p())), (p(), p(), p()));
is-deeply $x, 9, '&await awaits in sink context, with nested iterables';
}
26 changes: 25 additions & 1 deletion S32-io/io-cathandle.t
Expand Up @@ -3,7 +3,7 @@ use lib <t/spec/packages>;
use Test;
use Test::Util;

plan 28;
plan 29;

# Tests for IO::CatHandle class

Expand Down Expand Up @@ -827,4 +827,28 @@ subtest 'words method' => {
'$limit 0, :close arg (all opened handles got closed)';
}

if $*DISTRO.is-win {
skip "Proc/Proc::Async with cmd.exe don't quite work on Windows: RT132258";
}
else {
# https://github.com/rakudo/rakudo/issues/1313
subtest 'IO::CatHandle.read does not switch to another handle too early' => {
plan 2;

my $p := run $*EXECUTABLE, '-e',
my $b := buf8.new;
$b.append: $*ARGFILES.read: 1000 for ^100;
$b.List.put;
, :in, :out, :err;
$p.in.print: "ab";
$p.in.flush;
sleep .6; # seems to be needed to ensure first print gets sent right away
$p.in.print: "cd";
$p.in.close;

is $p.out.slurp(:close), "97 98 99 100\n", 'got all elements';
is $p.err.slurp(:close), '', 'STDERR is empty';
}
}

# vim: ft=perl6 expandtab sw=4

0 comments on commit ad0069b

Please sign in to comment.