ctest: count errors from scripts properly

In the unlikely event that someone has a billion+ scripts (or some
codepath returns negative numbers), we could overflow and make a pile of
errors a non-error. This change also allows us to use flags for the
error in the future rather than just "something went wrong".
Merge topic 'catch-ctest-errors-better' into next

d8589e64 ctest: count errors from scripts properly