source: trunk/essentials/dev-lang/perl/t/lib/cygwin.t

Last change on this file was 3181, checked in by bird, 18 years ago

perl 5.8.8

File size: 826 bytes
Line 
1#!perl
2
3BEGIN {
4 chdir 't' if -d 't';
5 @INC = ('../lib');
6 unless ($^O eq "cygwin") {
7 print "1..0 # skipped: cygwin specific test\n";
8 exit 0;
9 }
10}
11
12use Test::More tests => 4;
13
14is(Cygwin::winpid_to_pid(Cygwin::pid_to_winpid($$)), $$,
15 "perl pid translates to itself");
16
17my $parent = getppid;
18SKIP: {
19 skip "test not run from cygwin process", 1 if $parent <= 1;
20 is(Cygwin::winpid_to_pid(Cygwin::pid_to_winpid($parent)), $parent,
21 "parent pid translates to itself");
22}
23
24my $catpid = open my $cat, "|cat" or die "Couldn't cat: $!";
25open my $ps, "ps|" or die "Couldn't do ps: $!";
26my ($catwinpid) = map /^.\s+$catpid\s+\d+\s+\d+\s+(\d+)/, <$ps>;
27close($ps);
28
29is(Cygwin::winpid_to_pid($catwinpid), $catpid, "winpid to pid");
30is(Cygwin::pid_to_winpid($catpid), $catwinpid, "pid to winpid");
31close($cat);
Note: See TracBrowser for help on using the repository browser.