check for fd leaks when stdin/out/err closed
David Golden
15 years ago
7 | 7 |
use warnings;
|
8 | 8 |
use Test::More;
|
9 | 9 |
use Config;
|
10 | |
use t::lib::Utils qw/save_std restore_std/;
|
|
10 |
use t::lib::Utils qw/save_std restore_std next_fd/;
|
11 | 11 |
use t::lib::Tests qw(
|
12 | 12 |
capture_tests capture_count
|
13 | 13 |
capture_merged_tests capture_merged_count
|
|
17 | 17 |
|
18 | 18 |
#--------------------------------------------------------------------------#
|
19 | 19 |
|
20 | |
plan tests => 1 + capture_count() + capture_merged_count()
|
|
20 |
plan tests => 2 + capture_count() + capture_merged_count()
|
21 | 21 |
+ tee_count() + tee_merged_count();
|
22 | 22 |
|
23 | 23 |
my $no_fork = $^O ne 'MSWin32' && ! $Config{d_fork};
|
|
26 | 26 |
|
27 | 27 |
save_std(qw/stdout/);
|
28 | 28 |
ok( close STDOUT, "closed STDOUT" );
|
|
29 |
|
|
30 |
my $fd = next_fd;
|
29 | 31 |
|
30 | 32 |
capture_tests();
|
31 | 33 |
capture_merged_tests();
|
|
36 | 38 |
tee_merged_tests();
|
37 | 39 |
}
|
38 | 40 |
|
|
41 |
is( next_fd, $fd, "no file descriptors leaked" );
|
|
42 |
|
39 | 43 |
restore_std(qw/stdout/);
|
40 | 44 |
|
7 | 7 |
use warnings;
|
8 | 8 |
use Test::More;
|
9 | 9 |
use Config;
|
10 | |
use t::lib::Utils qw/save_std restore_std/;
|
|
10 |
use t::lib::Utils qw/save_std restore_std next_fd/;
|
11 | 11 |
use t::lib::Tests qw(
|
12 | 12 |
capture_tests capture_count
|
13 | 13 |
capture_merged_tests capture_merged_count
|
|
17 | 17 |
|
18 | 18 |
#--------------------------------------------------------------------------#
|
19 | 19 |
|
20 | |
plan tests => 1 + capture_count() + capture_merged_count()
|
|
20 |
plan tests => 2 + capture_count() + capture_merged_count()
|
21 | 21 |
+ tee_count() + tee_merged_count();
|
22 | 22 |
|
23 | 23 |
my $no_fork = $^O ne 'MSWin32' && ! $Config{d_fork};
|
|
26 | 26 |
|
27 | 27 |
save_std(qw/stderr/);
|
28 | 28 |
ok( close STDERR, "closed STDERR" );
|
|
29 |
|
|
30 |
my $fd = next_fd;
|
29 | 31 |
|
30 | 32 |
capture_tests();
|
31 | 33 |
capture_merged_tests();
|
|
36 | 38 |
tee_merged_tests();
|
37 | 39 |
}
|
38 | 40 |
|
|
41 |
is( next_fd, $fd, "no file descriptors leaked" );
|
|
42 |
|
39 | 43 |
restore_std(qw/stderr/);
|
40 | 44 |
|
7 | 7 |
use warnings;
|
8 | 8 |
use Test::More;
|
9 | 9 |
use Config;
|
10 | |
use t::lib::Utils qw/save_std restore_std/;
|
|
10 |
use t::lib::Utils qw/save_std restore_std next_fd/;
|
11 | 11 |
use t::lib::Tests qw(
|
12 | 12 |
capture_tests capture_count
|
13 | 13 |
capture_merged_tests capture_merged_count
|
|
17 | 17 |
|
18 | 18 |
#--------------------------------------------------------------------------#
|
19 | 19 |
|
20 | |
plan tests => 1 + capture_count() + capture_merged_count()
|
|
20 |
plan tests => 2 + capture_count() + capture_merged_count()
|
21 | 21 |
+ tee_count() + tee_merged_count();
|
22 | 22 |
|
23 | 23 |
my $no_fork = $^O ne 'MSWin32' && ! $Config{d_fork};
|
|
26 | 26 |
|
27 | 27 |
save_std(qw/stdin/);
|
28 | 28 |
ok( close STDIN, "closed STDIN" );
|
|
29 |
|
|
30 |
my $fd = next_fd;
|
29 | 31 |
|
30 | 32 |
capture_tests();
|
31 | 33 |
capture_merged_tests();
|
|
36 | 38 |
tee_merged_tests();
|
37 | 39 |
}
|
38 | 40 |
|
|
41 |
is( next_fd, $fd, "no file descriptors leaked" );
|
|
42 |
|
39 | 43 |
restore_std(qw/stdin/);
|
40 | 44 |
|