issue369.t 860 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. #! /usr/bin/env perl
  2. # http://code.google.com/p/perl-compiler/issues/detail?id=369
  3. # Coro::State transfer run-time stack corruption
  4. use strict;
  5. BEGIN {
  6. unshift @INC, 't';
  7. require "test.pl";
  8. }
  9. use Test::More;
  10. use Config;
  11. eval "use Coro; use EV;";
  12. if ($@) {
  13. plan skip_all => "Coro and EV are required for testing issue #369";
  14. } else {
  15. plan tests => 1;
  16. }
  17. use B::C ();
  18. my $cmt = '#369 Coro::State transfer run-time stack corruption';
  19. my $todo = "TODO ";
  20. #my $todo = $B::C::VERSION ge '1.52' ? "" : "TODO ";
  21. #$todo = "TODO 5.10thr " if $] =~ /^5\.010001/ and $Config{useithreads};
  22. ctestok(1, 'C,-O3', 'ccode369i', <<'EOF', $todo.'C '.$cmt);
  23. use EV;
  24. use Coro;
  25. use Coro::Timer;
  26. my @a;
  27. push @a, async {
  28. while() {
  29. warn $c++;
  30. Coro::Timer::sleep 1;
  31. };
  32. };
  33. push @a, async {
  34. while() {
  35. warn $d++;
  36. Coro::Timer::sleep 0.5;
  37. };
  38. };
  39. schedule;
  40. EOF