Catching GMP test failures
pierre.labastie at neuf.fr
Thu Feb 9 12:53:00 PST 2012
Le 09/02/2012 21:16, Matt Burgess a écrit :
> Currently, jhalfs copies the exact command for invoking GMP's tests:
> make check 2>&1 | tee gmp-check-log>> $TEST_LOG 2>&1
> The problem with this is that the exit status of 'make check' is lost;
> the exit status of 'tee' is what will cause the script to fail or not,
> and that's pretty much never going to fail to run.
> The attached patch changes the command to:
> make check 2>&1 | tee gmp-check-log>> $TEST_LOG 2>&1&& exit
> I'm doing a full build now to test it, but it at least generates what I
> think is the correct command line.
As far as generating the line, the patch is OK,
but it seems to me that this command should make
the script stop unconditionnally
(with a zero exit status if the test succeeded and non zero otherwise).
One way to achieve the desired behavior could be to run the
line in a sub-shell (enclosing the line between parenthesis):
(make check 2>&1 | tee gmp-check-log>> $TEST_LOG 2>&1&&
Another way could be to eliminate any piping to tee during the tests
(testing the input line for '| tee'), since
the output is recorded anyway in $TEST_LOG...
I'd prefer this solution, otherwise we'd have to change how tests
are handled on a case by case basis each time the book adds
this kind of command (which was only in glibc when jhalfs was written)
More information about the alfs-discuss