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.