This is a question more for my understanding than anything else. I'm using Test::More
to run some tests via TAP::Harness
.
When a test runs, it returns an exit code and a wait code.
The exit code is designed to return non-zero upon failure, as per the Test::More
documentation.
But what does the wait code signify? It appears to be a multiple of the number of failed tests (256 * n) for the tests I'm running.
My guess is that the protocol is trying to emulate parent-child process relationships à la Unix but I don't know anything about wait codes.
For more on how wait codes are structured, see the notes on $?. As you surmised, the exit code of Test::More is multiplied by 256 and normally that value will be the number of failed tests.
The reason the wait code is useful is that it lets you see when your code under harness exits because of a signal:
use Test::More tests => 2;
ok 1,"first";
kill 15,$$;
ok 1,"second";
Will yield a wait status of 15. Whether your scripts ever exit from a signal depends on what you are doing; I had a system that had to call a remote service that was unreliable and would see SIGPIPE errors when the other end died.