Subject: | t/05_sigint.t fails on AIX 6 for 5.10, 5.12 and 5.14 |
I have just built Test-TCP-1.13 on the following platform and perl combinations:
Platforms: 32 and 64 bit RHEL 5, Solaris 10, and AIX 6
Perls: 5.10.1, 5.12.4, 5.14.2
The test suite passes for RHEL5 and Solaris 10, but fails on AIX 6. The results are
independent of the core perl version. The test failure output is:
[efsops@shou18l560-02 Test-TCP-1.13]$ perl -Mblib t/05_sigint.t
1..2
ok 1
not ok 2 - sigint
# Failed test 'sigint'
# at t/05_sigint.t line 20.
# got: 'ZERO'
# expected: 'INT'
# Looks like you failed 1 test of 2.
The reason for the failure is somewhat subtle. On AIX, the value assigned to $? by wiatpid
can not be passed to the POSIX functions. However, if the ${^CHILD_ERROR_NATIVE} value is
used, then this works fine, and on ALL of the above platforms.
While the root cause of this problem is likely a bug in perl related to how $? is handled
internally, the patch I've provided seems correct when you consider that the documentation
for CHILD_ERROR_NATIVE specifically documents THIS variable (and not $?/$CHILD_ERROR) as
the one to pass to the POSIX functions.
I suspect that passing $? works for backwards compatibility, but clearly, it doesn't work on
ALL platforms, and the core perl tests seem to reflect this as well.
Subject: | Test-TCP-1.13-child_error_native.patch |
diff -rc ../Test-TCP-1.13-orig/t/05_sigint.t ./t/05_sigint.t
*** ../Test-TCP-1.13-orig/t/05_sigint.t Wed Mar 2 19:40:07 2011
--- ./t/05_sigint.t Mon Nov 28 09:16:04 2011
***************
*** 16,23 ****
sleep 1;
kill 'INT', $pid;
waitpid($pid, 0);
! ok POSIX::WIFSIGNALED($?);
! is [split / /, $Config{sig_name}]->[POSIX::WTERMSIG($?)], 'INT', "sigint";
# ok $killed_server, "really killed";
} elsif ($pid == 0) {
# $SIG{CHLD} = sub {
--- 16,23 ----
sleep 1;
kill 'INT', $pid;
waitpid($pid, 0);
! ok POSIX::WIFSIGNALED(${^CHILD_ERROR_NATIVE});
! is [split / /, $Config{sig_name}]->[POSIX::WTERMSIG(${^CHILD_ERROR_NATIVE})], 'INT', "sigint";
# ok $killed_server, "really killed";
} elsif ($pid == 0) {
# $SIG{CHLD} = sub {