Fix the overflow check for xreallocarray in runtests

Make sure that we err on the side of failing when division rounds
down.
Restructure test result reallocation in runtests

Try to make the code a bit more readable and reduce the length of
a few long functions.
Change diag and sysdiag to always return true

diag and sysdiag now always return 1, making it easier to insert calls
into compound statements when debugging tests.  Based on a patch by
Peter Pöschl.
Release 3.1